product.vue 29 KB

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