detail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. <template>
  2. <app-layout>
  3. <view v-if="!detail" class="u-goods-detail"></view>
  4. <template v-if="detail">
  5. <app-goods-banner
  6. :pic-list="detail.pic_url"
  7. :share="detail.share"
  8. :video-url="detail.video_url"
  9. :goods_id="detail.id"
  10. :isCart="false"
  11. sign="pick"
  12. ></app-goods-banner>
  13. <bd-info
  14. :theme="themeObject"
  15. :name="detail.name"
  16. :is-negotiable="detail.is_negotiable"
  17. :subtitle="detail.subtitle"
  18. :level-show="detail.level_show"
  19. :flash-sale="flash_sale"
  20. :price="detail.price"
  21. :original-price="detail.original_price"
  22. :price-max="detail.price_max"
  23. :price-min="detail.price_min"
  24. :price-member-max="detail.price_member_max"
  25. :price-member-min="detail.price_member_min"
  26. :discount='discount'
  27. :is-vip-card-user="is_vip_card_user"
  28. :sales="detail.sales"
  29. :unit="detail.unit"
  30. :is-sales="detail.is_sales"
  31. :is-vip="isVip"
  32. :goods-id="detail.id"
  33. :extra-quick-share="detail.extra_quick_share"
  34. :app-share-pic="detail.app_share_pic"
  35. :app-share-title="detail.app_share_title"
  36. :poster-config="poster_config + `&goods_id=` + detail.id"
  37. :poster-generate="poster_generate + `&goods_id=` + detail.id"
  38. :has-poster-nav="true"
  39. :is-show-member="false"
  40. @quickShare="quickShare"
  41. v-bind:goods="detail"
  42. ></bd-info>
  43. <bd-coupon @change="setCoupon" :theme="themeObject" :coupons="detail.goods_coupon_center"></bd-coupon>
  44. <bd-xbc
  45. :coAttr="is_open"
  46. :attr-list="selectAttr.attr_list"
  47. :type="detail.type"
  48. :guarantee-title="detail.guarantee_title"
  49. :guarantee-pic="detail.guarantee_pic"
  50. :param_content="detail.param_content"
  51. :param_name="detail.param_name"
  52. :services="detail.services"
  53. :attr-groups="detail.attr_groups"
  54. @openAttr="clickAttr(1)"
  55. ></bd-xbc>
  56. <view class="rule">
  57. <view class="content dir-left-nowrap main-between" @click="goBack">
  58. <view class="dir-left-nowrap cross-center">
  59. <view class="tag">N元任选</view>
  60. <view class="activity-price">{{activity.rule_price}}元选{{activity.rule_num}}件</view>
  61. </view>
  62. <view class="dir-left-nowrap go cross-center">
  63. <view>去凑单</view>
  64. <image src="/static/image/icon/arrow-right.png"></image>
  65. </view>
  66. </view>
  67. </view>
  68. <!--商品信息-->
  69. <bd-hc
  70. :integral="detail.goods_marketing_award.integral"
  71. :coupon="detail.goods_marketing_award.coupon"
  72. :card="detail.goods_marketing_award.card"
  73. :balance="detail.goods_marketing_award.balance"
  74. :theme="themeObject"
  75. ></bd-hc>
  76. <bd-kb
  77. :limit="detail.goods_marketing.limit"
  78. :express="detail.express"
  79. :shipping="detail.goods_marketing.shipping"
  80. :pickup="detail.goods_marketing.pickup"
  81. ></bd-kb>
  82. <bd-comments :goods-id="detail.id"></bd-comments>
  83. <bd-detail :detail="detail.detail" :after_detail="detail.after_detail" :goodsId="detail.id"></bd-detail>
  84. <view class="recommend">
  85. <app-goods-recommend :detail="activity" :theme="getTheme" sign="pick" :is_show_member="false" :sureCart="false" :goods-list="recommend_list" :activity="activity"></app-goods-recommend>
  86. </view>
  87. <!-- 底部空格 -->
  88. <view class="safe-area-inset-bottom">
  89. <view class="u-bottom-height"></view>
  90. </view>
  91. <!-- 底部按钮 -->
  92. <view v-if="is_open == 1" class="safe-area-inset-bottom u-bottom-fixed">
  93. <view class="app-bottom dir-left-nowrap">
  94. <view class="dir-top-nowrap main-center cross-center little box-grow-0" @click="back">
  95. <image src="/static/image/icon/index.png"></image>
  96. <view>首页</view>
  97. </view>
  98. <view class="dir-top-nowrap main-center cross-center little box-grow-0" @click="favorite">
  99. <image :src="detail.favorite ? '/static/image/icon/icon-favorite-active.png' : '/static/image/icon/icon-favorite.png'"></image>
  100. <view>收藏</view>
  101. </view>
  102. <view class="box-grow-1 dir-left-nowrap" style="height: 100%;" v-if="detail.goods_num == 0">
  103. <view style="width: 100%;background-color: #CDCDCD;color: #fff;" class="main-center cross-center button">已售罄</view>
  104. </view>
  105. <view class="box-grow-1 dir-left-nowrap" style="height: 100%;" v-else>
  106. <template v-if="activity_status === 1">
  107. <view :class="getTheme === 'b' || getTheme === 'a' || getTheme === 'f' ? getTheme + '-s-back ' + 'text ' + getTheme : getTheme + '-s-back ' + getTheme + '-m-text ' + getTheme " class="secondary-background main-center cross-center button"
  108. @click="clickAttr(1)">
  109. 加入凑单池
  110. </view>
  111. <view class="background main-center cross-center button"
  112. :class="getTheme + '-m-back ' + getTheme"
  113. style="color: #ffffff;"
  114. @click="clickAttr"
  115. >返回凑单池
  116. </view>
  117. </template>
  118. <template v-else>
  119. <view class="background main-center cross-center button"
  120. style="background-color: #999999;width: 100%"
  121. >活动已结束
  122. </view>
  123. </template>
  124. </view>
  125. </view>
  126. </view>
  127. <u-attr
  128. :enable_screen="false"
  129. v-model="attrShow"
  130. :goods="detail"
  131. :themeObject="themeObject"
  132. :checked="selectAttr"
  133. :is_show_left="false"
  134. @check="onAttr"
  135. :rightFunc="true"
  136. @rightFunc="add"
  137. rightText="加入凑单池"
  138. >
  139. </u-attr>
  140. <app-quick-navigation></app-quick-navigation>
  141. </template>
  142. <app-close v-if="showClose" :modal="false" @update="getMall"></app-close>
  143. </app-layout>
  144. </template>
  145. <script>
  146. import {mapGetters} from "vuex";
  147. import appQuickNavigation from "../../../components/page-component/app-quick-navigation/app-quick-navigation.vue";
  148. import appGoodsBanner from "../../../components/page-component/goods/app-goods-banner";
  149. import appGoodsRecommend from "../../../components/page-component/app-goods-recommend/app-goods-recommend";
  150. import uAttr from '../../../components/page-component/goods/u-attr.vue';
  151. import bdInfo from '@/components/page-component/goods/bd-info';
  152. import bdCoupon from '@/components/page-component/goods/bd-coupon.vue';
  153. import bdXbc from '@/components/page-component/goods/bd-xbc.vue';
  154. import bdKb from '@/components/page-component/goods/bd-kb.vue';
  155. import bdHc from '@/components/page-component/goods/bd-hc.vue';
  156. import bdDetail from '@/components/page-component/goods/bd-detail.vue';
  157. import bdComments from '@/components/page-component/goods/bd-comments.vue';
  158. import appClose from '@/components/basic-component/app-close/app-close.vue';
  159. export default {
  160. name: 'detail',
  161. data() {
  162. return {
  163. showClose: false,
  164. is_open: 0,
  165. detail: null,
  166. attrShow: 0,
  167. selectAttr: {},
  168. isVip: false,
  169. discount: null,
  170. is_vip_card_user: 0,
  171. shareData: {},
  172. recommend_list: [],
  173. activity: {},
  174. shareUrl: '',
  175. activity_status: 1,
  176. poster_config: this.$api.pick.poster_config,
  177. poster_generate: this.$api.pick.poster_generate,
  178. // 限时抢购
  179. flash_sale: null,
  180. }
  181. },
  182. computed: {
  183. ...mapGetters('mallConfig', {
  184. getTheme: 'getTheme',
  185. }),
  186. themeObject:function() {
  187. return {
  188. back: this.getTheme + '-m-back ' + this.getTheme,
  189. theme: this.getTheme,
  190. color: this.getTheme + '-m-text ' + this.getTheme,
  191. sBack: this.getTheme + '-s-back ' + this.getTheme,
  192. backP: this.getTheme + '-m-back-p ' + this.getTheme,
  193. }
  194. },
  195. },
  196. components: {
  197. 'app-quick-navigation': appQuickNavigation,
  198. appGoodsBanner,
  199. 'app-goods-recommend': appGoodsRecommend,
  200. uAttr,
  201. bdInfo,
  202. bdCoupon,
  203. bdXbc,
  204. bdKb,
  205. bdHc,
  206. bdDetail,
  207. bdComments,
  208. appClose
  209. },
  210. methods: {
  211. getMall(e) {
  212. this.is_open = e.is_open;
  213. },
  214. async getDetail(id) {
  215. const e = await this.$request({
  216. url: this.$api.pick.goods,
  217. method: 'get',
  218. data: {
  219. id: id
  220. }
  221. });
  222. if (e.code === 0) {
  223. let {
  224. vip_card_appoint,
  225. plugin_extra
  226. } = e.data.detail;
  227. this.detail = e.data.detail;
  228. this.flash_sale = plugin_extra.flash_sale;
  229. this.activity = e.data.activity;
  230. this.recommend_list = e.data.list;
  231. this.shareUrl = `${this.$api.pick.poster}&goods_id=${this.detail.id}`;
  232. this.activity_status = e.data.activity_status;
  233. if(vip_card_appoint.discount || vip_card_appoint.discount === '0.00') {
  234. this.isVip = true;
  235. this.discount = vip_card_appoint.discount
  236. }
  237. this.is_vip_card_user = vip_card_appoint.is_vip_card_user;
  238. } else {
  239. uni.showToast({
  240. title: e.msg,
  241. icon: 'none'
  242. })
  243. }
  244. },
  245. setCoupon(index) {
  246. this.$set(this.detail.goods_coupon_center[index], 'is_receive', 1);
  247. },
  248. onAttr(data) {
  249. this.selectAttr = data;
  250. },
  251. quickShare(info) {
  252. this.shareData = info;
  253. },
  254. clickAttr(status) {
  255. if (this.activity_status !== 1) return;
  256. if (status === 1) {
  257. this.attrShow = true;
  258. } else {
  259. uni.navigateTo({
  260. url: `/plugins/pick/pond/pond?rule_num=${this.activity.rule_num}&pick_activity_id=${this.activity.id}`
  261. })
  262. }
  263. },
  264. async add(data) {
  265. let goods = data.goods_list[0];
  266. const e = await this.$request({
  267. url: this.$api.pick.add,
  268. data: {
  269. goods_id: goods.id,
  270. attr: goods.goods_attr_id,
  271. num: goods.num,
  272. pick_activity_id: this.activity.id
  273. }
  274. });
  275. if (e.code === 0) {
  276. uni.navigateBack();
  277. }
  278. },
  279. back() {
  280. uni.navigateTo({
  281. url: '/pages/index/index'
  282. });
  283. },
  284. goBack() {
  285. uni.navigateTo({
  286. url: '/plugins/pick/index/index'
  287. });
  288. },
  289. favorite() {
  290. let url = this.$api.user.favorite_add;
  291. let favorite = true;
  292. if (this.detail.favorite) {
  293. url = this.$api.user.favorite_remove;
  294. favorite = false;
  295. }
  296. this.detail.favorite = favorite;
  297. this.$request({
  298. url: url,
  299. data: {
  300. goods_id: this.detail.id,
  301. }
  302. }).then(response => {
  303. if (response.code === 0) {
  304. } else {
  305. uni.showModal({
  306. title: '提示',
  307. content: response.msg,
  308. showCancel: false,
  309. });
  310. }
  311. }).catch(() => {
  312. });
  313. },
  314. },
  315. onShow() {
  316. this.showClose = false;
  317. setTimeout(()=>{
  318. this.showClose = true;
  319. })
  320. },
  321. onLoad(options) {
  322. // #ifdef MP-WEIXIN
  323. wx.showShareMenu({
  324. menus: ['shareAppMessage', 'shareTimeline']
  325. })
  326. // #endif
  327. this.getDetail(options.goods_id);
  328. },
  329. // #ifdef MP-WEIXIN
  330. onShareTimeline() {
  331. // 分享朋友圈beta
  332. return this.$shareTimeline({
  333. title: this.detail.app_share_title ? this.detail.app_share_title : this.detail.name,
  334. query: {
  335. goods_id: this.detail.goods_id
  336. } // 此处填写页面的参数
  337. });
  338. },
  339. // #endif
  340. }
  341. </script>
  342. <style scoped lang="scss">
  343. .detail {
  344. }
  345. .goods-name {
  346. padding: #{24rpx 24rpx 0 24rpx};
  347. background-color: #ffffff;
  348. color: $uni-important-color-black;
  349. font-size: 28upx;
  350. line-height: 38upx;
  351. }
  352. .goods-subtitle {
  353. padding: #{24rpx};
  354. font-size: 24rpx;
  355. background-color: #ffffff;
  356. color: #999999;
  357. }
  358. .price {
  359. padding-top: #{24rpx};
  360. background-color: #ffffff;
  361. }
  362. .button {
  363. width: 50%;
  364. height: 100%;
  365. }
  366. .app-bottom {
  367. width: 100%;
  368. height: #{110rpx};
  369. font-size: $uni-font-size-general-one;
  370. background-color: #ffffff;
  371. }
  372. .little {
  373. width: #{110rpx};
  374. height: 100%;
  375. background-color: #ffffff;
  376. font-size: #{20rpx};
  377. color: $uni-general-color-two;
  378. &:first-child {
  379. border-right: #{1rpx} solid #e2e2e2;
  380. }
  381. image {
  382. width: #{40rpx};
  383. height: #{40rpx};
  384. display: block;
  385. margin-bottom: #{10rpx};
  386. }
  387. }
  388. .rule {
  389. width: #{702upx};
  390. height: #{66upx};
  391. margin:#{0 24upx};
  392. background-color: #ffffff;
  393. .content {
  394. width: #{702upx};
  395. background-color: #fff0f0;
  396. height: #{66upx};
  397. padding: #{0 24upx};
  398. }
  399. .tag {
  400. border-radius: #{13upx};
  401. font-size: #{19upx};
  402. line-height: 29upx;
  403. background-color: #ff4544;
  404. color: #ffffff;
  405. padding: #{1upx 10upx};
  406. }
  407. .activity-price {
  408. font-size: #{23upx};
  409. margin-left: #{17upx};
  410. }
  411. .go {
  412. >view {
  413. font-size: #{23upx};
  414. color: #999999;
  415. }
  416. >image {
  417. width: #{12upx};
  418. height: #{22upx};
  419. margin-left: #{14upx};
  420. }
  421. }
  422. }
  423. .text {
  424. color: #ffffff;
  425. }
  426. .u-bottom-fixed {
  427. position: fixed;
  428. bottom: 0;
  429. left: 0;
  430. width: 100%;
  431. z-index: 1602;
  432. background-color: #ffffff;
  433. }
  434. .u-bottom-height {
  435. height: 110upx;
  436. }
  437. </style>