product.vue 29 KB

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