product.vue 25 KB

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