1
0

detail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  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"></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. v-model="attrShow"
  129. :goods="detail"
  130. :themeObject="themeObject"
  131. :checked="selectAttr"
  132. :is_show_left="false"
  133. @check="onAttr"
  134. :rightFunc="true"
  135. @rightFunc="add"
  136. rightText="加入凑单池"
  137. >
  138. </u-attr>
  139. <app-quick-navigation></app-quick-navigation>
  140. </template>
  141. <app-close v-if="showClose" :modal="false" @update="getMall"></app-close>
  142. </app-layout>
  143. </template>
  144. <script>
  145. import {mapGetters} from "vuex";
  146. import appQuickNavigation from "../../../components/page-component/app-quick-navigation/app-quick-navigation.vue";
  147. import appGoodsBanner from "../../../components/page-component/goods/app-goods-banner";
  148. import appGoodsRecommend from "../../../components/page-component/app-goods-recommend/app-goods-recommend";
  149. import uAttr from '../../../components/page-component/goods/u-attr.vue';
  150. import bdInfo from '@/components/page-component/goods/bd-info';
  151. import bdCoupon from '@/components/page-component/goods/bd-coupon.vue';
  152. import bdXbc from '@/components/page-component/goods/bd-xbc.vue';
  153. import bdKb from '@/components/page-component/goods/bd-kb.vue';
  154. import bdHc from '@/components/page-component/goods/bd-hc.vue';
  155. import bdDetail from '@/components/page-component/goods/bd-detail.vue';
  156. import bdComments from '@/components/page-component/goods/bd-comments.vue';
  157. import appClose from '@/components/basic-component/app-close/app-close.vue';
  158. export default {
  159. name: 'detail',
  160. data() {
  161. return {
  162. showClose: false,
  163. is_open: 0,
  164. detail: null,
  165. attrShow: 0,
  166. selectAttr: {},
  167. isVip: false,
  168. discount: null,
  169. is_vip_card_user: 0,
  170. shareData: {},
  171. recommend_list: [],
  172. activity: {},
  173. shareUrl: '',
  174. activity_status: 1,
  175. poster_config: this.$api.pick.poster_config,
  176. poster_generate: this.$api.pick.poster_generate,
  177. // 限时抢购
  178. flash_sale: null,
  179. }
  180. },
  181. computed: {
  182. ...mapGetters('mallConfig', {
  183. getTheme: 'getTheme',
  184. }),
  185. themeObject:function() {
  186. return {
  187. back: this.getTheme + '-m-back ' + this.getTheme,
  188. theme: this.getTheme,
  189. color: this.getTheme + '-m-text ' + this.getTheme,
  190. sBack: this.getTheme + '-s-back ' + this.getTheme,
  191. backP: this.getTheme + '-m-back-p ' + this.getTheme,
  192. }
  193. },
  194. },
  195. components: {
  196. 'app-quick-navigation': appQuickNavigation,
  197. appGoodsBanner,
  198. 'app-goods-recommend': appGoodsRecommend,
  199. uAttr,
  200. bdInfo,
  201. bdCoupon,
  202. bdXbc,
  203. bdKb,
  204. bdHc,
  205. bdDetail,
  206. bdComments,
  207. appClose
  208. },
  209. methods: {
  210. getMall(e) {
  211. this.is_open = e.is_open;
  212. },
  213. async getDetail(id) {
  214. const e = await this.$request({
  215. url: this.$api.pick.goods,
  216. method: 'get',
  217. data: {
  218. id: id
  219. }
  220. });
  221. if (e.code === 0) {
  222. let {
  223. vip_card_appoint,
  224. plugin_extra
  225. } = e.data.detail;
  226. this.detail = e.data.detail;
  227. this.flash_sale = plugin_extra.flash_sale;
  228. this.activity = e.data.activity;
  229. this.recommend_list = e.data.list;
  230. this.shareUrl = `${this.$api.pick.poster}&goods_id=${this.detail.id}`;
  231. this.activity_status = e.data.activity_status;
  232. if(vip_card_appoint.discount || vip_card_appoint.discount === '0.00') {
  233. this.isVip = true;
  234. this.discount = vip_card_appoint.discount
  235. }
  236. this.is_vip_card_user = vip_card_appoint.is_vip_card_user;
  237. } else {
  238. uni.showToast({
  239. title: e.msg,
  240. icon: 'none'
  241. })
  242. }
  243. },
  244. setCoupon(index) {
  245. this.$set(this.detail.goods_coupon_center[index], 'is_receive', 1);
  246. },
  247. onAttr(data) {
  248. this.selectAttr = data;
  249. },
  250. quickShare(info) {
  251. this.shareData = info;
  252. },
  253. clickAttr(status) {
  254. if (this.activity_status !== 1) return;
  255. if (status === 1) {
  256. this.attrShow = true;
  257. } else {
  258. uni.navigateTo({
  259. url: `/plugins/pick/pond/pond?rule_num=${this.activity.rule_num}&pick_activity_id=${this.activity.id}`
  260. })
  261. }
  262. },
  263. async add(data) {
  264. let goods = data.goods_list[0];
  265. const e = await this.$request({
  266. url: this.$api.pick.add,
  267. data: {
  268. goods_id: goods.id,
  269. attr: goods.goods_attr_id,
  270. num: goods.num,
  271. pick_activity_id: this.activity.id
  272. }
  273. });
  274. if (e.code === 0) {
  275. uni.navigateBack();
  276. }
  277. },
  278. back() {
  279. uni.navigateTo({
  280. url: '/pages/index/index'
  281. });
  282. },
  283. goBack() {
  284. uni.navigateTo({
  285. url: '/plugins/pick/index/index'
  286. });
  287. },
  288. favorite() {
  289. let url = this.$api.user.favorite_add;
  290. let favorite = true;
  291. if (this.detail.favorite) {
  292. url = this.$api.user.favorite_remove;
  293. favorite = false;
  294. }
  295. this.detail.favorite = favorite;
  296. this.$request({
  297. url: url,
  298. data: {
  299. goods_id: this.detail.id,
  300. }
  301. }).then(response => {
  302. if (response.code === 0) {
  303. } else {
  304. uni.showModal({
  305. title: '提示',
  306. content: response.msg,
  307. showCancel: false,
  308. });
  309. }
  310. }).catch(() => {
  311. });
  312. },
  313. },
  314. onShow() {
  315. this.showClose = false;
  316. setTimeout(()=>{
  317. this.showClose = true;
  318. })
  319. },
  320. onLoad(options) {
  321. // #ifdef MP-WEIXIN
  322. wx.showShareMenu({
  323. menus: ['shareAppMessage', 'shareTimeline']
  324. })
  325. // #endif
  326. this.getDetail(options.goods_id);
  327. },
  328. // #ifdef MP-WEIXIN
  329. onShareTimeline() {
  330. // 分享朋友圈beta
  331. return this.$shareTimeline({
  332. title: this.detail.app_share_title ? this.detail.app_share_title : this.detail.name,
  333. query: {
  334. goods_id: this.detail.goods_id
  335. } // 此处填写页面的参数
  336. });
  337. },
  338. // #endif
  339. }
  340. </script>
  341. <style scoped lang="scss">
  342. .detail {
  343. }
  344. .goods-name {
  345. padding: #{24rpx 24rpx 0 24rpx};
  346. background-color: #ffffff;
  347. color: $uni-important-color-black;
  348. font-size: 28upx;
  349. line-height: 38upx;
  350. }
  351. .goods-subtitle {
  352. padding: #{24rpx};
  353. font-size: 24rpx;
  354. background-color: #ffffff;
  355. color: #999999;
  356. }
  357. .price {
  358. padding-top: #{24rpx};
  359. background-color: #ffffff;
  360. }
  361. .button {
  362. width: 50%;
  363. height: 100%;
  364. }
  365. .app-bottom {
  366. width: 100%;
  367. height: #{110rpx};
  368. font-size: $uni-font-size-general-one;
  369. background-color: #ffffff;
  370. }
  371. .little {
  372. width: #{110rpx};
  373. height: 100%;
  374. background-color: #ffffff;
  375. font-size: #{20rpx};
  376. color: $uni-general-color-two;
  377. &:first-child {
  378. border-right: #{1rpx} solid #e2e2e2;
  379. }
  380. image {
  381. width: #{40rpx};
  382. height: #{40rpx};
  383. display: block;
  384. margin-bottom: #{10rpx};
  385. }
  386. }
  387. .rule {
  388. width: #{702upx};
  389. height: #{66upx};
  390. margin:#{0 24upx};
  391. background-color: #ffffff;
  392. .content {
  393. width: #{702upx};
  394. background-color: #fff0f0;
  395. height: #{66upx};
  396. padding: #{0 24upx};
  397. }
  398. .tag {
  399. border-radius: #{13upx};
  400. font-size: #{19upx};
  401. line-height: 29upx;
  402. background-color: #ff4544;
  403. color: #ffffff;
  404. padding: #{1upx 10upx};
  405. }
  406. .activity-price {
  407. font-size: #{23upx};
  408. margin-left: #{17upx};
  409. }
  410. .go {
  411. >view {
  412. font-size: #{23upx};
  413. color: #999999;
  414. }
  415. >image {
  416. width: #{12upx};
  417. height: #{22upx};
  418. margin-left: #{14upx};
  419. }
  420. }
  421. }
  422. .text {
  423. color: #ffffff;
  424. }
  425. .u-bottom-fixed {
  426. position: fixed;
  427. bottom: 0;
  428. left: 0;
  429. width: 100%;
  430. z-index: 1602;
  431. background-color: #ffffff;
  432. }
  433. .u-bottom-height {
  434. height: 110upx;
  435. }
  436. </style>