product.vue 27 KB

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