goods.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791
  1. <template>
  2. <app-layout>
  3. <uni-nav-bar fixed="true" :background-color="titleBg" left-icon="back" @click-left="back"
  4. ></uni-nav-bar>
  5. <view v-if="!goods" class="u-goods-detail"></view>
  6. <template v-if="goods">
  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. <bd-info
  15. :theme="themeObject"
  16. :name="name"
  17. :is-negotiable="is_negotiable"
  18. :subtitle="subtitle"
  19. :flash-sale="flash_sale"
  20. :level-show="level_show"
  21. :price="price"
  22. :original-price="original_price"
  23. :price-max="price_max"
  24. :price-min="price_min"
  25. :price-member-max="price_member_max"
  26. :price-member-min="price_member_min"
  27. :discount='discount'
  28. :is-vip-card-user="is_vip_card_user"
  29. :sales="sales"
  30. :is-vip="is_vip"
  31. :unit="unit"
  32. :is-sales="is_sales"
  33. :goods-id="goodsId"
  34. :extra-quick-share="extra_quick_share"
  35. :app-share-pic="app_share_pic"
  36. :app-share-title="app_share_title"
  37. :poster-config="poster_config + `&goods_id=` + goodsId"
  38. :poster-generate="poster_generate + `&goods_id=` + goodsId"
  39. :has-poster-nav="true"
  40. v-bind:goods="goods"
  41. ></bd-info>
  42. <!--商品优惠券-->
  43. <bd-coupon @change="setCoupon" :theme="themeObject" :coupons="goods_coupon_center"></bd-coupon>
  44. <!--商品规格-->
  45. <bd-xbc
  46. :coAttr="is_open && exchangeStatus ==null"
  47. :attr-list="checked.attr_list"
  48. :type="goodsType"
  49. :guarantee-title="guarantee_title"
  50. :guarantee-pic="guarantee_pic"
  51. :param_content="param_content"
  52. :param_name="param_name"
  53. :services="services"
  54. :attr-groups="attr_groups"
  55. :goods-stock="goods_num"
  56. @openAttr="clickAttr"
  57. ></bd-xbc>
  58. <!--商品信息-->
  59. <bd-hc
  60. :integral="goods_marketing_award.integral"
  61. :coupon="goods_marketing_award.coupon"
  62. :card="goods_marketing_award.card"
  63. :balance="goods_marketing_award.balance"
  64. :theme="themeObject"
  65. ></bd-hc>
  66. <bd-kb
  67. :limit="goods_marketing.limit"
  68. :express="express"
  69. :shipping="goods_marketing.shipping"
  70. :pickup="goods_marketing.pickup"
  71. ></bd-kb>
  72. <!--套餐组合-->
  73. <view @click="toComposition" class="goods-composition" v-if="composition && composition.list.length > 0">
  74. <view class="goods-composition-title">套餐组合</view>
  75. <uni-swiper-dot :current="current" :theme="getTheme" :info="composition.list" mode="customize">
  76. <swiper @change="change" class="goods-composition-swiper" :current="current" :autoplay="true">
  77. <swiper-item v-for="item in composition.list" :key="item.id">
  78. <app-composition :theme="getTheme" @click="toComposition(item)" @look="toComposition(item)" :item="item"></app-composition>
  79. </swiper-item>
  80. </swiper>
  81. </uni-swiper-dot>
  82. <view class="goods-composition-more main-between cross-center">
  83. <view>更多套餐组合</view>
  84. <image src="/static/image/icon/arrow-right.png"></image>
  85. </view>
  86. </view>
  87. <bd-comments :goods-id="goodsId"></bd-comments>
  88. <!--商品详情-->
  89. <bd-detail :detail="detail"></bd-detail>
  90. <!--相关推荐-->
  91. <app-goods-recommend :sureCart="true" :theme="getTheme" :goods-list="recommend_list"></app-goods-recommend>
  92. <!--空格区域-->
  93. <view class="safe-area-inset-bottom u-bottom">
  94. <view class="u-bottom-height" :class="full_reduce ? 'u-bottom-height-1' : 'u-bottom-height-0'"></view>
  95. </view>
  96. <!--底部按钮-->
  97. <view v-if="is_open == 1" class="safe-area-inset-bottom u-bottom-fixed">
  98. <view v-if="full_reduce && exchangeStatus == null">
  99. <app-goods-full-reduce
  100. :theme="getTheme"
  101. :full_reduce="full_reduce"
  102. :sign="goodsType === 'goods' ? '' : 1"
  103. >
  104. </app-goods-full-reduce>
  105. </view>
  106. <view v-if="exchangeStatus == null" class="app-bottom u-bottom-height-0 dir-left-nowrap" >
  107. <view class="dir-top-nowrap main-center cross-center little box-grow-0" @click="back">
  108. <image src="../../static/image/icon/index.png"></image>
  109. <view>首页</view>
  110. </view>
  111. <view class="dir-top-nowrap main-center cross-center little box-grow-0" @click="setFavorite">
  112. <image :src="favorite ? '../../static/image/icon/icon-favorite-active.png' : '../../static/image/icon/icon-favorite.png'"></image>
  113. <view>收藏</view>
  114. </view>
  115. <view class="dir-top-nowrap main-center cross-center little box-grow-0" @click="kefu">
  116. <image :src="root+'/web/statics/img/app/common/icon-kefu.png'"></image>
  117. <view>客服</view>
  118. </view>
  119. <template v-if="is_negotiable !== 1">
  120. <view class="box-grow-1 dir-left-nowrap" style="height: 100%;" v-if="goods_num == 0">
  121. <view style="width: 100%;background-color: #CDCDCD;color: #fff;" class="main-center cross-center button">已售罄</view>
  122. </view>
  123. <view class="box-grow-1 dir-left-nowrap" style="height: 100%;margin-left:20rpx" v-else >
  124. <view v-if="goods.type === 'goods'" style="height: 80%;color: #ffffff;" class="main-center cross-center button cart-btn"
  125. @click="clickAttr(0)"
  126. :class="getTheme === 'b' || getTheme === 'a' || getTheme === 'f' ? getTheme + '-s-back ' + 'text ' + getTheme : getTheme + '-s-back ' + getTheme + '-m-text ' + getTheme"
  127. >
  128. 加入购物车
  129. </view>
  130. <view v-else style="height: 80%;color: #ffffff;" class="main-center cross-center button cart-btn"
  131. @click="clickAttr(0)"
  132. :class="getTheme === 'b' || getTheme === 'a' || getTheme === 'f' ? getTheme + '-s-back ' + 'ecard-text ' + getTheme : getTheme + '-s-back ecard-text ' + getTheme"
  133. >
  134. 加入购物车
  135. </view>
  136. <view class="main-center cross-center button buy-btn"
  137. style="height: 80%;color: #ffffff;"
  138. @click="clickAttr(1)"
  139. :class="getTheme + '-m-back ' + getTheme"
  140. >立即购买
  141. </view>
  142. </view>
  143. </template>
  144. <view class="box-grow-1 dir-left-nowrap btn" v-else>
  145. <block v-for="(item, index) in good_negotiable" :key="index">
  146. <template v-if="item === 'contact_tel'">
  147. <view class="box-grow-1 "id=82643
  148. :class="good_negotiable.length === 1 ? getTheme + '-m-back ' + getTheme + '-s-text ' + getTheme : getTheme + '-s-back ' + 'text ' + getTheme"
  149. >
  150. <app-jump-button
  151. :number="mall.setting.contact_tel"
  152. open_type="tel"
  153. >
  154. <view>联系电话</view>
  155. </app-jump-button>
  156. </view>
  157. </template>
  158. <!-- #ifndef MP-TOUTIAO -->
  159. <template v-else-if="item === 'contact'">
  160. <view class="box-grow-1 contact" :class="contactBtn">
  161. <app-jump-button open_type="contact">
  162. <view>客服</view>
  163. </app-jump-button>
  164. </view>
  165. </template>
  166. <!-- #endif -->
  167. <template v-else-if="item === 'contact_web'">
  168. <view class="box-grow-1 service" :class="good_negotiable.length === 3 ? 'default-bakground' : good_negotiable.length === 2 ? getTheme + '-m-back ' + getTheme + '-s-text ' + getTheme : getTheme + '-m-back ' + getTheme + '-s-text ' + getTheme" >
  169. <app-jump-button
  170. :url="'/pages/web/web?url=' + mall.setting.web_service_url"
  171. open_type="web"
  172. >
  173. <view>客服</view>
  174. </app-jump-button>
  175. </view>
  176. </template>
  177. </block>
  178. </view>
  179. </view>
  180. <view v-else class="app-bottom u-bottom-height-0 main-center cross-center">
  181. <view @click="toExchange" class="app-exchange" :class="getTheme + '-m-gradient-o ' + getTheme" v-if="exchangeStatus == 0">
  182. 立即领取
  183. </view>
  184. <view class="app-exchange app-over" v-if="exchangeStatus == 1">
  185. 已领取
  186. </view>
  187. </view>
  188. </view>
  189. <!--快捷导航-->
  190. <app-quick-navigation></app-quick-navigation>
  191. <u-attr
  192. v-if="is_negotiable === 0 && exchangeStatus ==null"
  193. v-model="attrShow"
  194. :goods="goods"
  195. :themeObject="themeObject"
  196. :checked="checked"
  197. @check="check"
  198. >
  199. </u-attr>
  200. </template>
  201. <app-close v-if="showClose" :modal="false" @update="getMall"></app-close>
  202. </app-layout>
  203. </template>
  204. <script>
  205. import {mapGetters, mapState} from "vuex";
  206. import appGoodsBanner from "../../components/page-component/goods/app-goods-banner.vue";
  207. import appGoodsRecommend from "../../components/page-component/app-goods-recommend/app-goods-recommend.vue";
  208. import appQuickNavigation from "../../components/page-component/app-quick-navigation/app-quick-navigation.vue";
  209. import appComposition from'../../components/basic-component/app-composition/app-composition.vue';
  210. import AppVipCard from '../../components/page-component/app-vip-card/app-vip-card';
  211. import uniSwiperDot from '../../components/basic-component/uni-swiper-dot/uni-swiper-dot';
  212. import appGoodsFlashSale from '../../components/page-component/goods/app-goods-flash-sale.vue';
  213. import uAttr from '../../components/page-component/goods/u-attr.vue';
  214. import appGoodsFullReduce from '../../components/page-component/goods/app-goods-full-reduce.vue';
  215. import bdInfo from '@/components/page-component/goods/bd-info';
  216. import bdCoupon from '@/components/page-component/goods/bd-coupon.vue';
  217. import bdXbc from '@/components/page-component/goods/bd-xbc.vue';
  218. import bdKb from '@/components/page-component/goods/bd-kb.vue';
  219. import bdHc from '@/components/page-component/goods/bd-hc.vue';
  220. import bdDetail from '@/components/page-component/goods/bd-detail.vue';
  221. import bdComments from '@/components/page-component/goods/bd-comments.vue';
  222. import appClose from '@/components/basic-component/app-close/app-close.vue';
  223. import uniNavBar from '@/components/page-component/uni-plugins/uni-nav-bar.vue';
  224. import routeJump from "../../core/routeJump";
  225. export default {
  226. name: "goods",
  227. components: {
  228. appGoodsBanner,
  229. 'app-goods-recommend': appGoodsRecommend,
  230. 'app-quick-navigation': appQuickNavigation,
  231. 'app-composition': appComposition,
  232. appClose,
  233. uniSwiperDot,
  234. AppVipCard,
  235. appGoodsFlashSale,
  236. appGoodsFullReduce,
  237. uAttr,
  238. bdInfo,
  239. bdCoupon,
  240. bdXbc,
  241. bdKb,
  242. bdHc,
  243. bdDetail,
  244. bdComments,
  245. uniNavBar
  246. },
  247. data() {
  248. return {
  249. showClose: false,
  250. is_open: 0,
  251. goods: null,
  252. selectAttr: null,
  253. recommend_list: null,
  254. is_vip: false,
  255. is_vip_card_user: 0,
  256. current: 0,
  257. discount: null,
  258. attrShow: false,
  259. shareData: null,
  260. contact_tel:'',
  261. contact: '',
  262. contact_web:'',
  263. poster_config: this.$api.goods.poster,
  264. poster_generate: this.$api.poster.goods_new,
  265. // 限时抢购
  266. flash_sale: null,
  267. checked: null,
  268. // 商品服务
  269. services: null,
  270. // 商品详情
  271. detail: null,
  272. // 商品ID
  273. goodsId: null,
  274. // 套餐组合
  275. composition: null,
  276. autoplay: true,
  277. full_reduce: null,
  278. goods_marketing_award: null,
  279. express: null,
  280. goods_marketing: null,
  281. exchangeStatus: null,
  282. exchange: null,
  283. price: null,
  284. level_show: null,
  285. sales: null,
  286. unit: null,
  287. is_sales: null,
  288. extra_quick_share: null,
  289. price_max: null,
  290. price_min: null,
  291. price_member_max: null,
  292. price_member_min: null,
  293. original_price: null,
  294. subtitle: null,
  295. is_negotiable: null,
  296. name: null,
  297. app_share_pic: null,
  298. app_share_title: null,
  299. goodsType: null,
  300. favorite: null,
  301. goods_coupon_center: null,
  302. guarantee_title: null,
  303. guarantee_pic: null,
  304. param_content: null,
  305. param_name: null,
  306. attr_groups: null,
  307. goods_num: null,
  308. good_stock: null,
  309. titleBg:'rgba(255,255,255,0)',
  310. };
  311. },
  312. computed: {
  313. themeObject:function() {
  314. return {
  315. back: this.getTheme + '-m-back ' + this.getTheme,
  316. backP: this.getTheme + '-m-back-p ' + this.getTheme,
  317. backO: this.getTheme + '-m-back-o ' + this.getTheme,
  318. theme: this.getTheme,
  319. color: this.getTheme + '-m-text ' + this.getTheme,
  320. sBack: this.getTheme + '-s-back ' + this.getTheme,
  321. border: this.getTheme + '-m-border ' + this.getTheme,
  322. }
  323. },
  324. ...mapState({
  325. mall: state => state.mallConfig.mall,
  326. gConfig: state => state.gConfig,
  327. }),
  328. ...mapGetters('mallConfig', {
  329. getTheme: 'getTheme',
  330. }),
  331. good_negotiable: function() {
  332. let good_negotiable = this.mall.setting.good_negotiable;
  333. this.contact_tel = '';
  334. this.contact = '';
  335. this.contact_web = '';
  336. let arr = [];
  337. for (let i = 0; i < good_negotiable.length; i++) {
  338. if (good_negotiable[i] === 'contact_tel') {
  339. this.contact_tel = 'contact_tel';
  340. }
  341. if (good_negotiable[i] === 'contact') {
  342. this.contact = 'contact';
  343. }
  344. if (good_negotiable[i] === 'contact_web') {
  345. this.contact_web = 'contact_web';
  346. }
  347. }
  348. if (this.contact_tel) {
  349. arr.push(this.contact_tel);
  350. }
  351. if (this.contact) {
  352. arr.push(this.contact);
  353. }
  354. if (this.contact_web) {
  355. arr.push(this.contact_web);
  356. }
  357. return arr;
  358. },
  359. contactBtn: function() {
  360. const len = this.good_negotiable.length;
  361. const theme = this.getTheme;
  362. if (len === 3 && (theme === 'a' || theme === 'b' || theme === 'f')) {
  363. return `${theme}-m-back ${theme}-s-text ${theme}`;
  364. } else if (len === 3 && !(theme === 'a' || theme === 'b' || theme === 'f')) {
  365. return `${theme}-m-back ${theme}-s-text ${theme}`;
  366. } if (len === 2 && (theme === 'a' || theme === 'b' || theme === 'f') && !this.contact_tel) {
  367. return `${theme}-s-back text ${theme}`;
  368. } else if (len === 2 && (theme === 'a' || theme === 'b' || theme === 'f') && this.contact_tel) {
  369. return `${theme}-m-back ${theme}-s-text ${theme}`;
  370. } else if (len === 2 && !(theme === 'a' || theme === 'b' || theme === 'f') && !this.contact_tel) {
  371. return `${theme}-s-back text ${theme}`;
  372. } else if (len === 2 && !(theme === 'a' || theme === 'b' || theme === 'f') && this.contact_tel) {
  373. return `${theme}-m-back ${theme}-s-text ${theme}`;
  374. } else {
  375. return `${theme}-m-back ${theme}-s-text ${theme}`;
  376. }
  377. },
  378. root(){
  379. return this.$siteInfo.root
  380. }
  381. },
  382. onLoad(options) {
  383. // #ifdef MP-WEIXIN
  384. wx.showShareMenu({
  385. menus: ['shareAppMessage', 'shareTimeline']
  386. })
  387. // #endif
  388. if (this.isLogin) {
  389. this.$store.dispatch('user/info');
  390. } else {
  391. }
  392. if(options.exchange) {
  393. this.exchangeStatus = options.exchange;
  394. this.exchange = options;
  395. }
  396. this.loadData(options.id);
  397. },
  398. onPageScroll:function(e){
  399. this.titleBg = 'rgba(255,255,255,'+e.scrollTop / 300+')';
  400. },
  401. onShareAppMessage(object) {
  402. if (object.from === 'button' && this.shareData) {
  403. return this.$shareAppMessage(this.shareData);
  404. }
  405. return this.$shareAppMessage({
  406. title: this.app_share_title ? this.app_share_title : this.name,
  407. imageUrl: this.app_share_pic ? this.app_share_pic : '',
  408. path: '/pages/goods/goods',
  409. params: {
  410. id: this.goodsId
  411. }
  412. });
  413. },
  414. // #ifdef MP-WEIXIN
  415. onShareTimeline() {
  416. // 分享朋友圈beta
  417. return this.$shareTimeline({
  418. title: this.app_share_title ? this.app_share_title : this.name,
  419. query: {
  420. id: this.goodsId
  421. }
  422. });
  423. },
  424. // #endif
  425. methods: {
  426. getMall(e) {
  427. this.is_open = e.is_open;
  428. },
  429. toExchange() {
  430. let mch_list = [{
  431. mch_id: 0,
  432. goods_list: [{
  433. id: this.exchange.id,
  434. attr: this.exchange.attr,
  435. num: this.exchange.goods_num,
  436. cat_id: 0,
  437. goods_attr_id: this.exchange.attr_id
  438. }],
  439. code: this.exchange.code,
  440. token: this.exchange.token,
  441. }];
  442. let url = `/pages/order-submit/order-submit?mch_list=${JSON.stringify(mch_list)}`;
  443. url += `&preview_url=${encodeURIComponent(this.$api.exchange.exchange_preview)}&submit_url=${encodeURIComponent(this.$api.exchange.exchange_submit)}&plugin=exchange`;
  444. uni.navigateTo({
  445. url: url
  446. })
  447. },
  448. // 规格选择
  449. check(obj) {
  450. this.checked = obj;
  451. },
  452. change(e) {
  453. if(e.detail.source === 'touch') {
  454. this.current = e.detail.current;
  455. }
  456. if(e.detail.source === 'autoplay') {
  457. this.current = e.detail.current;
  458. }
  459. },
  460. quickShare(info) {
  461. this.shareData = info;
  462. },
  463. toComposition(item) {
  464. let id = item.id > 0 ? item.id : this.composition.list[0].id
  465. uni.navigateTo({
  466. url: this.composition.url + '?goods_id=' + this.goodsId + '&composition_id=' + id
  467. })
  468. },
  469. loadData(id) {
  470. this.$showLoading();
  471. this.$request({
  472. url: this.$api.goods.detail,
  473. data: {
  474. id: id
  475. }
  476. }).then(response => {
  477. this.$hideLoading();
  478. if (response.code === 0) {
  479. let { services,
  480. detail, name,
  481. vip_card_appoint, plugin_extra, id,
  482. goods_activity, goods_marketing_award,
  483. goods_marketing, express,
  484. price, sales,
  485. level_show, is_sales, unit, extra_quick_share,
  486. price_max, price_min, price_member_max,
  487. price_member_min, original_price, subtitle,
  488. is_negotiable, app_share_title,
  489. app_share_pic, type, favorite, goods_coupon_center,
  490. guarantee_title, guarantee_pic, param_content,
  491. param_name, attr_groups, goods_num, good_stock
  492. } = response.data.goods;
  493. /*uni.setNavigationBarTitle({
  494. title: name
  495. });*/
  496. this.name = name;
  497. this.app_share_pic = app_share_pic;
  498. this.app_share_title = app_share_title;
  499. this.goods = response.data.goods;
  500. this.services = services;
  501. this.detail = detail;
  502. this.goodsId = id;
  503. this.flash_sale = plugin_extra.flash_sale;
  504. this.composition = plugin_extra.composition;
  505. this.goods_marketing_award = goods_marketing_award;
  506. this.goods_marketing = goods_marketing;
  507. this.express = express;
  508. this.price = price;
  509. this.level_show = level_show;
  510. this.sales = sales;
  511. this.unit = unit;
  512. this.is_sales = is_sales;
  513. this.price_max = price_max;
  514. this.price_min = price_min;
  515. this.price_member_max = price_member_max;
  516. this.price_member_min = price_member_min;
  517. this.original_price = original_price;
  518. this.subtitle = subtitle;
  519. this.is_negotiable = is_negotiable;
  520. this.extra_quick_share = extra_quick_share;
  521. this.goodsType = type;
  522. this.favorite = favorite;
  523. this.goods_coupon_center = goods_coupon_center;
  524. this.guarantee_title = guarantee_title;
  525. this.param_content = param_content;
  526. this.guarantee_pic = guarantee_pic;
  527. this.attr_groups = attr_groups;
  528. this.param_name = param_name;
  529. this.goods_num = goods_num;
  530. this.good_stock = good_stock;
  531. if (goods_activity) {
  532. this.full_reduce = goods_activity.full_reduce;
  533. }
  534. if(vip_card_appoint.discount || vip_card_appoint.discount === '0.00') {
  535. this.is_vip = true;
  536. this.discount = vip_card_appoint.discount
  537. }
  538. this.is_vip_card_user = vip_card_appoint.is_vip_card_user;
  539. this.loadRecommend();
  540. } else {
  541. uni.showToast({
  542. title: response.msg,
  543. icon: 'none'
  544. });
  545. }
  546. }).catch(() => {
  547. this.$hideLoading();
  548. });
  549. },
  550. onAttr(data) {
  551. this.selectAttr = data;
  552. },
  553. loadRecommend() {
  554. this.$request({
  555. url: this.$api.goods.new_recommend,
  556. data: {
  557. goods_id: this.goodsId,
  558. type: 'goods'
  559. }
  560. }).then(response => {
  561. if (response.code === 0) {
  562. this.recommend_list = response.data.list;
  563. }
  564. });
  565. },
  566. back() {
  567. uni.navigateBack({});
  568. },
  569. setFavorite() {
  570. let url = this.$api.user.favorite_add;
  571. let favorite = true;
  572. if (this.favorite) {
  573. url = this.$api.user.favorite_remove;
  574. favorite = false;
  575. }
  576. this.favorite = favorite;
  577. this.$request({
  578. url: url,
  579. data: {
  580. goods_id: this.goodsId
  581. }
  582. }).then(response => {
  583. if (response.code === 0) {
  584. } else {
  585. uni.showModal({
  586. title: '提示',
  587. content: response.msg,
  588. showCancel: false
  589. });
  590. }
  591. });
  592. },
  593. clickAttr(data) {
  594. if (this.goods.type === 'ecard' && data === 0) {
  595. uni.showToast({
  596. title: '虚拟商品不允许加入购物车',
  597. icon: 'none'
  598. });
  599. return;
  600. }
  601. this.attrShow = true;
  602. },
  603. setCoupon(index) {
  604. this.$set(this.goods_coupon_center[index], 'is_receive', 1);
  605. },
  606. kefu(){
  607. uni.navigateTo({
  608. url: "/pages/web/web?url="+this.mall.setting.web_service_url
  609. })
  610. }
  611. },
  612. onShow() {
  613. this.autoplay = true;
  614. this.showClose = false;
  615. setTimeout(()=>{
  616. this.showClose = true;
  617. })
  618. },
  619. onHidden() {
  620. this.autoplay = false;
  621. }
  622. }
  623. </script>
  624. <style scoped lang="scss">
  625. .goods-composition {
  626. width: 702upx;
  627. margin: 20upx 20upx 0 20upx;
  628. padding: 20rpx;
  629. background-color: #fff;
  630. border-radius: 15upx;
  631. .goods-composition-title {
  632. font-size: 28rpx;
  633. color: #353535;
  634. margin-bottom: 20rpx;
  635. }
  636. .goods-composition-swiper {
  637. height: 194rpx;
  638. }
  639. .goods-composition-more {
  640. margin: 20rpx auto 4rpx auto;
  641. width: 226rpx;
  642. padding: 0 24rpx;
  643. height: 56rpx;
  644. line-height: 54rpx;
  645. border-radius: 28rpx;
  646. border: 2rpx solid #bbbbbb;
  647. font-size: 24rpx;
  648. color: #999999;
  649. image {
  650. width: #{12rpx};
  651. height: #{22rpx};
  652. }
  653. }
  654. }
  655. .goods-name {
  656. padding: 24upx 24upx 0 24upx;
  657. background-color: #ffffff;
  658. color: #353535;
  659. font-size: 32upx;
  660. line-height: 42upx;
  661. }
  662. .goods-subtitle {
  663. padding: #{24rpx 24rpx 0 24rpx};
  664. font-size: 24rpx;
  665. background-color: #ffffff;
  666. color: #999999;
  667. }
  668. .price {
  669. padding-top: #{24rpx};
  670. background-color: #ffffff;
  671. }
  672. .vip-card {
  673. padding-bottom: #{20rpx};
  674. background-color: #fff;
  675. }
  676. .attr {
  677. background-color: #f7f7f7;
  678. }
  679. .bottom {
  680. width: 100%;
  681. height: #{110rpx};
  682. }
  683. .app-bottom {
  684. width: 100%;
  685. font-size: $uni-font-size-general-one;
  686. background-color: #ffffff;
  687. padding: 0 #{24rpx};
  688. .little {
  689. width: #{90rpx};
  690. height: 100%;
  691. background-color: #ffffff;
  692. font-size: #{20rpx};
  693. color: $uni-general-color-two;
  694. image {
  695. width: #{40rpx};
  696. height: #{40rpx};
  697. display: block;
  698. margin-bottom: #{10rpx};
  699. }
  700. }
  701. .btn {
  702. height: 100%;
  703. }
  704. .button {
  705. width: 50%;
  706. height: 100%;
  707. }
  708. .service {
  709. color: #ffffff;
  710. }
  711. .app-exchange {
  712. width: #{702rpx};
  713. border-radius: #{41rpx};
  714. height: #{82rpx};
  715. line-height: #{82rpx};
  716. font-size: #{28rpx};
  717. text-align: center;
  718. color: #fff;
  719. &.app-over {
  720. background: #e9e9e9;
  721. color: #999999;
  722. }
  723. }
  724. }
  725. .text {
  726. color: #ffffff;
  727. }
  728. .default-bakground {
  729. background-color: #446dfd;
  730. }
  731. .u-bottom-fixed {
  732. position: fixed;
  733. bottom: 0;
  734. left: 0;
  735. width: 100%;
  736. z-index: 1500;
  737. background-color: #ffffff;
  738. }
  739. .u-bottom-height-0 {
  740. height: 110upx;
  741. }
  742. .u-bottom-height-1 {
  743. height: 190upx;
  744. }
  745. .goods-margin {
  746. margin-top: 20upx;
  747. }
  748. .bd-goods {
  749. margin: 24 upx 24 upx 24 upx 24 upx;
  750. }
  751. .ecard-text {
  752. color: #999999;
  753. }
  754. .cart-btn{
  755. height: 90%;
  756. border-top-left-radius: #{30rpx};
  757. border-bottom-left-radius: #{30rpx};
  758. position: relative;
  759. transform: translateY(-50%);
  760. top: 50%;
  761. background: linear-gradient(to right, #A494F6,#BC8AE7,#E674B2);
  762. }
  763. .cart-btn:after{
  764. content: "";
  765. position: absolute;
  766. right: 0;
  767. height: 60%;
  768. background: #ffffff;
  769. width: 1px;
  770. top: 50%;
  771. transform: translateY(-50%);
  772. }
  773. .buy-btn{
  774. height: 90%;
  775. border-top-right-radius: #{30rpx};
  776. border-bottom-right-radius: #{30rpx};
  777. position: relative;
  778. transform: translateY(-50%);
  779. top: 50%;
  780. background: linear-gradient(to right, #E674B2,#FE3666);
  781. }
  782. </style>