product.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326
  1. <template>
  2. <view class="container">
  3. <view class="carousel">
  4. <swiper indicator-dots :circular="true" duration="400">
  5. <swiper-item class="swiper-item" v-for="(item, index) in imgList" :key="index">
  6. <view class="image-wrapper">
  7. <image :src="item" class="loaded" mode="scaleToFill"></image>
  8. </view>
  9. </swiper-item>
  10. </swiper>
  11. </view>
  12. <view class="introduce-section seckill-box-title" v-if="goodsType == 1">
  13. <view class="title flex">
  14. <view class="title-box">
  15. <text class="price-tip">¥</text>
  16. <text class="price">{{ goodsObjact.price }}</text>
  17. <!-- <text class="m-price" v-if="goodsObjact.ot_price > goodsObjact.price">¥{{ goodsObjact.ot_price }}</text> -->
  18. <!-- <text class="coupon-tip">7折</text> -->
  19. </view>
  20. <view class="flex timeStop">
  21. <view>距离结束</view>
  22. <uni-countdown color="#ffffff" background-color="#D65B3F" splitor-color="#FFFFFF" :show-day="false"
  23. :hour="seckillObj.stopTimeH" :minute="seckillObj.stopTimeM" :second="seckillObj.stopTimeS">
  24. </uni-countdown>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="introduce-section">
  29. <text class="title" v-if="goodsType == 1">{{ goodsObjact.title }}</text>
  30. <view class="price-box" v-if="goodsType == 0">
  31. <text class="price-tip">¥</text>
  32. <text class="price">{{ goodsObjact.price }}</text>
  33. <text class="m-price" v-if="goodsObjact.ot_price > goodsObjact.price">¥{{ goodsObjact.ot_price }}</text>
  34. <!-- <text class="coupon-tip">7折</text> -->
  35. </view>
  36. <text class="title" v-if="goodsType == 0">{{ goodsObjact.store_name }}</text>
  37. <view class="bot-row">
  38. <text>快递: {{ goodsObjact.postage }}</text>
  39. <text style="text-align: center;">销量: {{ goodsObjact.sales }}</text>
  40. <text style="text-align: right;">{{ storeObjact.address | address }}</text>
  41. </view>
  42. </view>
  43. <!-- 评价 -->
  44. <view class="eva-section" v-if="reply" @click="navTo('/pages/product/reply?id=' + goodsid)">
  45. <view class="e-header">
  46. <text class="tit">评价</text>
  47. <text>({{ details.replyCount }})</text>
  48. <text class="tip">好评率 {{ details.replyChance }}%</text>
  49. <text class="iconfont iconenter"></text>
  50. </view>
  51. <view class="eva-box">
  52. <image class="portrait" :src="reply.avatar" mode="aspectFill"></image>
  53. <view class="right">
  54. <text class="name">{{ reply.nickname }}</text>
  55. <text class="con">{{ reply.comment }}</text>
  56. <view class="con_box">
  57. <view class="con_image" v-for="item in reply.pics">
  58. <image :src="item"></image>
  59. </view>
  60. </view>
  61. <view class="bot">
  62. <text class="attr"></text>
  63. <text class="time">{{ reply.add_time }}</text>
  64. </view>
  65. </view>
  66. </view>
  67. <view class="eva-boxs" v-if="reply.merchant_reply_content">
  68. <view class="right">
  69. <text class="con">
  70. <text style="color: #FD5B23;margin-right: 8rpx;">商家回复 :</text>
  71. {{ reply.merchant_reply_content }}
  72. </text>
  73. <view class="bot">
  74. <text class="attr"></text>
  75. <text class="time">{{ reply.merchant_reply_time }}</text>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="c-list">
  81. <view class="c-row b-b" @click="toggleSpec">
  82. <text class="tit">购买数量</text>
  83. <view class="con">
  84. <text class="selected-text">{{ goodsNumber }}</text>
  85. </view>
  86. <text class="iconfont iconenter"></text>
  87. </view>
  88. <view class="c-row b-b" v-if="goodsType == 1">
  89. <text class="tit">限购数量</text>
  90. <view class="con">
  91. <text class="selected-text">{{ goodsObjact.num + goodsObjact.unit_name }}</text>
  92. </view>
  93. </view>
  94. <!-- <view class="c-row b-b">
  95. <text class="tit">优惠券</text>
  96. <text class="con t-r red">领取优惠券</text>
  97. <text class="iconfont iconenter"></text>
  98. </view> -->
  99. <view class="c-row b-b" v-if="goodsObjact.is_integral == 1 && goodsType == 0">
  100. <text class="tit">积分</text>
  101. <view class="bz-list con">
  102. <text>最高抵扣¥{{ moneyNum(goodsObjact.use_max_integral) == 0 ? moneyNum(goodsObjact.price) : moneyNum(goodsObjact.use_max_integral) }}</text>
  103. </view>
  104. </view>
  105. </view>
  106. <view class="shop-box flex" v-if="goodsType == 0 && shopId > 0">
  107. <view class="flex">
  108. <image :src="shopInfo.logo" mode=" aspectFit" class="shop-img"></image>
  109. <text class="font-size-lg">{{ shopInfo.title }}</text>
  110. </view>
  111. <navigator :url="'/pages/shoping/index?merid=' + shopId">
  112. <view class="shop-button">进店逛逛</view>
  113. </navigator>
  114. </view>
  115. <view class="detail-desc">
  116. <view class="d-header"><text>图文详情</text></view>
  117. <rich-text class="detail-centent" :nodes="goodsObjact.description"></rich-text>
  118. <view :class="{ contentBottomHeight: goodsType == 1 || goodsType == 2, goodsBottom: goodsType == 0 }">
  119. </view>
  120. </view>
  121. <!-- 底部操作菜单 -->
  122. <view class="page-bottom" v-if="goodsType == 0&&goodsObjact.id">
  123. <!-- <navigator url="/pages/index/index" open-type="switchTab" class="p-b-btn">
  124. <text class="iconfont iconhome"></text>
  125. <text>首页</text>
  126. </navigator>
  127. <navigator url="/pages/cart/cart" open-type="switchTab" class="p-b-btn">
  128. <text class="iconfont iconcart"></text>
  129. <text>购物车</text>
  130. </navigator> -->
  131. <view class="p-b-btn" :class="{ active: goodsObjact.userCollect }" v-if="goodsObjact.can_up_level!=1" @click="toFavorite(goodsObjact)">
  132. <text class="iconfont "
  133. :class="{ iconlike: !goodsObjact.userCollect, iconlikefill: goodsObjact.userCollect }"></text>
  134. <text>收藏</text>
  135. </view>
  136. <view class="action-btn-group">
  137. <button type="primary" class=" action-btn no-border buy-now-btn" v-if="goodsObjact.can_up_level!=1" @click="toggleSpec(2)">加入购物车</button>
  138. <button type="primary" class=" action-btn no-border add-cart-btn" @click="toggleSpec(1)">立即购买</button>
  139. </view>
  140. </view>
  141. <!-- 秒杀商品购买 -->
  142. <view class="goods-pay-box flex" :class="{ stop: seckillObj.stop }" v-if="goodsType == 1">
  143. <view class="goods-pay bgLine" v-if="!seckillObj.stop" @click="toggleSpec(1)"><text>立即购买</text></view>
  144. <view class="goods-pay-stop" v-else>活动已结束</view>
  145. </view>
  146. <!-- 拼团商品购买 -->
  147. <view class="goods-pay-box flex" v-if="goodsType == 2">
  148. <view class="goods-pay bg-warning" @click="navToProductGoods">
  149. <view class="goods-buttom-money">¥{{ goodsObjact.product_price }}</view>
  150. <view class="goods-buttom">单独购买</view>
  151. </view>
  152. <view class="goods-pay bg-danger" @click="toggleSpec(1)">
  153. <view class="goods-buttom-money">¥{{ goodsObjact.price }}</view>
  154. <view class="goods-buttom">我要拼团</view>
  155. </view>
  156. </view>
  157. <!-- 规格-模态层弹窗 -->
  158. <view class="popup spec" :class="specClass" @touchmove.stop.prevent="stopPrevent" @click="toggleSpec">
  159. <!-- 遮罩层 -->
  160. <view class="mask"></view>
  161. <view class="layer attr-content" @click.stop="stopPrevent">
  162. <view class="a-t">
  163. <image :src="actionImage"></image>
  164. <view class="right">
  165. <view class="good-name clamp">{{ goodsObjact.store_name }}</view>
  166. <text class="price">¥{{ actionPrice }}</text>
  167. <br />
  168. <text class="stock" v-if="goodsObjact.can_up_level==1">等级:{{levelName}}</text>
  169. <!-- <text class="stock">库存:{{ goodsObjact.stock }}件</text> -->
  170. <!-- <view class="selected" v-if="goodsType == 0">
  171. 已选:
  172. <text class="selected-text" v-for="(sItem, sIndex) in specSelected" :key="sIndex">{{ sItem }}</text>
  173. </view> -->
  174. </view>
  175. </view>
  176. <view v-for="(item, index) in specList" :key="index" class="attr-list">
  177. <text>{{ item.attr_name }}</text>
  178. <view class="item-list">
  179. <text v-for="(childItem, childIndex) in item.attr_value" :key="childIndex" class="tit"
  180. :class="{ selected: childItem.check }" @click="selectSpec(childItem, item, index)">
  181. {{ childItem.attr }}
  182. </text>
  183. </view>
  184. </view>
  185. <view class="attr-list" v-if="goodsObjact.can_up_level!=1">
  186. <text>购买数量</text>
  187. <view class="item-list">
  188. <uni-number-box class="step" :isMin="true" :value="goodsNumber" :min="1" :max="goodsNumberMax"
  189. @eventChange="numberChange"></uni-number-box>
  190. </view>
  191. </view>
  192. <button class="btn" @click.stop="buy">完成</button>
  193. </view>
  194. </view>
  195. <view :class="{ seckillBottom: goodsType == 1, goodsBottom: goodsType == 0 }"></view>
  196. <!-- 分享 -->
  197. <!-- <share ref="share" :contentHeight="580" :shareList="shareList"></share> -->
  198. </view>
  199. </template>
  200. <script>
  201. // import share from '@/components/share';
  202. import uniNumberBox from '@/components/uni-number-box.vue';
  203. import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
  204. import {
  205. goodsDetail,
  206. cartAdd,
  207. collectAdd,
  208. collectDel,
  209. seckillGoods,
  210. groupGoods
  211. } from '@/api/product.js';
  212. // #ifdef H5
  213. import {
  214. weixindata,
  215. shareLoad
  216. } from '@/utils/wxAuthorized';
  217. import {
  218. mapState
  219. } from 'vuex';
  220. import weixinObj from '@/plugin/jweixin-module/index.js';
  221. // #endif
  222. export default {
  223. components: {
  224. uniNumberBox,
  225. uniCountdown
  226. },
  227. filters: {
  228. address(val) {
  229. let str = '';
  230. if (val) {
  231. str = val[0] + ' ' + val[1];
  232. }
  233. return str;
  234. }
  235. },
  236. data() {
  237. return {
  238. details: '',
  239. reply: '', //评论
  240. type: 1, //默认支付方式add为
  241. goodsNumber: 1, //购买数量
  242. goodsid: '', //商品id
  243. specClass: 'none', //显示隐藏弹窗
  244. shareList: [], //分享列表
  245. goodsObjact: {}, //保存商品数据
  246. storeObjact: {}, //保存店铺数据
  247. //图片循环
  248. imgList: [],
  249. specList: [],
  250. // 对比对象
  251. productValue: [],
  252. actionPrice: 0, //默认选中商品价格
  253. levelName: '', //当前选中的等级
  254. actionImage: '', //默认选中图片
  255. uniqueId: '', //选中的商品分类
  256. specSelected: [], //选中的分类
  257. specSelectedName: '', //选中分类名称
  258. goodsNumberMax: 0, //最大可购买数量
  259. shopId: '', //商店id
  260. //商店信息
  261. shopInfo: {
  262. logo: '',
  263. title: ''
  264. }, //商店信息
  265. goodsType: 0, //商品类型1秒杀商品0为普通商品2为拼团商品
  266. // 秒杀数据保存
  267. seckillObj: {
  268. stopTime: 0, //结束时间
  269. stop: false, //是否结束
  270. stopTimeH: 0, //小时
  271. stopTimeM: 0, //分钟
  272. stopTimeS: 0 //秒钟
  273. },
  274. // 拼团数据保存
  275. pink: {
  276. id: '', //拼团编号
  277. uid: '', //用户编号
  278. people: '', //拼团人数
  279. price: '', //拼团价格
  280. stop_time: '', //拼团结束时间
  281. nickname: '', //团长昵称
  282. avatar: '', //团长头像
  283. count: '', //拼团剩余人数
  284. h: '', //时
  285. i: '', //分
  286. s: '' //秒
  287. }
  288. };
  289. },
  290. async onLoad(options) {
  291. let obj = this;
  292. //保存商品id
  293. this.goodsid = options.id;
  294. // 判断有无人邀请
  295. if (options.spread) {
  296. // 存储邀请人
  297. uni.setStorageSync('spread', options.spread);
  298. }
  299. // 判断是否为秒杀商品
  300. if (options.type == 1) {
  301. // 保存商品类型
  302. this.goodsType = 1;
  303. // 保存结束时间
  304. this.seckillObj.stopTime = options.stoptime;
  305. // 获取当前时间毫秒数
  306. let stoptime = options.stoptime * 1000;
  307. // 获取当前时间
  308. let acitonTime = new Date();
  309. // 判断当前时间是否大于结束时间
  310. if (acitonTime.getTime() > stoptime) {
  311. // 当前秒杀时间已经结束
  312. this.seckillObj.stop = true;
  313. } else {
  314. // 计算倒计时
  315. this.timeComputed(stoptime, this.seckillObj);
  316. }
  317. this.seckillGoods();
  318. return;
  319. }
  320. if (options.type == 2) {
  321. // 保存当前拼团商品类型
  322. this.goodsType = 2;
  323. // 家在数据
  324. this.groupGoods();
  325. return;
  326. }
  327. if (this.goodsType == 0) {
  328. // 加载普通商品详情
  329. this.goodsDetail();
  330. }
  331. },
  332. computed: {
  333. // #ifdef H5
  334. ...mapState(['weichatObj', 'baseURL', 'urlFile']),
  335. ...mapState('user', ['userInfo'])
  336. // #endif
  337. },
  338. methods: {
  339. navTo(url) {
  340. uni.navigateTo({
  341. url
  342. });
  343. },
  344. // 转换字符串为数字
  345. moneyNum: function(value) {
  346. return +value;
  347. },
  348. navToProductGoods() {
  349. uni.redirectTo({
  350. url: '/pages/product/product?id=' + this.goodsObjact.product_id
  351. });
  352. },
  353. // 获取商品信息
  354. goodsDetail() {
  355. let obj = this;
  356. goodsDetail({}, this.goodsid).then(function({
  357. data
  358. }) {
  359. obj.details = data;
  360. let goods = data.storeInfo;
  361. let store_info = data.system_store; // 保存店铺信息
  362. console.log(store_info);
  363. obj.storeObjact = store_info;
  364. obj.goodsObjact = goods;
  365. //商品详情图超出屏幕问题
  366. if (obj.goodsObjact.description != null) {
  367. obj.goodsObjact.description = obj.goodsObjact.description.replace(/<img/g,
  368. '<img class="rich-img"').replace(/<p>\s*<img/g, '<p class="pHeight"><img');
  369. }
  370. if (obj.goodsObjact.rule != null) {
  371. obj.goodsObjact.rule = '<p>' + obj.goodsObjact.rule.replace(/\n/g, '</p><p>').trim() +
  372. '</p>'
  373. }
  374. obj.reply = data.reply; //保存评论列表
  375. obj.imgList = goods.slider_image; //保存轮播图
  376. obj.specList = data.productAttr; //保存分类列表
  377. console.log(data.productAttr);
  378. obj.productValue = data.productValue; //保存分类查询数据
  379. obj.actionPrice = goods.price; //保存默认选中商品价格
  380. obj.actionImage = goods.image_base; //保存默认选中商品价格
  381. obj.goodsNumberMax = goods.stock; //保存默认选中最大可购买商品数量
  382. obj.shopId = data.mer_id; //保存商店id
  383. // 保存默认选中的对象
  384. obj.specSelected = []; //初始化默认选择对象
  385. for (let i = 0; i < obj.specList.length; i++) {
  386. // 设置默认数据
  387. let attrValue = obj.specList[i].attr_value[0];
  388. attrValue.check = true;
  389. obj.specSelected.push(attrValue.attr);
  390. }
  391. //保存默认选中的对象字符串名称
  392. let str = obj.specSelected.join(',');
  393. // 设置默认值
  394. obj.actionImage = obj.productValue[str].image;
  395. obj.uniqueId = obj.productValue[str].unique;
  396. obj.levelName = obj.productValue[str].level_name;; //保存默认等级名称
  397. // #ifdef H5
  398. obj.shareDate();
  399. // #endif
  400. });
  401. },
  402. // #ifdef H5
  403. // 加载微信html5页面分享方法
  404. shareDate() {
  405. let obj = this;
  406. // 保存分享人id链接
  407. let url = window.location.href + '&spread=' + this.userInfo.uid;
  408. // 判断是否微信浏览器
  409. let bool = uni.getStorageSync('weichatBrowser') || '';
  410. if (bool) {
  411. // 过滤微信强制添加的链接地址
  412. url = url.replace(/[\?,&]from=singlemessage/g, '');
  413. let data = {
  414. link: url, // 分享链接
  415. imgUrl: obj.goodsObjact.image, // 分享图标
  416. desc: obj.goodsObjact.store_info,
  417. title: obj.goodsObjact.store_name,
  418. success: function(e) {
  419. console.log(e);
  420. }
  421. };
  422. shareLoad(data);
  423. }
  424. },
  425. // #endif
  426. // 购买数量变化
  427. numberChange(e) {
  428. this.goodsNumber = e.number;
  429. },
  430. //规格弹窗开关
  431. toggleSpec(str) {
  432. if (this.specClass === 'show') {
  433. this.specClass = 'hide';
  434. setTimeout(() => {
  435. this.specClass = 'none';
  436. }, 250);
  437. } else if (this.specClass === 'none') {
  438. this.specClass = 'show';
  439. }
  440. // 保存当前购买类型
  441. this.type = str;
  442. },
  443. //选择规格
  444. selectSpec(item, arr, ind) {
  445. arr.attr_value.forEach(function(e) {
  446. e.check = false;
  447. });
  448. item.check = true;
  449. this.specSelected[ind] = item.attr;
  450. let str = this.specSelected.join(',');
  451. this.specSelectedName = this.specSelected.join(' ');
  452. if (this.productValue[str]) {
  453. let data = this.productValue[str];
  454. this.actionPrice = data.price;
  455. this.levelName = data.level_name;
  456. this.goodsNumberMax = data.stock;
  457. this.actionImage = data.image;
  458. this.uniqueId = data.unique;
  459. }
  460. },
  461. //分享
  462. share() {
  463. this.$refs.share.toggleMask();
  464. },
  465. //收藏
  466. toFavorite(item) {
  467. let obj = this;
  468. item.userCollect = !item.userCollect;
  469. if (!item.userCollect) {
  470. collectDel({
  471. id: obj.goodsid,
  472. category: 'product'
  473. }).then(function(e) {
  474. uni.showToast({
  475. title: '成功取消收藏',
  476. type: 'top',
  477. duration: 1500
  478. });
  479. });
  480. } else {
  481. collectAdd({
  482. id: obj.goodsid,
  483. category: 'product'
  484. }).then(function(e) {
  485. uni.showToast({
  486. title: '成功加入收藏',
  487. type: 'top',
  488. duration: 1500
  489. });
  490. });
  491. }
  492. },
  493. // 立即购买
  494. buy() {
  495. let obj = this;
  496. let data = {
  497. cartNum: obj.goodsNumber, //商品数量
  498. uniqueId: obj.uniqueId, //商品标签
  499. new: '1', //商品是否新增加到购物车1为不加入0为加入
  500. mer_id: obj.shopId,
  501. can_up_level:obj.goodsObjact.can_up_level,
  502. // type: 0,//0为余额支付 1为消费券支付 2为积分支付
  503. };
  504. if (obj.type == 2) {
  505. data.new = 0;
  506. }
  507. if (obj.goodsType == 0) {
  508. data.productId = obj.goodsid; //商品编号
  509. }
  510. // 判断是否为秒杀商品
  511. if (obj.goodsType == 1) {
  512. data.secKillId = obj.goodsid; //秒杀商品编号
  513. data.productId = obj.goodsObjact.product_id; //商品编号
  514. // 判断是否秒杀已经结束
  515. if (obj.seckillObj.stop) {
  516. uni.showModal({
  517. title: '提示',
  518. content: '当前活动已经结束',
  519. showCancel: false
  520. });
  521. return;
  522. }
  523. }
  524. // 判断是否为拼团商品
  525. if (obj.goodsType == 2) {
  526. data.combinationId = obj.goodsid; //拼团编号
  527. data.productId = obj.goodsObjact.product_id; //商品编号
  528. }
  529. cartAdd(data)
  530. .then(function({
  531. data
  532. }) {
  533. if (obj.type == 1) {
  534. let url = '/pages/order/createOrder?id=' + data.cartId + '&goodsType=' + obj.goodsType +
  535. '&goodsUpLevel=' + obj.goodsObjact.can_up_level;
  536. // 跳转到支付页
  537. uni.navigateTo({
  538. url
  539. });
  540. }
  541. if (obj.type == 2) {
  542. uni.showToast({
  543. title: '成功加入购物车',
  544. type: 'top',
  545. duration: 2000
  546. });
  547. obj.toggleSpec();
  548. }
  549. })
  550. .catch(e => {
  551. console.log(e);
  552. });
  553. },
  554. stopPrevent() {}
  555. }
  556. };
  557. </script>
  558. <style lang="scss">
  559. page {
  560. background: $page-color-base;
  561. }
  562. //秒杀底部高度
  563. .seckillBottom {
  564. height: 110rpx;
  565. }
  566. // 文章页底部高度撑开
  567. .contentBottomHeight {
  568. height: 110rpx;
  569. }
  570. //默认商品底部高度
  571. .goodsBottom {
  572. height: 160rpx;
  573. }
  574. .iconenter {
  575. font-size: $font-base + 2rpx;
  576. color: #888;
  577. }
  578. .carousel {
  579. /* #ifdef APP-PLUS */
  580. padding-top: var(--status-bar-height);
  581. /* #endif */
  582. height: 722rpx;
  583. position: relative;
  584. swiper {
  585. height: 100%;
  586. }
  587. .image-wrapper {
  588. width: 100%;
  589. height: 100%;
  590. }
  591. .swiper-item {
  592. display: flex;
  593. justify-content: center;
  594. align-content: center;
  595. // height: 750rpx;
  596. height: 710rpx;
  597. overflow: hidden;
  598. image {
  599. width: 100%;
  600. height: 100%;
  601. }
  602. }
  603. }
  604. // 秒杀
  605. .seckill-box-title {
  606. background: linear-gradient(90deg, rgba(239, 78, 81, 1) 0%, rgba(244, 113, 59, 1) 100%) !important;
  607. .price,
  608. .price-tip,
  609. .timeStop,
  610. .m-price {
  611. color: #ffffff !important;
  612. }
  613. .price-tip {
  614. font-size: $font-base;
  615. }
  616. .price {
  617. font-size: 45rpx !important;
  618. font-weight: bold;
  619. }
  620. .timeStop {}
  621. }
  622. // 底部拼团、秒杀支付按钮
  623. .goods-pay-box {
  624. position: fixed;
  625. left: 0;
  626. bottom: 0;
  627. z-index: 95;
  628. width: 750rpx;
  629. height: 100rpx;
  630. line-height: 1;
  631. color: #ffffff;
  632. text-align: center;
  633. font-size: $font-lg;
  634. .bgLine {
  635. background: linear-gradient(90deg, rgba(239, 78, 81, 1) 0%, rgba(244, 113, 59, 1) 100%);
  636. }
  637. // 拼团支付按钮
  638. .goods-pay {
  639. display: flex;
  640. align-content: center;
  641. flex-wrap: wrap;
  642. justify-content: center;
  643. .goods-buttom,
  644. .goods-buttom-money {
  645. width: 100%;
  646. }
  647. .goods-buttom-money {
  648. font-size: $font-base;
  649. }
  650. }
  651. .goods-pay-stop,
  652. .goods-pay {
  653. padding: 15rpx 0;
  654. height: 100%;
  655. width: 100%;
  656. }
  657. .goods-pay-stop {
  658. background: $color-gray;
  659. line-height: 70rpx;
  660. }
  661. }
  662. /* 标题简介 */
  663. .introduce-section {
  664. background: #fff;
  665. padding: 20rpx 30rpx;
  666. .title {
  667. font-size: 32rpx;
  668. color: $font-color-dark;
  669. height: 50rpx;
  670. line-height: 50rpx;
  671. }
  672. .price-box {
  673. display: flex;
  674. align-items: baseline;
  675. height: 64rpx;
  676. padding: 10rpx 0;
  677. font-size: 26rpx;
  678. color: $uni-color-primary;
  679. }
  680. .price {
  681. font-size: $font-lg + 2rpx;
  682. }
  683. .m-price {
  684. margin: 0 12rpx;
  685. color: $font-color-light;
  686. text-decoration: line-through;
  687. }
  688. .coupon-tip {
  689. align-items: center;
  690. padding: 4rpx 10rpx;
  691. background: $uni-color-primary;
  692. font-size: $font-sm;
  693. color: #fff;
  694. border-radius: 6rpx;
  695. line-height: 1;
  696. transform: translateY(-4rpx);
  697. }
  698. .bot-row {
  699. display: flex;
  700. align-items: center;
  701. height: 50rpx;
  702. font-size: $font-sm;
  703. color: $font-color-light;
  704. text {
  705. flex: 1;
  706. }
  707. }
  708. }
  709. /* 分享 */
  710. .share-section {
  711. display: flex;
  712. align-items: center;
  713. color: $font-color-base;
  714. background: linear-gradient(left, #fdf5f6, #fbebf6);
  715. padding: 12rpx 30rpx;
  716. .share-icon {
  717. display: flex;
  718. align-items: center;
  719. width: 70rpx;
  720. height: 30rpx;
  721. line-height: 1;
  722. border: 1px solid $uni-color-primary;
  723. border-radius: 4rpx;
  724. position: relative;
  725. overflow: hidden;
  726. font-size: 22rpx;
  727. color: $uni-color-primary;
  728. &:after {
  729. content: '';
  730. width: 50rpx;
  731. height: 50rpx;
  732. border-radius: 50%;
  733. left: -20rpx;
  734. top: -12rpx;
  735. position: absolute;
  736. background: $uni-color-primary;
  737. }
  738. }
  739. .iconfavorfill {
  740. position: relative;
  741. z-index: 1;
  742. font-size: 24rpx;
  743. margin-left: 2rpx;
  744. margin-right: 10rpx;
  745. color: #fff;
  746. line-height: 1;
  747. }
  748. .tit {
  749. font-size: $font-base;
  750. margin-left: 10rpx;
  751. }
  752. .iconprompt {
  753. padding: 10rpx;
  754. font-size: 30rpx;
  755. line-height: 1;
  756. }
  757. .share-btn {
  758. flex: 1;
  759. text-align: right;
  760. font-size: $font-sm;
  761. color: $uni-color-primary;
  762. }
  763. .iconenter {
  764. font-size: $font-sm;
  765. margin-left: 4rpx;
  766. color: $uni-color-primary;
  767. }
  768. }
  769. .c-list {
  770. margin-top: 20rpx;
  771. font-size: $font-sm + 2rpx;
  772. color: $font-color-base;
  773. background: #fff;
  774. .c-row {
  775. display: flex;
  776. align-items: center;
  777. padding: 20rpx 30rpx;
  778. position: relative;
  779. }
  780. .tit {
  781. width: 140rpx;
  782. }
  783. .con {
  784. flex: 1;
  785. color: $font-color-dark;
  786. .selected-text {
  787. margin-right: 10rpx;
  788. }
  789. }
  790. .bz-list {
  791. height: 40rpx;
  792. font-size: $font-sm + 2rpx;
  793. color: $font-color-dark;
  794. text {
  795. display: inline-block;
  796. margin-right: 30rpx;
  797. }
  798. }
  799. .con-list {
  800. flex: 1;
  801. display: flex;
  802. flex-direction: column;
  803. color: $font-color-dark;
  804. line-height: 40rpx;
  805. }
  806. .red {
  807. color: $uni-color-primary;
  808. }
  809. }
  810. /* 评价 */
  811. .eva-section {
  812. display: flex;
  813. flex-direction: column;
  814. padding: 20rpx 30rpx;
  815. background: #fff;
  816. margin-top: 16rpx;
  817. .e-header {
  818. display: flex;
  819. align-items: center;
  820. height: 70rpx;
  821. font-size: $font-sm + 2rpx;
  822. color: $font-color-light;
  823. .tit {
  824. font-size: $font-base + 2rpx;
  825. color: $font-color-dark;
  826. margin-right: 4rpx;
  827. }
  828. .tip {
  829. flex: 1;
  830. text-align: right;
  831. }
  832. .iconenter {
  833. margin-left: 10rpx;
  834. }
  835. }
  836. }
  837. .eva-box {
  838. display: flex;
  839. padding: 20rpx 0;
  840. .portrait {
  841. flex-shrink: 0;
  842. width: 80rpx;
  843. height: 80rpx;
  844. border-radius: 100px;
  845. }
  846. .right {
  847. flex: 1;
  848. display: flex;
  849. flex-direction: column;
  850. font-size: $font-base;
  851. color: $font-color-base;
  852. padding-left: 26rpx;
  853. .con {
  854. font-size: $font-base;
  855. color: $font-color-dark;
  856. padding: 20rpx 0;
  857. }
  858. .bot {
  859. display: flex;
  860. justify-content: space-between;
  861. font-size: $font-sm;
  862. color: $font-color-light;
  863. }
  864. }
  865. }
  866. .eva-boxs {
  867. width: 100%;
  868. overflow: hidden;
  869. padding: 10px 28rpx;
  870. background: #f4f4f4;
  871. border-radius: 12rpx;
  872. font-size: $font-sm + 2rpx;
  873. color: #333;
  874. .portrait {
  875. flex-shrink: 0;
  876. width: 80rpx;
  877. height: 80rpx;
  878. border-radius: 100px;
  879. }
  880. .right {
  881. flex: 1;
  882. display: flex;
  883. flex-direction: column;
  884. font-size: $font-base;
  885. color: $font-color-base;
  886. .con {
  887. font-size: $font-base;
  888. color: $font-color-dark;
  889. }
  890. .bot {
  891. display: flex;
  892. justify-content: space-between;
  893. font-size: $font-sm;
  894. color: $font-color-light;
  895. }
  896. }
  897. }
  898. /* 详情 */
  899. .detail-desc {
  900. background: #fff;
  901. margin-top: 16rpx;
  902. /deep/ img {
  903. max-width: 100% !important;
  904. display: inline !important;
  905. }
  906. /deep/ div {
  907. max-width: 100% !important;
  908. }
  909. .d-header {
  910. display: flex;
  911. justify-content: center;
  912. align-items: center;
  913. height: 80rpx;
  914. font-size: $font-base + 2rpx;
  915. color: $font-color-dark;
  916. position: relative;
  917. text {
  918. padding: 0 20rpx;
  919. background: #fff;
  920. position: relative;
  921. z-index: 1;
  922. }
  923. &:after {
  924. position: absolute;
  925. left: 50%;
  926. top: 50%;
  927. transform: translateX(-50%);
  928. width: 300rpx;
  929. height: 0;
  930. content: '';
  931. border-bottom: 1px solid #ccc;
  932. }
  933. }
  934. }
  935. /* 规格选择弹窗 */
  936. .attr-content {
  937. padding: 10rpx 30rpx;
  938. .a-t {
  939. display: flex;
  940. image {
  941. width: 170rpx;
  942. height: 170rpx;
  943. flex-shrink: 0;
  944. border-radius: 8rpx;
  945. }
  946. .right {
  947. display: flex;
  948. flex-direction: column;
  949. padding-left: 24rpx;
  950. font-size: $font-sm + 2rpx;
  951. color: $font-color-base;
  952. line-height: 42rpx;
  953. .good-name {
  954. padding-top: 20rpx;
  955. max-width: 320rpx;
  956. font-size: 30rpx;
  957. font-family: PingFang SC;
  958. font-weight: bold;
  959. color: #1d2023;
  960. line-height: 42rpx;
  961. margin-bottom: 15rpx;
  962. }
  963. .price {
  964. font-size: 60rpx;
  965. font-family: PingFang SC;
  966. font-weight: bold;
  967. color: #ff6f0f;
  968. // font-size: $font-lg;
  969. // color: $uni-color-primary;
  970. // margin-bottom: 10rpx;
  971. }
  972. .selected-text {
  973. margin-right: 10rpx;
  974. }
  975. }
  976. }
  977. .attr-list {
  978. display: flex;
  979. flex-direction: column;
  980. font-size: $font-base + 2rpx;
  981. color: $font-color-base;
  982. padding-top: 30rpx;
  983. padding-left: 10rpx;
  984. }
  985. .item-list {
  986. padding: 20rpx 0 0;
  987. display: flex;
  988. flex-wrap: wrap;
  989. .tit {
  990. display: flex;
  991. align-items: center;
  992. justify-content: center;
  993. background: #eee;
  994. // margin-left: 10rpx;
  995. margin-right: 20rpx;
  996. margin-bottom: 20rpx;
  997. border-radius: 100rpx;
  998. min-width: 60rpx;
  999. height: 60rpx;
  1000. padding: 0 20rpx;
  1001. font-size: $font-base;
  1002. color: $font-color-dark;
  1003. }
  1004. .selected {
  1005. background: #fbebee;
  1006. color: $uni-color-primary;
  1007. }
  1008. }
  1009. }
  1010. /* 弹出层 */
  1011. .popup {
  1012. position: fixed;
  1013. left: 0;
  1014. top: 0;
  1015. right: 0;
  1016. bottom: 0;
  1017. z-index: 99;
  1018. &.show {
  1019. display: block;
  1020. .mask {
  1021. animation: showPopup 0.2s linear both;
  1022. }
  1023. .layer {
  1024. animation: showLayer 0.2s linear both;
  1025. }
  1026. }
  1027. &.hide {
  1028. .mask {
  1029. animation: hidePopup 0.2s linear both;
  1030. }
  1031. .layer {
  1032. animation: hideLayer 0.2s linear both;
  1033. }
  1034. }
  1035. &.none {
  1036. display: none;
  1037. }
  1038. .mask {
  1039. position: fixed;
  1040. top: 0;
  1041. width: 100%;
  1042. height: 100%;
  1043. z-index: 1;
  1044. background-color: rgba(0, 0, 0, 0.4);
  1045. }
  1046. .layer {
  1047. position: fixed;
  1048. z-index: 99;
  1049. bottom: 0;
  1050. width: 100%;
  1051. min-height: 30vh;
  1052. border-radius: 10rpx 10rpx 0 0;
  1053. background-color: #fff;
  1054. .btn {
  1055. height: 66rpx;
  1056. line-height: 66rpx;
  1057. border-radius: 100rpx;
  1058. // background: $uni-color-primary;
  1059. background: #52C696;
  1060. font-size: $font-base + 2rpx;
  1061. color: #fff;
  1062. margin: 30rpx auto 20rpx;
  1063. }
  1064. }
  1065. @keyframes showPopup {
  1066. 0% {
  1067. opacity: 0;
  1068. }
  1069. 100% {
  1070. opacity: 1;
  1071. }
  1072. }
  1073. @keyframes hidePopup {
  1074. 0% {
  1075. opacity: 1;
  1076. }
  1077. 100% {
  1078. opacity: 0;
  1079. }
  1080. }
  1081. @keyframes showLayer {
  1082. 0% {
  1083. transform: translateY(120%);
  1084. }
  1085. 100% {
  1086. transform: translateY(0%);
  1087. }
  1088. }
  1089. @keyframes hideLayer {
  1090. 0% {
  1091. transform: translateY(0);
  1092. }
  1093. 100% {
  1094. transform: translateY(120%);
  1095. }
  1096. }
  1097. }
  1098. /* 底部操作菜单 */
  1099. .page-bottom {
  1100. position: fixed;
  1101. left: 0rpx;
  1102. bottom: 0rpx;
  1103. z-index: 95;
  1104. display: flex;
  1105. justify-content: center;
  1106. align-items: center;
  1107. width: 750rpx;
  1108. height: 98rpx;
  1109. background: rgba(255, 255, 255, 0.9);
  1110. box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.5);
  1111. // border-radius: 16rpx;
  1112. .p-b-btn {
  1113. display: flex;
  1114. flex-direction: column;
  1115. align-items: center;
  1116. justify-content: center;
  1117. font-size: $font-sm;
  1118. color: $font-color-base;
  1119. width: 100rpx;
  1120. height: 98rpx;
  1121. .iconfont {
  1122. font-size: 40rpx;
  1123. line-height: 48rpx;
  1124. color: $font-color-light;
  1125. }
  1126. &.active,
  1127. &.active .iconfont {
  1128. color: $uni-color-primary;
  1129. }
  1130. .icon-fenxiang2 {
  1131. font-size: 42rpx;
  1132. transform: translateY(-2rpx);
  1133. }
  1134. .iconlikefill {
  1135. font-size: 46rpx;
  1136. }
  1137. }
  1138. .action-btn-group {
  1139. display: flex;
  1140. height: 98rpx;
  1141. // border-radius: 100px;
  1142. overflow: hidden;
  1143. // margin-left: 20rpx;
  1144. position: relative;
  1145. flex-grow: 1;
  1146. // &:after {
  1147. // content: '';
  1148. // position: absolute;
  1149. // top: 50%;
  1150. // right: 50%;
  1151. // transform: translateY(-50%);
  1152. // height: 28rpx;
  1153. // width: 0;
  1154. // border-right: 1px solid rgba(255, 255, 255, 0.5);
  1155. // }
  1156. .action-btn {
  1157. display: flex;
  1158. align-items: center;
  1159. justify-content: center;
  1160. width: 100%;
  1161. height: 100%;
  1162. font-size: $font-base;
  1163. padding: 0;
  1164. border-radius: 0;
  1165. // background: transparent;
  1166. background: #ffb238;
  1167. &.buy-now-btn {
  1168. background-color: #31332D;
  1169. }
  1170. &.add-cart-btn {
  1171. background: #52C696;
  1172. }
  1173. }
  1174. }
  1175. }
  1176. // 商店头
  1177. .shop-box {
  1178. background-color: #ffffff;
  1179. margin-top: 20rpx;
  1180. margin-bottom: 10rpx;
  1181. padding: 20rpx;
  1182. .shop-img {
  1183. border-radius: 300rpx;
  1184. height: 80rpx;
  1185. width: 80rpx;
  1186. margin-right: 20rpx;
  1187. }
  1188. .shop-button {
  1189. border-radius: 100rpx;
  1190. padding: 10rpx 20rpx;
  1191. color: $color-red;
  1192. border: 1px solid $color-red;
  1193. font-size: $font-lg;
  1194. line-height: 1;
  1195. }
  1196. }
  1197. /* #ifdef MP */
  1198. .rich-img {
  1199. width: 100% !important;
  1200. height: auto;
  1201. }
  1202. /* #endif */
  1203. /deep/ .rich-img {
  1204. width: 100% !important;
  1205. height: auto;
  1206. }
  1207. </style>