goods.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832
  1. <template>
  2. <app-layout>
  3. <view v-if="!loading" class="u-goods-detail"></view>
  4. <template v-else>
  5. <app-goods-banner
  6. :isCart="false"
  7. :picList="detail.pic_url"
  8. :share="detail.share"
  9. sign="pintuan"
  10. :goods_id="goods_id"
  11. :video-url="detail.video_url"
  12. ></app-goods-banner>
  13. <app-pt-time
  14. :theme="getTheme"
  15. :end_time="detail.pintuanGoods.end_time"
  16. :start_time="start_time"
  17. :time_str="time_str"
  18. ></app-pt-time>
  19. <!-- #ifndef MP-TOUTIAO -->
  20. <view>
  21. <!-- #endif -->
  22. <bd-info
  23. :theme="getTheme"
  24. :name="detail.name"
  25. :is-negotiable="detail.is_negotiable"
  26. :subtitle="detail.subtitle"
  27. :level-show="detail.level_show"
  28. :price="detail.price"
  29. :original-price="detail.original_price"
  30. :price-max="detail.price_max"
  31. :price-min="detail.price_min"
  32. :price-member-max="detail.price_member_max"
  33. :price-member-min="detail.price_member_min"
  34. :discount='discount'
  35. :is-vip-card-user="is_vip_card_user"
  36. :sales="detail.sales"
  37. :unit="detail.unit"
  38. :is-sales="detail.is_sales"
  39. :is-vip="isVip"
  40. :flash-sale="flash_sale"
  41. :goods-id="detail.id"
  42. :extra-quick-share="detail.extra_quick_share"
  43. :app-share-pic="detail.app_share_pic"
  44. :app-share-title="detail.app_share_title"
  45. :poster-config="poster_config"
  46. :poster-generate="poster_generate"
  47. :has-poster-nav="true"
  48. v-bind:goods="detail"
  49. :share-url="share_url"
  50. @share="hShareAppMessage"
  51. :limit-buy="detail.limit_buy"
  52. :min-number="detail.min_number"
  53. >
  54. <view class="app-bottom dir-left-wrap cross-center">
  55. <text class="app-price-symbol app-original-price" :style="{'color': getTheme.color}" v-if="detail.level_show === 1">{{detail.groups.original_price}}</text>
  56. <text class="app-pt-info" :style="{'color': getTheme.color,'background-color': getTheme.background_o}" v-for="(item, index) in detail.groups" :key="index">{{item.groups.people_num}}人拼团</text>
  57. <text class="app-pt-info" :style="{'color': getTheme.color,'background-color': getTheme.background_o}">拼团立省¥{{groupSparePrice}}</text>
  58. </view>
  59. </bd-info>
  60. <!-- #ifndef MP-TOUTIAO -->
  61. </view>
  62. <!-- #endif -->
  63. <bd-coupon @change="setCoupon" :theme="getTheme" :coupons="detail.goods_coupon_center"></bd-coupon>
  64. <bd-xbc
  65. :coAttr="is_open"
  66. :attr-list="selectAttr&&selectAttr.attr_list"
  67. :type="detail.type"
  68. :guarantee-title="detail.guarantee_title"
  69. :guarantee-pic="detail.guarantee_pic"
  70. :param_content="detail.param_content"
  71. :param_name="detail.param_name"
  72. :services="detail.services"
  73. :attr-groups="detail.attr_groups"
  74. @openAttr="shop(true)"
  75. ></bd-xbc>
  76. <!--商品信息-->
  77. <bd-hc
  78. :integral="detail.goods_marketing_award.integral"
  79. :coupon="detail.goods_marketing_award.coupon"
  80. :card="detail.goods_marketing_award.card"
  81. :balance="detail.goods_marketing_award.balance"
  82. :theme="getTheme"
  83. ></bd-hc>
  84. <bd-kb
  85. :limit="detail.goods_marketing.limit"
  86. :express="detail.express"
  87. :shipping="detail.goods_marketing.shipping"
  88. :pickup="detail.goods_marketing.pickup"
  89. ></bd-kb>
  90. <app-participant :theme="getTheme" :pintuan_list="pintuan_list"></app-participant>
  91. <bd-comments :goods-id="detail.id"></bd-comments>
  92. <bd-detail :detail="detail.detail"></bd-detail>
  93. <app-related-suggestion-product :theme="getTheme" sign="pintuan" :list="list"></app-related-suggestion-product>
  94. <!--空格区域-->
  95. <view class="safe-area-inset-bottom u-bottom">
  96. <view class="u-bottom-height" :class="pintuan_list.length > 0 && full_reduce ? 'u-bottom-height-1' : 'u-bottom-height-0'"></view>
  97. </view>
  98. <!--底部按钮-->
  99. <view v-if="is_open == 1" class="safe-area-inset-bottom u-bottom-fixed">
  100. <view v-if="full_reduce && !show">
  101. <app-goods-full-reduce
  102. :theme="getTheme"
  103. :full_reduce="full_reduce"
  104. >
  105. </app-goods-full-reduce>
  106. </view>
  107. <view class="join dir-left-nowrap cross-center main-between" v-if="pintuan_list.length > 0 && !show">
  108. <view class="dir-left-nowrap cross-center">
  109. <image class="avatar" :src="pintuan_list[0].avatar"></image>
  110. <view class="text">剩余
  111. <text style="color: #ff4544;">{{pintuan_list_time}}</text>
  112. ,还差{{pintuan_list[0].surplus_people}}人</view>
  113. </view>
  114. <view :style="{'background-color': getTheme.background}" class="btn" @click="goJoin(pintuan_list[0].id)">参与拼团</view>
  115. </view>
  116. <app-button-button
  117. :level_show="detail.level_show"
  118. :member_price_min="detail.groups[0].member_price_min"
  119. :groups="detail.groups"
  120. :pintuan_groups="item.pintuan_groups"
  121. :price="price"
  122. :price_member_min="detail.price_member_min"
  123. :is_alone_buy="detail.pintuanGoods.is_alone_buy"
  124. :selectGroupAttrId="selectGroupAttrId"
  125. :selectAttr="selectAttr"
  126. :pt="pt"
  127. :item="detail"
  128. @click="shop"
  129. :start_time="start_time"
  130. :theme="getTheme"
  131. :singlePrice="singlePrice"
  132. :name="detail.name"
  133. :url="webUrl"
  134. ></app-button-button>
  135. </view>
  136. <u-attr
  137. :goods="detail"
  138. :checked="selectAttr"
  139. :theme="getTheme"
  140. @check="attrTap"
  141. v-model="show"
  142. :is_show_left="false"
  143. :is_show_right="false"
  144. ref="attr"
  145. :again="again"
  146. >
  147. <view v-if="pt === true" slot="extra">
  148. <app-pt-attr :groups="detail.groups" :selectGroupAttrId="selectGroupAttrId" @click="setGroupAttrID" :theme="getTheme"></app-pt-attr>
  149. </view>
  150. <template slot="right">
  151. <view class="u-pt-bottom dir-left-nowrap">
  152. <view v-if="detail.pintuanGoods.is_alone_buy" class="bd-btn-left bd-btn dir-top-nowrap cross-center main-center box-grow-1"
  153. :style="{'background-color': getTheme.key == 'a' ? '#feeeee' : getTheme.background_s,'color': getTheme.key == 'a' ? '#ff5c5c' : getTheme.color}"
  154. @click="leftFunc(number)">
  155. <text class="price">
  156. {{singlePrice}}
  157. </text>
  158. <text class="app-text">单独购买</text>
  159. </view>
  160. <view @click="rightFunc" class="bd-btn dir-top-nowrap cross-center main-center box-grow-1"
  161. :style="{'background': getTheme.key == 'a' ? 'linear-gradient(140deg, #ff9460, #ff5c5c)' : getTheme.background,'color': getTheme.main_text}"
  162. :class="[!detail.pintuanGoods.is_alone_buy ? 'bd-btn-radius' : 'bd-btn-right']" >
  163. <text class="price">{{groupPrice}}</text>
  164. <text class="app-text">{{detail.groups[set_group_num].groups.people_num}}人拼团</text>
  165. </view>
  166. </view>
  167. </template>
  168. </u-attr>
  169. <!--快捷导航-->
  170. <app-quick-navigation></app-quick-navigation>
  171. </template>
  172. <app-close v-if="showClose" :modal="false" @update="getMall"></app-close>
  173. </app-layout>
  174. </template>
  175. <script>
  176. import { mapGetters, mapState } from 'vuex';
  177. import appGoodsBanner from '../../../components/page-component/goods/app-goods-banner.vue';
  178. import appPtTime from '../components/app-pt-time.vue';
  179. import appMerchantGuarantee from '../components/app-merchant-guarantee.vue';
  180. import appButtomButton from '../components/app-buttom-button.vue';
  181. import appPtAttr from '../components/app-pt-attr.vue';
  182. import appParticipant from '../components/app-participant.vue';
  183. import appRelatedSuggestionProduct from '../../../components/page-component/app-related-suggestion-product/app-related-suggestion-product.vue';
  184. import appQuickNavigation from "../../../components/page-component/app-quick-navigation/app-quick-navigation.vue";
  185. import appGoodsFullReduce from "../../../components/page-component/goods/app-goods-full-reduce";
  186. import uAttr from '@/components/page-component/goods/u-attr.vue';
  187. import bdInfo from '@/components/page-component/goods/bd-info';
  188. import bdCoupon from '@/components/page-component/goods/bd-coupon.vue';
  189. import bdXbc from '@/components/page-component/goods/bd-xbc.vue';
  190. import bdKb from '@/components/page-component/goods/bd-kb.vue';
  191. import bdHc from '@/components/page-component/goods/bd-hc.vue';
  192. import bdDetail from '@/components/page-component/goods/bd-detail.vue';
  193. import bdComments from '@/components/page-component/goods/bd-comments.vue';
  194. import appClose from '@/components/basic-component/app-close/app-close.vue';
  195. export default {
  196. name: 'goods',
  197. data() {
  198. return {
  199. showClose: false,
  200. is_open: 0,
  201. goods_id: 0,
  202. detail: {
  203. goods_activity: {
  204. full_reduce: {}
  205. },
  206. groups: []
  207. },
  208. full_reduce: null,
  209. loading: false,
  210. // 分享
  211. share_url: '',
  212. // 倒计时
  213. time_str: {
  214. day: '00',
  215. hou: '00',
  216. min: '00',
  217. sec: '00'
  218. },
  219. down_time: 0,
  220. // 超级会员功能
  221. discount: null,
  222. isVip: false,
  223. goods: {},
  224. item: {
  225. name: '',
  226. pintuan_groups: [],
  227. },
  228. selectAttr: null,
  229. show: false,
  230. pt: false,
  231. selectGroupAttrId: 0,
  232. pintuan_list: [],
  233. list: [],
  234. cartShow: false,
  235. price: '',
  236. webUrl: '',
  237. time: null,
  238. is_vip_card_user: 0,
  239. url: this.$api.pt.detail,
  240. poster_config: this.$api.pt.poster_config,
  241. poster_generate: this.$api.pt.poster_generate,
  242. aloneAttr: null,
  243. start_time: false,
  244. pintuan_list_time: '',
  245. pt_time: null,
  246. number: 1,
  247. group_price: '',
  248. again: 0,
  249. // 限时抢购
  250. flash_sale: null,
  251. }
  252. },
  253. computed: {
  254. ...mapState('gConfig', {
  255. iphone: (data) => {
  256. return data.iphone;
  257. },
  258. iphoneHeight: (state) => {
  259. return state.iphoneHeight;
  260. },
  261. }),
  262. ...mapState({
  263. mall: state => state.mallConfig.mall
  264. }),
  265. ...mapGetters('mallConfig', {
  266. getTheme: 'getTheme',
  267. }),
  268. set_group_num() {
  269. for (let i = 0; i < this.detail.groups.length; i++) {
  270. if (this.detail.groups[i].groups.id == this.selectGroupAttrId) {
  271. return i;
  272. }
  273. }
  274. },
  275. groupPrice: function() {
  276. if (!this.$validation.isEmpty(this.selectAttr)) {
  277. if (this.pt) {
  278. if (this.detail.level_show === 1) {
  279. if (this.selectAttr.price_member === 0) {
  280. return '免费';
  281. } else {
  282. return `¥${this.selectAttr.price_member}`;
  283. }
  284. } else {
  285. if (Number(this.selectAttr.price) === 0) {
  286. return '免费';
  287. } else {
  288. return `¥${this.selectAttr.price}`;
  289. }
  290. }
  291. } else {
  292. let attr = this.detail.groups[this.set_group_num].attr;
  293. for (let i = 0; i < attr.length; i++) {
  294. if (attr[i].sign_id === this.selectAttr.sign_id) {
  295. if (this.detail.level_show === 1) {
  296. if (attr[i].price_member === 0) {
  297. return '免费';
  298. } else {
  299. return `¥${attr[i].price_member}`;
  300. }
  301. } else {
  302. if (Number(attr[i].price) === 0) {
  303. return '免费';
  304. } else {
  305. return `¥${attr[i].price}`;
  306. }
  307. }
  308. }
  309. }
  310. }
  311. }
  312. },
  313. singlePrice: function() {
  314. if (!this.$validation.isEmpty(this.selectAttr)) {
  315. for (let i = 0; i < this.aloneAttr.length; i++) {
  316. if (this.aloneAttr[i].sign_id === this.selectAttr.sign_id) {
  317. if (this.detail.level_show === 1) {
  318. if (Number(this.aloneAttr[i].price_member) === 0) {
  319. return '免费';
  320. } else {
  321. return `¥${this.aloneAttr[i].price_member}`;
  322. }
  323. } else {
  324. if (Number(this.aloneAttr[i].price) === 0) {
  325. return '免费';
  326. } else {
  327. return `¥${this.aloneAttr[i].price}`;
  328. }
  329. }
  330. }
  331. }
  332. } else {
  333. if (this.detail.level_show === 1) {
  334. if (Number(this.detail.price_member_min) === 0) {
  335. return '免费';
  336. } else {
  337. return `¥${this.detail.price_member_min}`;
  338. }
  339. } else {
  340. if (Number(this.detail.price) === 0) {
  341. return '免费';
  342. } else {
  343. return `¥${this.detail.price}`
  344. }
  345. }
  346. }
  347. },
  348. groupSparePrice: function() {
  349. if (this.detail.groups.length > 0) {
  350. return (this.detail.original_price - this.detail.groups[0].price_min).toFixed(2);
  351. } else {
  352. return this.detail.original_price;
  353. }
  354. }
  355. },
  356. onShow() {
  357. this.showClose = false;
  358. setTimeout(()=>{
  359. this.showClose = true;
  360. })
  361. },
  362. onLoad(options) { this.$commonLoad.onload(options);
  363. this.webUrl = '/plugins/pt/goods/goods?goods_id=' + options.goods_id;
  364. this.goods_id = options.goods_id;
  365. this.requestDetail();
  366. this.newRecommend();
  367. // #ifdef MP-WEIXIN
  368. wx.showShareMenu({
  369. menus: ['shareAppMessage', 'shareTimeline']
  370. })
  371. // #endif
  372. },
  373. // #ifdef MP-WEIXIN
  374. onShareTimeline() {
  375. // 分享朋友圈beta
  376. return this.$shareTimeline({
  377. title: this.detail.app_share_title ? this.detail.app_share_title : this.detail.name,
  378. query: {
  379. goods_id: this.goods_id
  380. } // 此处填写页面的参数
  381. });
  382. },
  383. // #endif
  384. // #ifdef MP
  385. onShareAppMessage() {
  386. return this.hShareAppMessage();
  387. },
  388. // #endif
  389. methods: {
  390. hShareAppMessage(s = false){
  391. return this.$shareAppMessage({
  392. path: '/plugins/pt/goods/goods',
  393. title: this.detail.app_share_title ? this.detail.app_share_title : this.detail.name,
  394. imageUrl: this.detail.app_share_pic ? this.detail.app_share_pic : this.detail.pic_url[0].pic_url,
  395. desc: this.detail.subtitle,
  396. params: {
  397. goods_id: this.goods_id
  398. }
  399. }, s);
  400. },
  401. getMall(e) {
  402. this.is_open = e.is_open;
  403. },
  404. goJoin(id) {
  405. uni.navigateTo({
  406. url: `/plugins/pt/detail/detail?id=${id}`
  407. })
  408. },
  409. // 获取商品详情
  410. async requestDetail() {
  411. const e = await this.$request({
  412. url: this.$api.pt.detail,
  413. method: 'get',
  414. data: {
  415. id: this.goods_id,
  416. }
  417. });
  418. if (e.code === 0) {
  419. this.loading = true;
  420. let detail = e.data.detail;
  421. this.detail = detail;
  422. this.price = detail.price;
  423. // 规格初始化
  424. this.aloneAttr = JSON.parse(JSON.stringify(detail.attr));
  425. let groups = detail.groups;
  426. if (groups.length > 0) {
  427. this.detail.attr = groups[0].attr;
  428. this.selectGroupAttrId = groups[0].groups.id;
  429. }
  430. if (detail.goods_activity) {
  431. this.full_reduce = detail.goods_activity.full_reduce;
  432. }
  433. this.flash_sale = detail.plugin_extra.flash_sale;
  434. this.share_url = `${this.$api.pt.poster}&goods_id=${this.detail.id}`;
  435. this.poster_config = `${this.poster_config}&goods_id=${this.detail.id}`;
  436. this.poster_generate = `${this.poster_generate}&goods_id=${this.detail.id}`;
  437. this.pintuan_list = e.data.pintuan_list;
  438. if (this.pintuan_list.length > 0) {
  439. let timelog = new Date(this.pintuan_list[0].surplus_date_time.replace(/-/g, '/'));
  440. this.pt_time = setInterval(() =>{
  441. let time = timelog.getTime() - new Date().getTime();
  442. if (time < 0) {
  443. clearInterval(this.pt_time);
  444. }
  445. let day = parseInt((time/1000/60/60/24)%30);
  446. let hou = parseInt((time/1000/60/60)%24);
  447. let min = parseInt((time/1000/60)%60);
  448. let sec = parseInt((time/1000)%60);
  449. if (day > 0) {
  450. this.pintuan_list_time = day+"天"+hou+":"+(min<10?"0"+min:min) + ":"+(sec<10?"0"+sec:sec);
  451. } else {
  452. this.pintuan_list_time = hou+":"+(min<10?"0"+min:min) + ":"+(sec<10?"0"+sec:sec);
  453. }
  454. },1000);
  455. }
  456. if (detail.vip_card_appoint.discount) {
  457. this.isVip = true;
  458. this.discount = detail.vip_card_appoint.discount;
  459. }
  460. this.is_vip_card_user = detail.vip_card_appoint.is_vip_card_user;
  461. this.goods = {
  462. attr: detail.attr,
  463. cover_pic: detail.cover_pic,
  464. level_show: detail.level_show,
  465. price: detail.price,
  466. mch_id: detail.mch_id,
  467. name: detail.name,
  468. id: detail.id,
  469. };
  470. if (detail.pintuanGoods.end_time !== '0000-00-00 00:00:00') {
  471. this.countdown(detail.pintuanGoods.end_time);
  472. }
  473. if (detail.pintuanGoods.start_time) {
  474. let time = new Date(detail.pintuanGoods.start_time.replace(/-/g, '/'));
  475. let nowTime = new Date();
  476. let equation = time.getTime() - nowTime.getTime();
  477. if (equation > 0) {
  478. this.start_time = false;
  479. this.countdown(detail.pintuanGoods.start_time);
  480. } else {
  481. this.start_time = true;
  482. }
  483. }
  484. // #ifdef H5
  485. this.hShareAppMessage();
  486. // #endif
  487. } else {
  488. uni.showToast({
  489. title: e.msg,
  490. icon: 'none'
  491. })
  492. }
  493. },
  494. countdown(t) {
  495. let time = new Date(t.replace(/-/g, '/'));
  496. let nowTime = new Date();
  497. let equation = time.getTime() - nowTime.getTime();
  498. let day = parseInt((equation / 3600000 / 24));
  499. let hour = parseInt((equation / 1000 / 60 / 60) % 24);
  500. let minute = parseInt((equation / 1000 / 60) % 60);
  501. let second = parseInt((equation / 1000) % 60);
  502. this.time_str = {
  503. day: day < 10 ? `0${day}` : day,
  504. hou: hour < 10 ? `0${hour}` : hour,
  505. min: minute < 10 ? `0${minute}` : minute,
  506. sec: second < 10 ? `0${second}` : second
  507. }
  508. this.down_time = setTimeout(() => {
  509. this.countdown(t);
  510. }, 1000);
  511. },
  512. async newRecommend() {
  513. const e = await this.$request({
  514. url: this.$api.goods.new_recommend
  515. });
  516. if (e.code === 0) {
  517. this.list = e.data.list;
  518. }
  519. },
  520. setCoupon(index) {
  521. this.$set(this.detail.goods_coupon_center[index], 'is_receive', 1);
  522. },
  523. attrTap({item, number}) {
  524. for (let i = 0; i < this.aloneAttr.length; i++) {
  525. if (this.aloneAttr[i].sign_id === item.sign_id) {
  526. this.price = this.aloneAttr[i].price;
  527. }
  528. }
  529. this.number = number;
  530. this.selectAttr = item;
  531. },
  532. shop(data) {
  533. if (!this.detail.buy_goods_auth) {
  534. this.$tips.showToast({
  535. title: '您暂无权限购买该商品',
  536. icon: 'none'
  537. });
  538. return;
  539. }
  540. if (data === true) {
  541. this.$set(this, 'pt', true);
  542. this.detail.groups.forEach((item) => {
  543. if (this.selectGroupAttrId === item.groups.id) {
  544. this.$set(this.detail, 'attr', item.attr);
  545. this.$set(this.detail, 'id', item.groups.goods_id);
  546. }
  547. });
  548. } else {
  549. this.$set(this, 'pt', false);
  550. this.$set(this.detail, 'attr', this.aloneAttr);
  551. this.$set(this.detail, 'id', this.goods_id);
  552. }
  553. this.show = true;
  554. this.$nextTick(() => {
  555. this.again = Math.random();
  556. });
  557. },
  558. setGroupAttrID(item) {
  559. this.selectGroupAttrId = item.groups.id;
  560. this.$set(this.detail, 'attr', item.attr);
  561. this.$set(this.detail, 'id', item.groups.goods_id);
  562. this.$nextTick(() => {
  563. this.again = Math.random();
  564. });
  565. },
  566. defaultRequest() {
  567. this.$set(this, 'pt', true);
  568. this.detail.attr = this.detail.groups[0].attr;
  569. this.selectGroupAttrId = this.detail.groups[0].groups.id;
  570. this.detail.id = this.detail.groups[0].groups.goods_id;
  571. },
  572. rightFunc() {
  573. if (this.pt === false && this.show === true) {
  574. this.pt = true;
  575. this.$set(this, 'pt', true);
  576. setTimeout(() => {
  577. this.show = true;
  578. }, 500);
  579. this.detail.groups.forEach((item) => {
  580. if (this.selectGroupAttrId === item.groups.id) {
  581. this.$set(this.detail, 'attr', item.attr);
  582. this.$set(this.detail, 'id', item.groups.goods_id);
  583. }
  584. });
  585. this.$nextTick(() => {
  586. this.again = Math.random();
  587. });
  588. } else {
  589. if (this.detail.min_number > this.number) {
  590. this.$tips.showToast({
  591. title: '该商品' + this.detail.min_number + this.detail.unit + '起售',
  592. icon: 'none'
  593. });
  594. return false;
  595. }
  596. if (typeof this.detail.limit_buy !== 'undefined' && this.detail.limit_buy.status == 1 && this.detail.limit_buy.rest_number < this.number) {
  597. this.$tips.showToast({
  598. title: this.detail.limit_buy.text,
  599. icon: 'none'
  600. });
  601. return false;
  602. }
  603. let attrs = [];
  604. this.selectAttr.attr_list.forEach(item => {
  605. attrs.push({
  606. attr_id: item.attr_id,
  607. attr_group_id: item.attr_group_id
  608. });
  609. });
  610. let newData = {
  611. pintuan_order_id: 0,
  612. pintuan_group_id: this.selectGroupAttrId,
  613. mch_id: this.detail.mch_id ? this.detail.mch_id : 0,
  614. goods_list: [
  615. {
  616. id: this.detail.id,
  617. attrs,
  618. num: this.number,
  619. cat_id: 0,
  620. goods_attr_id: this.selectAttr.id
  621. }
  622. ]
  623. }
  624. uni.navigateTo({
  625. url: `/pages/order-submit/order-submit?mch_list=${JSON.stringify([newData])}&preview_url=${encodeURIComponent(this.$api.pt.order_preview)}&submit_url=${encodeURIComponent(this.$api.pt.order_submit)}`
  626. });
  627. }
  628. },
  629. leftFunc(number) {
  630. if (this.pt === true && this.show === true) {
  631. this.$set(this, 'pt', false);
  632. setTimeout(() => {
  633. this.show = true;
  634. }, 500);
  635. this.$set(this.detail, 'attr', this.aloneAttr);
  636. this.$set(this.detail, 'id', this.goods_id);
  637. this.$nextTick(() => {
  638. this.$refs.attr.firstSelect();
  639. });
  640. } else {
  641. if (this.detail.min_number > this.number) {
  642. this.$tips.showToast({
  643. title: '该商品' + this.detail.min_number + this.detail.unit + '起售',
  644. icon: 'none'
  645. });
  646. return false;
  647. }
  648. if (typeof this.detail.limit_buy !== 'undefined' && this.detail.limit_buy.status == 1 && this.detail.limit_buy.rest_number < this.number) {
  649. this.$tips.showToast({
  650. title: this.detail.limit_buy.text,
  651. icon: 'none'
  652. });
  653. return false;
  654. }
  655. let goods = this.detail;
  656. let select_attr = this.selectAttr;
  657. let attr = [];
  658. for (let i in select_attr.attr_list) {
  659. attr.push({
  660. attr_id: select_attr.attr_list[i].attr_id,
  661. attr_group_id: select_attr.attr_list[i].attr_group_id
  662. });
  663. }
  664. let mch_list = [{
  665. mch_id: goods.mch_id ? goods.mch_id : 0,
  666. pintuan_order_id: 0,
  667. pintuan_group_id: 0,
  668. goods_list: [{
  669. id: goods.id,
  670. attr: attr,
  671. num: number,
  672. cat_id: 0,
  673. goods_attr_id: select_attr.id
  674. }]
  675. }];
  676. uni.navigateTo({
  677. url: `/pages/order-submit/order-submit?mch_list=${JSON.stringify(mch_list)}&preview_url=${encodeURIComponent(this.$api.pt.order_preview)}&submit_url=${encodeURIComponent(this.$api.pt.order_submit)}`
  678. });
  679. }
  680. }
  681. },
  682. components: {
  683. bdInfo,
  684. bdCoupon,
  685. bdXbc,
  686. bdKb,
  687. bdHc,
  688. bdDetail,
  689. bdComments,
  690. 'app-goods-banner': appGoodsBanner,
  691. 'app-pt-time': appPtTime,
  692. 'app-merchant-guarantee': appMerchantGuarantee,
  693. 'app-button-button': appButtomButton,
  694. 'app-pt-attr': appPtAttr,
  695. 'app-participant': appParticipant,
  696. 'app-related-suggestion-product': appRelatedSuggestionProduct,
  697. 'app-quick-navigation': appQuickNavigation,
  698. uAttr,
  699. appGoodsFullReduce,
  700. appClose
  701. },
  702. onHide() {
  703. clearTimeout(this.down_time);
  704. },
  705. onUnload() {
  706. clearTimeout(this.down_time);
  707. }
  708. }
  709. </script>
  710. <style lang="scss" scoped>
  711. .vip-card {
  712. padding: 0 #{20rpx} #{20rpx};
  713. background-color: #fff;
  714. }
  715. .join-member {
  716. background-color: #ffffff;
  717. padding: 0 #{24rpx};
  718. box-sizing: border-box;
  719. }
  720. .app-buttons {
  721. position: fixed;
  722. z-index: 1602;
  723. }
  724. .join {
  725. width: 750upx;
  726. height: 88upx;
  727. background-color: #fff7b8;
  728. padding: 0 24upx;
  729. .avatar {
  730. width: 64upx;
  731. height: 64upx;
  732. border-radius: 32upx;
  733. }
  734. .btn {
  735. width: 160upx;
  736. height: 64upx;
  737. border-radius: 40upx;
  738. font-size: 26upx;
  739. color: #ffffff;
  740. line-height: 64upx;
  741. text-align: center;
  742. }
  743. .text {
  744. font-size: 26upx;
  745. margin-left: 24upx;
  746. line-height: 1;
  747. color: #353535;
  748. }
  749. }
  750. .u-bottom-fixed {
  751. position: fixed;
  752. bottom: 0;
  753. left: 0;
  754. width: 100%;
  755. z-index: 1500;
  756. background-color: #ffffff;
  757. }
  758. .u-bottom-height-0 {
  759. height: 190upx;
  760. }
  761. .u-bottom-height-1 {
  762. height: 280upx;
  763. }
  764. .goods-margin {
  765. margin-top: 20upx;
  766. }
  767. .u-pt-bottom {
  768. width: 702upx;
  769. height: 70upx;
  770. }
  771. .bd-btn-left {
  772. border-top-left-radius: 35upx;
  773. border-bottom-left-radius:35upx;
  774. }
  775. .bd-btn-radius {
  776. border-radius: 35upx;
  777. }
  778. .bd-btn-right {
  779. border-top-right-radius: 35upx;
  780. border-bottom-right-radius: 35upx;
  781. }
  782. .bd-btn {
  783. text-align: center;
  784. font-size: 22upx;
  785. }
  786. .app-bottom {
  787. margin-top: #{18rpx};
  788. >text {
  789. margin-bottom: 5upx;
  790. }
  791. .app-original-price {
  792. font-size: #{23rpx};
  793. margin-right: #{10rpx};
  794. }
  795. .app-pt-info {
  796. display: inline-block;
  797. height: #{30rpx};
  798. line-height: #{30rpx};
  799. padding: 0 #{8rpx};
  800. margin-left: #{5rpx};
  801. font-size: #{20rpx};
  802. }
  803. }
  804. .app-pt-button {
  805. background: linear-gradient(140deg, #ff9460, #ff5c5c);
  806. text {
  807. color: white;
  808. }
  809. }
  810. .app-single-button {
  811. background-color: #feeeee;
  812. text {
  813. color: #ff5c5c;
  814. }
  815. }
  816. .bt-text {
  817. color: white;
  818. }
  819. </style>