product.vue 28 KB

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