product.vue 27 KB

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