product.vue 29 KB

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