product.vue 28 KB

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