detail.vue 18 KB

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