product.vue 26 KB

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