product.vue 28 KB

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