goods.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952
  1. <template>
  2. <app-layout>
  3. <view v-if="!goods" class="u-goods-detail"></view>
  4. <view v-if="goods" style="background-color: #fff;">
  5. <app-nav-bar :fixed="true" :background-color="''" :xStyle="1" :hasMallSetting="2"
  6. :hasHeight="false"></app-nav-bar>
  7. <!--商品轮播图-->
  8. <app-goods-banner
  9. v-bind:pic-list="goods.pic_url"
  10. v-bind:share="goods.share"
  11. v-bind:video-url="goods.video_url"
  12. v-bind:goods_id="goodsId"
  13. ></app-goods-banner>
  14. <view>
  15. <bd-info
  16. :theme="getTheme"
  17. :name="name"
  18. :is-negotiable="is_negotiable"
  19. :subtitle="subtitle"
  20. :flash-sale="flash_sale"
  21. :level-show="level_show"
  22. :price="price"
  23. :original-price="original_price"
  24. :price-max="price_max"
  25. :price-min="price_min"
  26. :price-member-max="price_member_max"
  27. :price-member-min="price_member_min"
  28. :discount='discount'
  29. :is-vip-card-user="is_vip_card_user"
  30. :sales="sales"
  31. :is-vip="is_vip"
  32. :unit="unit"
  33. :is-sales="is_sales"
  34. :goods-id="goodsId"
  35. :extra-quick-share="extra_quick_share"
  36. :app-share-pic="app_share_pic ? app_share_pic: goods.pic_url[0].pic_url"
  37. :app-share-title="app_share_title ? app_share_title : name"
  38. :poster-config="poster_config + `&goods_id=` + goodsId"
  39. :poster-generate="poster_generate + `&goods_id=` + goodsId"
  40. :has-poster-nav="true"
  41. v-bind:goods="goods"
  42. @share="hShareAppMessage"
  43. @quickShare="quickShare"
  44. :limit-buy="limit_buy"
  45. :min-number="min_number"
  46. ></bd-info>
  47. </view>
  48. <!--商品优惠券-->
  49. <bd-coupon @change="setCoupon" :theme="getTheme" :coupons="goods_coupon_center"></bd-coupon>
  50. <!--商品规格-->
  51. <bd-xbc
  52. :coAttr="is_open == 1 && exchangeStatus ==null ? 1 : 0"
  53. :attr-list="checked && checked.attr_list"
  54. :type="goodsType"
  55. :guarantee-title="guarantee_title"
  56. :guarantee-pic="guarantee_pic"
  57. :param_content="param_content"
  58. :param_name="param_name"
  59. :param_style="2"
  60. :services="services"
  61. :attr-groups="attr_groups"
  62. :goods-stock="goods_num"
  63. @openAttr="clickAttr"
  64. ></bd-xbc>
  65. <!--商品信息-->
  66. <bd-hc
  67. :integral="goods_marketing_award.integral"
  68. :coupon="goods_marketing_award.coupon"
  69. :card="goods_marketing_award.card"
  70. :balance="goods_marketing_award.balance"
  71. :theme="getTheme"
  72. ></bd-hc>
  73. <bd-kb
  74. :limit="goods_marketing.limit"
  75. :express="express"
  76. :shipping="goods_marketing.shipping"
  77. :pickup="goods_marketing.pickup"
  78. ></bd-kb>
  79. <!--套餐组合-->
  80. <view class="goods-composition" v-if="composition && composition.list.length > 0">
  81. <view class="goods-composition-title">套装</view>
  82. <uni-swiper-dot :current="current" :theme="getTheme" :info="composition.list" mode="customize">
  83. <swiper @change="change" class="goods-composition-swiper" :current="current" :autoplay="true">
  84. <swiper-item v-for="item in composition.list" :key="item.id">
  85. <app-composition :theme="getTheme" @click="toComposition(item)" @look="toComposition(item)" :item="item"></app-composition>
  86. </swiper-item>
  87. </swiper>
  88. </uni-swiper-dot>
  89. <navigator url="/pages/case/hot_sale_project" hover-class="none">
  90. <view class="goods-composition-more main-between cross-center">
  91. <view>更多套装</view>
  92. <image src="https://shop.9026.com/web/statics/image/mall/static/icon/arrow-right.png"></image>
  93. </view>
  94. </navigator>
  95. </view>
  96. <view class="hxj-line"></view>
  97. <uTabsSwiper :list="[{tab:'商品详情'},{tab:'商品评价'}]" :current="tabsCurrent" name="tab" :activeColor="getTheme.color" :barHeight="0" :isScroll="false" @change="tabsChange" line></uTabsSwiper>
  98. <!-- 评价 -->
  99. <view v-show="tabsCurrent===1">
  100. <bd-comments :goods-id="goodsId" ></bd-comments>
  101. </view>
  102. <!--商品详情-->
  103. <view v-show="tabsCurrent===0">
  104. <bd-detail :detail="detail" ></bd-detail>
  105. </view>
  106. <!--相关推荐-->
  107. <app-goods-recommend :sureCart="true" :theme="getTheme" :goods-list="recommend_list"></app-goods-recommend>
  108. <!--空格区域-->
  109. <view class="safe-area-inset-bottom u-bottom">
  110. <view class="u-bottom-height" :class="uBottomHeight"></view>
  111. </view>
  112. <!--底部按钮-->
  113. <view v-if="is_open == 1" class="safe-area-inset-bottom u-bottom-fixed">
  114. <view v-if="full_reduce && exchangeStatus == null">
  115. <app-goods-full-reduce
  116. :theme="getTheme"
  117. :full_reduce="full_reduce"
  118. :sign="goodsType === 'goods' ? '' : 1"
  119. >
  120. </app-goods-full-reduce>
  121. </view>
  122. <view v-if="exchangeStatus == null && sell_time > 0">
  123. <app-sell-tip :time="sell_time" @changeTime="changeTime"></app-sell-tip>
  124. </view>
  125. <view class="bd-bottom u-bottom-height-0 cross-center dir-left-nowrap" >
  126. <template v-if="exchangeStatus == null">
  127. <view class="bd-back dir-top-nowrap main-center cross-center box-grow-0" @click="back">
  128. <image class="bd-icon" src="https://shop.9026.com/web/statics/image/mall/static/icon/index.png"></image>
  129. <text class="bd-text">首页</text>
  130. </view>
  131. <template v-if="is_negotiable !== 1">
  132. <bd-service :name="name" :url="sendPath"></bd-service>
  133. </template>
  134. <view class="bd-back dir-top-nowrap main-center cross-center box-grow-0" @click="setFavorite">
  135. <image class="bd-icon" :src="favorite ? 'https://t17.9026.com/web/statics/image/index/icon-favorite-active.png' : 'https://t17.9026.com/web/statics/image/index/icon-favorite.png'"></image>
  136. <text class="bd-text">收藏</text>
  137. </view>
  138. <template v-if="is_negotiable !== 1">
  139. <view class="box-grow-1 bd-btn bd-btn-color " :class="[disableBtn]" v-if="goods_num === 0 || is_finish_sell">
  140. {{is_finish_sell ? '商品已下架' : '已售罄'}}
  141. </view>
  142. <view class="box-grow-1 dir-left-nowrap" v-else>
  143. <view v-if="goods.type === 'goods'"
  144. @click="clickAttr(0)"
  145. :style="{'background': !goods || goods.buy_goods_auth ? getTheme.background_s_gradient_btn : '#999999','color': !goods || goods.buy_goods_auth ? getTheme.secondary_text : '#ffffff'}"
  146. :class="['bd-btn', leftTip
  147. ]"
  148. >
  149. 加入购物车
  150. </view>
  151. <view :class="[goods.type === 'goods' ? 'bd-btn-right bd-btn-half' : 'box-grow-1']" v-if="!(isTip == 0 && sell_time > 0)">
  152. <app-jump-button form>
  153. <view
  154. @click="clickAttr(1)"
  155. :style="{'background': goods.buy_goods_auth ? getTheme.background_gradient_btn : '#999999','color': goods.buy_goods_auth ? getTheme.main_text : ''}"
  156. :class="['bd-btn', 'bd-btn-color', 'box-grow-1', goods.type === 'goods' ? 'bd-btn-right' : '']"
  157. >{{rightRemindText}}
  158. </view>
  159. </app-jump-button>
  160. </view>
  161. </view>
  162. </template>
  163. <view class="box-grow-1 dir-left-nowrap bd-btn-tel" v-else>
  164. <block v-for="(item, index) in good_negotiable" :key="index">
  165. <view class="tel"
  166. v-if="item === 'contact_tel'"
  167. @click="makePhoneCall(mall.setting.contact_tel)"
  168. :style="{'background': good_negotiable.length === 1 ? getTheme.background_gradient_btn : getTheme.background_s_gradient_btn,'color': good_negotiable.length === 2 ? getTheme.color : ''}"
  169. :class="[good_negotiable.length === 1 ? 'all-radius all-width text ' : '', good_negotiable.length === 3 ? 'bd-three-one text ' : '', good_negotiable.length === 2 ? 'bd-btn-half' : '']"
  170. >
  171. 联系电话
  172. </view>
  173. <!-- #ifndef MP-TOUTIAO || MP-ALIPAY || H5 -->
  174. <button v-else-if="item === 'contact'"
  175. open-type="contact"
  176. show-message-card
  177. :send-message-title="name"
  178. :send-message-path="sendPath"
  179. :style="contactBtnStyle"
  180. class="contact" :class="contactBtn">
  181. 客服
  182. </button>
  183. <!-- #endif -->
  184. <view class="service"
  185. v-else-if="item === 'contact_web'"
  186. @click="router('/pages/web/web?url=' + encodeURIComponent(mall.setting.web_service_url))"
  187. :style="{'background': good_negotiable.length !== 3 ? getTheme.background_gradient_btn : '','color': good_negotiable.length === 1 ? getTheme.secondary_text : ''}"
  188. :class="good_negotiable.length === 3 ? 'default-bakground bd-three-one ' : good_negotiable.length === 2 ? 'bd-btn-half text ' : ' all-radius all-width '" >
  189. 客服
  190. </view>
  191. </block>
  192. </view>
  193. </template>
  194. <template v-else>
  195. <view v-if="exchangeStatus == 0" @click="toExchange" class="box-grow-1 bd-exchange" :style="{'background': getTheme.background_gradient_o}">
  196. 立即领取
  197. </view>
  198. <view class="box-grow-1 bd-exchange bd-over" v-else-if="exchangeStatus == 1">
  199. 已领取
  200. </view>
  201. </template>
  202. </view>
  203. </view>
  204. <!--快捷导航-->
  205. <app-quick-navigation></app-quick-navigation>
  206. <u-attr
  207. v-if="is_negotiable === 0 && exchangeStatus ==null && goods && goods.type"
  208. v-model="attrShow"
  209. :goods="goods"
  210. :theme="getTheme"
  211. :checked="checked"
  212. @check="check"
  213. @update="updateCartNumber"
  214. ></u-attr>
  215. </view>
  216. <app-close v-if="showClose" :modal="false" @update="getMall"></app-close>
  217. </app-layout>
  218. </template>
  219. <script>
  220. import {mapGetters, mapState} from "vuex";
  221. import appGoodsBanner from "../../components/page-component/goods/app-goods-banner.vue";
  222. import appGoodsRecommend from "../../components/page-component/app-goods-recommend/app-goods-recommend.vue";
  223. import appQuickNavigation from "../../components/page-component/app-quick-navigation/app-quick-navigation.vue";
  224. import appComposition from'../../components/basic-component/app-composition/app-composition.vue';
  225. import uniSwiperDot from '../../components/basic-component/uni-swiper-dot/uni-swiper-dot';
  226. import uAttr from '../../components/page-component/goods/u-attr.vue';
  227. import appGoodsFullReduce from '../../components/page-component/goods/app-goods-full-reduce.vue';
  228. import bdInfo from '@/components/page-component/goods/bd-info';
  229. import bdCoupon from '@/components/page-component/goods/bd-coupon.vue';
  230. import bdXbc from '@/components/page-component/goods/bd-xbc.vue';
  231. import bdKb from '@/components/page-component/goods/bd-kb.vue';
  232. import bdHc from '@/components/page-component/goods/bd-hc.vue';
  233. import bdDetail from '@/components/page-component/goods/bd-detail.vue';
  234. import bdComments from '@/components/page-component/goods/bd-comments.vue';
  235. import appClose from '@/components/basic-component/app-close/app-close.vue';
  236. import bdService from '@/components/page-component/goods/bd-service.vue';
  237. import bdFlashSale from '@/components/page-component/goods/bd-flash-sale.vue';
  238. import appSellTip from '@/components/page-component/goods/app-sell-tip.vue';
  239. import goodsMixin from '@/core/goods-mixin.js';
  240. import appNavBar from '@/components/page-component/index/app-nav-bar.vue';
  241. import uTabsSwiper from '@/components/basic-component/u-tabs-swiper/u-tabs-swiper.vue';
  242. export default {
  243. name: "goods",
  244. mixins: [goodsMixin],
  245. components: {
  246. appGoodsBanner,
  247. 'app-goods-recommend': appGoodsRecommend,
  248. 'app-quick-navigation': appQuickNavigation,
  249. 'app-composition': appComposition,
  250. appClose,
  251. uniSwiperDot,
  252. appGoodsFullReduce,
  253. uAttr,
  254. bdInfo,
  255. bdCoupon,
  256. bdXbc,
  257. bdKb,
  258. bdHc,
  259. bdDetail,
  260. bdComments,
  261. bdService,
  262. bdFlashSale,
  263. appSellTip,
  264. appNavBar,
  265. uTabsSwiper,
  266. },
  267. data() {
  268. return {
  269. tabsCurrent:0,
  270. showClose: false,
  271. is_open: 0,
  272. goods: null,
  273. selectAttr: null,
  274. recommend_list: null,
  275. is_vip: false,
  276. is_vip_card_user: 0,
  277. current: 0,
  278. discount: null,
  279. attrShow: false,
  280. shareData: null,
  281. contact_tel:'',
  282. contact: '',
  283. contact_web:'',
  284. sendPath: '',
  285. poster_config: this.$api.goods.poster,
  286. poster_generate: this.$api.poster.goods_new,
  287. // 限时抢购
  288. flash_sale: null,
  289. checked: null,
  290. // 商品服务
  291. services: null,
  292. // 商品详情
  293. detail: null,
  294. // 商品ID
  295. goodsId: null,
  296. // 套餐组合
  297. composition: null,
  298. autoplay: true,
  299. full_reduce: null,
  300. goods_marketing_award: null,
  301. express: null,
  302. goods_marketing: null,
  303. exchangeStatus: null,
  304. exchange: null,
  305. price: null,
  306. level_show: null,
  307. sales: null,
  308. unit: null,
  309. is_sales: null,
  310. extra_quick_share: null,
  311. price_max: null,
  312. price_min: null,
  313. price_member_max: null,
  314. price_member_min: null,
  315. original_price: null,
  316. subtitle: null,
  317. is_negotiable: null,
  318. name: null,
  319. app_share_pic: null,
  320. app_share_title: null,
  321. goodsType: null,
  322. favorite: null,
  323. goods_coupon_center: null,
  324. guarantee_title: null,
  325. guarantee_pic: null,
  326. param_content: null,
  327. param_name: null,
  328. attr_groups: null,
  329. goods_num: null,
  330. good_stock: null,
  331. min_number: null,
  332. limit_buy: null,
  333. disable: 'disable',
  334. sell_time: 0,
  335. template_message_list: [],
  336. is_finish_sell: false
  337. };
  338. },
  339. computed: {
  340. ...mapState({
  341. mall: state => state.mallConfig.mall,
  342. gConfig: state => state.gConfig,
  343. isTip: state => state.mallConfig.mall.setting.is_remind_sell_time
  344. }),
  345. ...mapGetters('mallConfig', {
  346. getTheme: 'getTheme',
  347. }),
  348. good_negotiable: function() {
  349. let good_negotiable = this.mall.setting.good_negotiable;
  350. this.contact_tel = '';
  351. this.contact = '';
  352. this.contact_web = '';
  353. let arr = [];
  354. for (let i = 0; i < good_negotiable.length; i++) {
  355. if (good_negotiable[i] === 'contact_tel') {
  356. this.contact_tel = 'contact_tel';
  357. }
  358. // #ifndef MP-TOUTIAO || MP-ALIPAY || H5
  359. if (good_negotiable[i] === 'contact') {
  360. this.contact = 'contact';
  361. }
  362. // #endif
  363. if (good_negotiable[i] === 'contact_web') {
  364. this.contact_web = 'contact_web';
  365. }
  366. }
  367. if (this.contact_tel) {
  368. arr.push(this.contact_tel);
  369. }
  370. if (this.contact) {
  371. arr.push(this.contact);
  372. }
  373. if (this.contact_web) {
  374. arr.push(this.contact_web);
  375. }
  376. return arr;
  377. },
  378. contactBtnStyle: function() {
  379. const len = this.good_negotiable.length;
  380. const theme = this.getTheme.key;
  381. if (len === 3 && (theme === 'a' || theme === 'b' || theme === 'f')) {
  382. return `background:${this.getTheme.background_gradient_btn}`;
  383. } else if (len === 3 && !(theme === 'a' || theme === 'b' || theme === 'f')) {
  384. return `background:${this.getTheme.background_gradient_btn};color:${this.getTheme.background_s}`;
  385. } if (len === 2 && (theme === 'a' || theme === 'b' || theme === 'f') && !this.contact_tel) {
  386. return `background:${this.getTheme.background_s_gradient_btn};`;
  387. } else if (len === 2 && (theme === 'a' || theme === 'b' || theme === 'f') && this.contact_tel) {
  388. return `background:${this.getTheme.background}`;
  389. } else if (len === 2 && !(theme === 'a' || theme === 'b' || theme === 'f') && !this.contact_tel) {
  390. return `background:${this.getTheme.background_s_gradient_btn};color:${this.getTheme.background_s}`;
  391. } else if (len === 2 && !(theme === 'a' || theme === 'b' || theme === 'f') && this.contact_tel) {
  392. return `background:${this.getTheme.background_gradient_btn};color:${this.getTheme.background_s}`;
  393. } else {
  394. return `background:${this.getTheme.background_gradient_btn}`;
  395. }
  396. },
  397. uBottomHeight() {
  398. if (this.full_reduce && this.sell_time > 0) {
  399. return 'u-bottom-height-2';
  400. } else if (this.full_reduce || this.sell_time > 0) {
  401. return 'u-bottom-height-1';
  402. } else {
  403. return 'u-bottom-height-0';
  404. }
  405. },
  406. leftTip() {
  407. let leftTip = '';
  408. if (!(this.isTip == 0 && this.sell_time > 0)) {
  409. leftTip = 'bd-btn-left bd-btn-half';
  410. } else {
  411. leftTip = 'box-grow-1';
  412. }
  413. return this.goods && this.goods.type === 'goods' ? leftTip : '';
  414. },
  415. disableBtn() {
  416. return this.is_finish_sell ? 'btn-finish-sell' : 'bd-oversell-btn';
  417. },
  418. contactBtn: function() {
  419. const len = this.good_negotiable.length;
  420. const theme = this.getTheme.key;
  421. if (len === 3 && (theme === 'a' || theme === 'b' || theme === 'f')) {
  422. return `text bd-three-one bd-no-radius `;
  423. } else if (len === 3 && !(theme === 'a' || theme === 'b' || theme === 'f')) {
  424. return `bd-three-one bd-no-radius `;
  425. } if (len === 2 && (theme === 'a' || theme === 'b' || theme === 'f') && !this.contact_tel) {
  426. return `text bd-btn-half bd-content-radius-0`;
  427. } else if (len === 2 && (theme === 'a' || theme === 'b' || theme === 'f') && this.contact_tel) {
  428. return `bd-btn-half bd-content-radius-1`;
  429. } else if (len === 2 && !(theme === 'a' || theme === 'b' || theme === 'f') && !this.contact_tel) {
  430. return `bd-btn-half bd-content-radius-0`;
  431. } else if (len === 2 && !(theme === 'a' || theme === 'b' || theme === 'f') && this.contact_tel) {
  432. return `bd-btn-half bd-content-radius-1`;
  433. } else {
  434. return `text all-width all-radius `;
  435. }
  436. }
  437. },
  438. onLoad(options) { this.$commonLoad.onload(options);
  439. // #ifdef MP-WEIXIN
  440. wx.showShareMenu({
  441. menus: ['shareAppMessage', 'shareTimeline']
  442. })
  443. // #endif
  444. if (this.isLogin) {
  445. this.$store.dispatch('user/info');
  446. }
  447. this.goodsId = options.id;
  448. // #ifndef MP-ALIPAY
  449. this.loadData(this.goodsId, options);
  450. // #endif
  451. this.sendPath = '/pages/goods/goods?id=' + options.id;
  452. console.log(this.sendPath)
  453. if(options && options.exchange) {
  454. this.exchangeStatus = options.exchange;
  455. this.exchange = options;
  456. }
  457. },
  458. onShow() {
  459. this.autoplay = true;
  460. this.showClose = false;
  461. setTimeout(()=>{
  462. this.showClose = true;
  463. // #ifdef MP-ALIPAY
  464. this.loadData(this.goodsId, this.exchange);
  465. // #endif
  466. });
  467. },
  468. onHidden() {
  469. this.autoplay = false;
  470. },
  471. // #ifdef MP-WEIXIN
  472. onShareTimeline() {
  473. // 分享朋友圈beta
  474. return this.$shareTimeline({
  475. title: this.app_share_title ? this.app_share_title : this.name,
  476. imageUrl: this.goods.pic_url[0].pic_url,
  477. query: {
  478. id: this.goodsId
  479. }
  480. });
  481. },
  482. // #endif
  483. methods: {
  484. hShareAppMessage(s = false) {
  485. return this.$shareAppMessage({
  486. title: this.app_share_title ? this.app_share_title : this.name,
  487. imageUrl: this.app_share_pic ? this.app_share_pic : this.goods.pic_url[0].pic_url,
  488. path: '/pages/goods/goods',
  489. desc: this.subtitle,
  490. params: {
  491. id: this.goodsId
  492. }
  493. }, s);
  494. },
  495. getMall(e) {
  496. this.is_open = e.is_open;
  497. },
  498. toExchange() {
  499. let mch_list = [{
  500. mch_id: 0,
  501. goods_list: [{
  502. id: this.exchange.id,
  503. attr: this.exchange.attr,
  504. num: this.exchange.goods_num,
  505. cat_id: 0,
  506. goods_attr_id: this.exchange.attr_id
  507. }],
  508. code: this.exchange.code,
  509. token: this.exchange.token,
  510. }];
  511. let url = `/pages/order-submit/order-submit?mch_list=${JSON.stringify(mch_list)}`;
  512. url += `&preview_url=${encodeURIComponent(this.$api.exchange.exchange_preview)}&submit_url=${encodeURIComponent(this.$api.exchange.exchange_submit)}&plugin=exchange`;
  513. uni.navigateTo({
  514. url: url
  515. })
  516. },
  517. // 规格选择
  518. check({item}) {
  519. this.checked = item;
  520. },
  521. change(e) {
  522. if(e.detail.source === 'touch') {
  523. this.current = e.detail.current;
  524. }
  525. if(e.detail.source === 'autoplay') {
  526. this.current = e.detail.current;
  527. }
  528. },
  529. tabsChange(e){
  530. this.tabsCurrent=e
  531. },
  532. quickShare(info) {
  533. this.shareData = info;
  534. //#ifdef H5
  535. this.$shareAppMessage(this.shareData, true);
  536. // #endif
  537. },
  538. toComposition(item) {
  539. let id = item.id > 0 ? item.id : this.composition.list[0].id
  540. uni.navigateTo({
  541. // url: this.composition.url + '?goods_id=' + this.goodsId + '&composition_id=' + id
  542. url: '/pages/case/projectInfo?id='+ id
  543. })
  544. },
  545. loadData(id, options) {
  546. return new Promise((resolve, reject) => {
  547. this.$showLoading();
  548. this.$request({
  549. url: this.$api.goods.detail,
  550. data: {
  551. id: id,
  552. plugin: options && options.exchange ? 'exchange' : 'mall'
  553. }
  554. }).then(response => {
  555. this.$hideLoading();
  556. if (response.code === 0) {
  557. let { services,
  558. detail, name,
  559. vip_card_appoint, plugin_extra, id,
  560. goods_activity, goods_marketing_award,
  561. goods_marketing, express,
  562. price, sales,
  563. level_show, is_sales, unit, extra_quick_share,
  564. price_max, price_min, price_member_max,
  565. price_member_min, original_price, subtitle,
  566. is_negotiable, app_share_title,
  567. app_share_pic, type, favorite, goods_coupon_center,
  568. guarantee_title, guarantee_pic, param_content,
  569. param_name, attr_groups, goods_num, good_stock,
  570. min_number, limit_buy, sell_time, template_message_list,
  571. is_finish_sell
  572. } = response.data.goods;
  573. uni.setNavigationBarTitle({
  574. title: name
  575. });
  576. this.name = name;
  577. this.app_share_pic = app_share_pic;
  578. this.app_share_title = app_share_title;
  579. this.goods = response.data.goods;
  580. this.services = services;
  581. this.detail = detail;
  582. this.goodsId = id;
  583. this.flash_sale = plugin_extra.flash_sale;
  584. this.composition = plugin_extra.composition;
  585. this.goods_marketing_award = goods_marketing_award;
  586. this.goods_marketing = goods_marketing;
  587. this.express = express;
  588. this.price = price;
  589. this.level_show = level_show;
  590. this.sales = sales;
  591. this.unit = unit;
  592. this.is_sales = is_sales;
  593. this.price_max = price_max;
  594. this.price_min = price_min;
  595. this.price_member_max = price_member_max;
  596. this.price_member_min = price_member_min;
  597. this.original_price = original_price;
  598. this.subtitle = subtitle;
  599. this.is_negotiable = is_negotiable;
  600. this.extra_quick_share = extra_quick_share;
  601. this.goodsType = type;
  602. this.favorite = favorite;
  603. this.goods_coupon_center = goods_coupon_center;
  604. this.guarantee_title = guarantee_title;
  605. this.param_content = param_content;
  606. this.guarantee_pic = guarantee_pic;
  607. this.attr_groups = attr_groups;
  608. this.param_name = param_name;
  609. this.goods_num = goods_num;
  610. this.good_stock = good_stock;
  611. this.min_number = min_number;
  612. this.limit_buy = limit_buy;
  613. this.sell_time = sell_time;
  614. this.template_message_list = template_message_list;
  615. this.is_finish_sell = is_finish_sell;
  616. if (goods_activity) {
  617. this.full_reduce = goods_activity.full_reduce;
  618. }
  619. if(vip_card_appoint.discount || vip_card_appoint.discount === '0.00') {
  620. this.is_vip = true;
  621. this.discount = vip_card_appoint.discount
  622. }
  623. this.is_vip_card_user = vip_card_appoint.is_vip_card_user;
  624. this.loadRecommend();
  625. // #ifdef H5
  626. this.hShareAppMessage();
  627. // #endif
  628. resolve();
  629. } else {
  630. uni.showToast({
  631. title: response.msg,
  632. icon: 'none'
  633. });
  634. reject();
  635. }
  636. }).catch(() => {
  637. reject();
  638. this.$hideLoading();
  639. });
  640. });
  641. },
  642. onAttr(data) {
  643. this.selectAttr = data;
  644. },
  645. loadRecommend() {
  646. this.$request({
  647. url: this.$api.goods.new_recommend,
  648. data: {
  649. goods_id: this.goodsId,
  650. type: 'goods'
  651. }
  652. }).then(response => {
  653. if (response.code === 0) {
  654. this.recommend_list = response.data.list;
  655. }
  656. });
  657. },
  658. back() {
  659. uni.reLaunch({
  660. url: '/pages/index/index'
  661. });
  662. },
  663. setFavorite() {
  664. let url = this.$api.user.favorite_add;
  665. let favorite = true;
  666. if (this.favorite) {
  667. url = this.$api.user.favorite_remove;
  668. favorite = false;
  669. }
  670. this.favorite = favorite;
  671. this.$request({
  672. url: url,
  673. data: {
  674. goods_id: this.goodsId
  675. }
  676. }).then(response => {
  677. if (response.code === 0) {
  678. } else {
  679. uni.showModal({
  680. title: '提示',
  681. content: response.msg,
  682. showCancel: false
  683. });
  684. }
  685. });
  686. },
  687. clickAttr(data) {
  688. console.log('开始')
  689. if (data === 1 && this.sell_time > 0) {
  690. this.rightTip();
  691. return ;
  692. }
  693. if (!this.goods.buy_goods_auth) {
  694. this.$tips.showToast({
  695. title: '您暂无权限购买该商品',
  696. icon: 'none'
  697. });
  698. return;
  699. }
  700. if (this.goods.type === 'ecard' && data === 0) {
  701. this.$tips.showToast({
  702. title: '虚拟商品不允许加入购物车',
  703. icon: 'none'
  704. });
  705. return;
  706. }
  707. this.attrShow = true;
  708. console.log('结束')
  709. },
  710. setCoupon(index) {
  711. this.$set(this.goods_coupon_center[index], 'is_receive', 1);
  712. },
  713. router(url) {
  714. uni.navigateTo({
  715. url: url
  716. })
  717. },
  718. makePhoneCall(number) {
  719. uni.makePhoneCall({
  720. phoneNumber: number
  721. });
  722. },
  723. changeTime(time) {
  724. this.sell_time = time;
  725. this.goods.sell_time = time;
  726. }
  727. },
  728. // #ifdef MP
  729. onShareAppMessage(object) {
  730. if (object.from === 'button' && this.shareData) {
  731. return this.$shareAppMessage(this.shareData);
  732. }
  733. return this.hShareAppMessage();
  734. },
  735. // #endif
  736. }
  737. </script>
  738. <style scoped lang="scss">
  739. .goods-composition {
  740. width: 702upx;
  741. margin: 20upx 20upx 0 20upx;
  742. padding: 20rpx;
  743. background-color: #fff;
  744. border-radius: 15upx;
  745. .goods-composition-title {
  746. font-size: 28rpx;
  747. color: #353535;
  748. margin-bottom: 20rpx;
  749. }
  750. .goods-composition-swiper {
  751. height: 194rpx;
  752. }
  753. .goods-composition-more {
  754. margin: 20rpx auto 4rpx auto;
  755. width: 190rpx;
  756. padding: 0 24rpx;
  757. height: 56rpx;
  758. line-height: 54rpx;
  759. border-radius: 28rpx;
  760. border: 2rpx solid #bbbbbb;
  761. font-size: 24rpx;
  762. color: #999999;
  763. image {
  764. width: #{12rpx};
  765. height: #{22rpx};
  766. }
  767. }
  768. }
  769. .goods-name {
  770. padding: 24upx 24upx 0 24upx;
  771. background-color: #ffffff;
  772. color: #353535;
  773. font-size: 32upx;
  774. line-height: 42upx;
  775. }
  776. .goods-subtitle {
  777. padding: #{24rpx 24rpx 0 24rpx};
  778. font-size: 24rpx;
  779. background-color: #ffffff;
  780. color: #999999;
  781. }
  782. .price {
  783. padding-top: #{24rpx};
  784. background-color: #ffffff;
  785. }
  786. .vip-card {
  787. padding-bottom: #{20rpx};
  788. background-color: #fff;
  789. }
  790. .attr {
  791. background-color: #f7f7f7;
  792. }
  793. .bottom {
  794. width: 100%;
  795. height: #{110rpx};
  796. }
  797. .bd-bottom {
  798. width: 750upx;
  799. height: 110upx;
  800. padding: 20upx 24upx;
  801. }
  802. .bd-back {
  803. width: 66upx;
  804. height: 100%;
  805. margin-right: 20upx;
  806. }
  807. .bd-icon {
  808. width: 30upx;
  809. height: 30upx;
  810. margin-bottom: 8upx;
  811. }
  812. .bd-text {
  813. font-size: 20upx;
  814. color: #888888;
  815. line-height: 1;
  816. }
  817. .bd-btn {
  818. text-align: center;
  819. line-height: 70upx;
  820. font-size: 28upx;
  821. // border-radius: 35upx;
  822. }
  823. .bd-btn-left {
  824. border-top-right-radius: 0;
  825. border-bottom-right-radius: 0;
  826. }
  827. .bd-btn-right {
  828. border-top-left-radius: 0;
  829. border-bottom-left-radius: 0;
  830. }
  831. .bd-btn-half {
  832. width: 50%;
  833. }
  834. .bd-btn-color {
  835. color: #ffffff;
  836. }
  837. .bd-oversell-btn {
  838. background-color: #CDCDCD;
  839. }
  840. .bd-content-radius-0 {
  841. border-radius: 35upx 0 0 35upx;
  842. }
  843. .bd-content-radius-1 {
  844. border-radius:0 35upx 35upx 0;
  845. }
  846. .bd-btn-tel {
  847. font-size: 26upx;
  848. >view {
  849. line-height: 70upx;
  850. text-align: center;
  851. }
  852. .tel {
  853. border-top-left-radius: 35upx;
  854. border-bottom-left-radius: 35upx;
  855. }
  856. .contact {
  857. padding: 0;
  858. font-size: 26upx;
  859. height: 70upx;
  860. line-height: 70upx;
  861. margin: 0;
  862. border: none;
  863. }
  864. .service {
  865. border-top-right-radius: 35upx;
  866. border-bottom-right-radius: 35upx;
  867. }
  868. .all-radius {
  869. border-radius: 35upx;
  870. }
  871. .all-width {
  872. width: 100%;
  873. }
  874. .bd-three-one {
  875. width: calc(100%/3);
  876. }
  877. .bd-no-radius {
  878. border-radius: 0;
  879. }
  880. }
  881. .bd-exchange {
  882. line-height: 70upx;
  883. font-size: #{28rpx};
  884. text-align: center;
  885. color: #fff;
  886. border-radius: 35upx;
  887. &.bd-over {
  888. background: #e9e9e9;
  889. color: #999999;
  890. }
  891. }
  892. .text {
  893. color: #ffffff;
  894. }
  895. .default-bakground {
  896. background-color: #446dfd;
  897. color: #ffffff;
  898. }
  899. .u-bottom-fixed {
  900. position: fixed;
  901. bottom: 0;
  902. left: 0;
  903. width: 100%;
  904. z-index: 1500;
  905. background-color: #ffffff;
  906. box-shadow: 0 -1rpx 20rpx -15rpx #353535;
  907. }
  908. .u-bottom-height-0 {
  909. height: 110upx;
  910. }
  911. .u-bottom-height-1 {
  912. height: 190upx;
  913. }
  914. .u-bottom-height-2 {
  915. height: 270upx;
  916. }
  917. .goods-margin {
  918. margin-top: 20upx;
  919. }
  920. .bd-goods {
  921. margin: 24 upx 24 upx 24 upx 24 upx;
  922. }
  923. .ecard-text {
  924. color: #999999;
  925. }
  926. .bd-content {
  927. padding: 0;
  928. display: block;
  929. background-color: #ffffff;
  930. }
  931. .bd-content-view {
  932. width:100%;
  933. height: 100%;
  934. }
  935. .btn-finish-sell {
  936. background: linear-gradient(to right, rgba(153, 153, 153, 1), rgba(153, 153, 153, 0.7)) ;
  937. }
  938. </style>