product原始备份版本.vue 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514
  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" style="width: 100%;">
  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 seckill-box-title" v-if="goodsType == 2">
  31. <view class="title flex" style="width: 100%;">
  32. <view class="title-box flex_item">
  33. <view class="title-o">
  34. <view class="price-tip">¥<text class="price">1.9</text></view>
  35. </view>
  36. <view class="title-t">
  37. <view class="peice-out">原价¥9.9</view>
  38. <view class="num">10人起团</view>
  39. </view>
  40. </view>
  41. <view class="group flex">
  42. <image src="/static/img/img064.png"></image>
  43. <view class="text">达人团</view>
  44. </view>
  45. <view class="timeStop">
  46. <view class="timeStop-name">距离结束</view>
  47. <uni-countdown
  48. color="#ffffff"
  49. background-color="#D65B3F"
  50. splitor-color="#FFFFFF"
  51. :show-day="false"
  52. :hour="seckillObj.stopTimeH"
  53. :minute="seckillObj.stopTimeM"
  54. :second="seckillObj.stopTimeS"
  55. ></uni-countdown>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="introduce-section">
  60. <text class="title clamp" v-if="goodsType == 2 ">111<text class="tip-o">截单后8小时到货</text></text>
  61. <text class="title clamp" v-if="goodsType == 0 ">{{ goodsObjact.store_name }}</text>
  62. <button open-type="share" class="shareDate">
  63. <image class="share-img" src="/static/img/img57.png"></image>
  64. 好物推荐
  65. </button>
  66. <text class="title" v-if="goodsType == 1">{{ goodsObjact.title }}</text>
  67. <text class="info" v-if="goodsObjact.store_info">{{ goodsObjact.store_info }}</text>
  68. <view class="progress-box" v-if="goodsType == 0">
  69. <progress :percent="goodsObjact.percent | parseIntTo" activeColor="#F65527" font-size="10" show-info border-radius="5" stroke-width="9" />
  70. <view class="number">剩余{{ goodsObjact.percent | parseIntTo }}%</view>
  71. </view>
  72. <view class="price-box" v-if="goodsType == 0">
  73. <text class="price-tip">¥</text>
  74. <view class="price">
  75. {{ goodsObjact.price }}
  76. <text class="text">/份</text>
  77. <text class="m-price" v-if="goodsObjact.ot_price > goodsObjact.price">¥{{ goodsObjact.ot_price }}</text>
  78. </view>
  79. </view>
  80. <view class="price-green">
  81. ¥{{ goodsObjact.ot_price }}
  82. <text>市场价</text>
  83. </view>
  84. <!-- <view class="green-card flex" v-if="userInfo != ''">
  85. <view class="card flex_item">
  86. <view class="card-img"><image src="/static/img/img20.png"></image></view>
  87. <view class="card_tpl" v-if="userInfo.level_info.grade > 99">
  88. 美卡已节省<text>{{(goodsObjact.price - goodsObjact.ot_price).toFixed(2)}}</text>元
  89. </view>
  90. <view class="card_tpl" v-if="userInfo.level_info.grade < 100">开通美卡可节省<text>{{(goodsObjact.price - goodsObjact.ot_price).toFixed(2)}}</text>元</view>
  91. </view>
  92. <view class="card-more" @click="ToKaitong" v-if="userInfo.level_info.grade < 100">点击开通美卡<text class="iconfont iconenter"></text></view>
  93. <view class="card-more" @click="Tochakan" v-if="userInfo.level_info.grade > 99">查看我的美卡<text class="iconfont iconenter"></text></view>
  94. </view> -->
  95. </view>
  96. <view class="c-list">
  97. <view class="c-row b-b">
  98. <text class="tit">配送</text>
  99. <view class="bz-list con">立即下单 ,预计最快第二天8.30-9:30送达</view>
  100. </view>
  101. <view class="c-row b-b" @click="Getcoupon">
  102. <text class="tit">优惠券</text>
  103. <text class="con t-r red">领取优惠券</text>
  104. <text class="iconfont iconenter"></text>
  105. </view>
  106. <view class="c-row b-b">
  107. <text class="tit">服务</text>
  108. <view class="bz-list con">
  109. <text>食材质检 ·</text>
  110. <text>无接触配送到门口</text>
  111. </view>
  112. </view>
  113. </view>
  114. <!-- 猜你喜欢 -->
  115. <view class="guess-item">
  116. <view class="guess">猜你喜欢</view>
  117. <view class="guess-scroll flex_item" scroll-x>
  118. <view class="scroll-list" v-for="ls in good_list" @click="navToDetailPage(ls)">
  119. <view class="scoll-img"><image :src="ls.image"></image></view>
  120. <view class="scoll-name ellipsis">{{ ls.store_name }}</view>
  121. <view class="price-list flex">
  122. <view class="tpl">
  123. <view class="red-price">
  124. ¥
  125. <text>{{ ls.price }}</text>
  126. </view>
  127. <view class="grey-price">¥{{ ls.ot_price }}</view>
  128. </view>
  129. <view class="img position-relative" @click.stop="Addcar(ls)">
  130. <image src="/static/img/img21.png"></image>
  131. <view class="corner" v-if="ls.cart_num > 0">
  132. <text>{{ ls.cart_num }}</text>
  133. </view>
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. </view>
  139. <!-- 评价 -->
  140. <view class="eva-section" v-if="reply" @click="navTo('/pages/product/reply?id=' + goodsid)">
  141. <view class="e-header">
  142. <text class="tit">评价</text>
  143. <text>({{ list.replyCount }})</text>
  144. <text class="tip">好评率 {{ list.replyChance }}%</text>
  145. <text class="iconfont iconenter"></text>
  146. </view>
  147. <view class="eva-box">
  148. <image class="portrait" :src="reply.avatar" mode="aspectFill"></image>
  149. <view class="right">
  150. <text class="name">{{ reply.nickname }}</text>
  151. <text class="con">{{ reply.comment }}</text>
  152. <view class="con_box">
  153. <view class="con_image" v-for="item in reply.pics"><image :src="item"></image></view>
  154. </view>
  155. <view class="bot">
  156. <text class="attr"></text>
  157. <text class="time">{{ reply.add_time }}</text>
  158. </view>
  159. </view>
  160. </view>
  161. </view>
  162. <view class="c-list">
  163. <view class="c-row title b-b">规格</view>
  164. <view class="c-row b-b">
  165. <text class="tit">净含量</text>
  166. <text class="con t-r">{{ goodsObjact.net_quantity }}</text>
  167. </view>
  168. <view class="c-row b-b">
  169. <text class="tit">保存条件</text>
  170. <text class="con t-r">{{ goodsObjact.storage_condition }}</text>
  171. </view>
  172. <view class="c-row b-b">
  173. <text class="tit">保质期</text>
  174. <text class="con t-r">{{ goodsObjact.expiration_date }}</text>
  175. </view>
  176. </view>
  177. <view class="detail-desc">
  178. <view class="d-header"><text>图文详情</text></view>
  179. <rich-text class="detail-centent" :nodes="description"></rich-text>
  180. <!-- 底部高度撑开 -->
  181. <view :class="{ contentBottomHeight: goodsType == 1 || goodsType == 2, goodsBottom: goodsType == 0 }"></view>
  182. </view>
  183. <!-- 底部操作菜单 -->
  184. <view class="page-bottom" v-if="goodsType == 0">
  185. <!-- <navigator url="/pages/index/index" open-type="switchTab" class="p-b-btn">
  186. <text class="iconfont iconhomefill"></text>
  187. <text>首页</text>
  188. </navigator> -->
  189. <navigator url="/pages/cart/cart" open-type="switchTab" class="p-b-btn"><image src="/static/img/img23.png"></image></navigator>
  190. <!-- <view class="p-b-btn" :class="{ active: goodsObjact.userCollect }" @click="toFavorite(goodsObjact)">
  191. <text class="iconfont iconlikefill"></text>
  192. <text>收藏</text>
  193. </view> -->
  194. <view class="action-btn-group">
  195. <button type="primary" class=" action-btn no-border add-cart-btn" @click="buy(2)">加入购物车</button>
  196. <button type="primary" class=" action-btn no-border buy-now-btn" @click="buy(1)">立即购买</button>
  197. </view>
  198. </view>
  199. <!-- 秒杀商品购买 -->
  200. <view class="goods-pay-box flex" :class="{ stop: seckillObj.stop }" v-if="goodsType == 1">
  201. <view class="goods-pay bgLine" v-if="!seckillObj.stop" @click="buy(1)"><text>立即购买</text></view>
  202. <view class="goods-pay-stop" v-else>活动已结束</view>
  203. </view>
  204. <!-- 拼团商品购买 -->
  205. <view class="goods-pay-box flex" v-if="goodsType == 2">
  206. <view class="goods-pay bg-pinks">
  207. <!-- <view class="goods-pay-o">本单发起人奖金<text>2元</text></view>
  208. <view class="goods-pay-t">本单销售额佣金<text>?%</text></view> -->
  209. </view>
  210. <view class="goods-pay bg-danger" @click="buy(1)">
  211. <!-- <view class="goods-buttom-money">¥{{ goodsObjact.price }}</view> -->
  212. <view class="goods-buttom">一键开团</view>
  213. </view>
  214. </view>
  215. <view :class="{ seckillBottom: goodsType == 1, goodsBottom: goodsType == 0 }"></view>
  216. <!-- 分享 -->
  217. <!-- <share ref="share" :contentHeight="580" :shareList="shareList"></share> -->
  218. </view>
  219. </template>
  220. <script>
  221. import share from '@/components/share';
  222. import uniNumberBox from '@/components/uni-number-box.vue';
  223. import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
  224. import { goodsDetail, cartAdd, collectAdd, collectDel, seckillGoods, groupGoods } from '@/api/product.js';
  225. import { mapState } from 'vuex';
  226. import store from '@/store/index.js';
  227. import { saveUrl } from '@/utils/loginUtils.js';
  228. // #ifdef H5
  229. import { weixindata } from '@/utils/wxAuthorized';
  230. // #endif
  231. export default {
  232. components: {
  233. share,
  234. uniNumberBox,
  235. uniCountdown
  236. },
  237. data() {
  238. return {
  239. reply: '', //评论
  240. list: '', //商品详情的数据
  241. type: 1, //默认支付方式add为
  242. goodsNumber: 1, //购买数量
  243. goodsid: '', //商品id
  244. description: '', //商品描述
  245. specClass: 'none', //显示隐藏弹窗
  246. goodsObjact: {}, //保存商品数据
  247. //图片循环
  248. imgList: [],
  249. specList: [],
  250. // 对比对象
  251. productValue: [], //商品规格列表
  252. actionPrice: 0, //默认选中商品价格
  253. actionImage: '', //默认选中图片
  254. good_list: '', //猜你喜欢列表
  255. uniqueId: '', //选中的商品分类
  256. specSelected: [], //选中的分类
  257. specSelectedName: '', //选中分类名称
  258. goodsNumberMax: 0, //最大可购买数量
  259. system_store: {}, //商店信息
  260. shopId: '', //商店id
  261. goodsType: 0, //商品类型1秒杀商品0为普通商品2为拼团商品
  262. // 秒杀数据保存
  263. seckillObj: {
  264. stopTime: 0, //结束时间
  265. stop: false, //是否结束
  266. stopTimeH: 0, //小时
  267. stopTimeM: 0, //分钟
  268. stopTimeS: 0 //秒钟
  269. },
  270. // 拼团数据保存
  271. pink: {
  272. id: '', //拼团编号
  273. uid: '', //用户编号
  274. people: '', //拼团人数
  275. price: '', //拼团价格
  276. stop_time: '', //拼团结束时间
  277. nickname: '', //团长昵称
  278. avatar: '', //团长头像
  279. count: '', //拼团剩余人数
  280. h: '', //时
  281. i: '', //分
  282. s: '' //秒
  283. },
  284. userInfo: ''
  285. };
  286. },
  287. filters: {
  288. parseIntTo(percent) {
  289. percent = +percent * 100;
  290. if (percent % 1 === 0) {
  291. return percent;
  292. } else {
  293. percent = percent.toFixed(1);
  294. return percent;
  295. }
  296. }
  297. },
  298. async onLoad(options) {
  299. let obj = this;
  300. obj.userInfo = uni.getStorageSync('userInfo');
  301. //保存商品id
  302. this.goodsid = options.id;
  303. // 判断有无人邀请
  304. if (options.spread) {
  305. // 存储邀请人
  306. uni.setStorageSync('spread', options.spread);
  307. }
  308. saveUrl();
  309. // 判断是否为秒杀商品
  310. if (options.type == 1) {
  311. // 保存商品类型
  312. this.goodsType = 1;
  313. // 保存结束时间
  314. this.seckillObj.stopTime = options.stoptime;
  315. // 获取当前时间毫秒数
  316. let stoptime = options.stoptime * 1000;
  317. // 获取当前时间
  318. let acitonTime = new Date();
  319. // 判断当前时间是否大于结束时间
  320. if (acitonTime.getTime() > stoptime) {
  321. // 当前秒杀时间已经结束
  322. this.seckillObj.stop = true;
  323. } else {
  324. // 计算倒计时
  325. this.timeComputed(stoptime, this.seckillObj);
  326. }
  327. this.seckillGoods();
  328. return;
  329. }
  330. if (options.type == 2) {
  331. // 保存当前拼团商品类型
  332. this.goodsType = 2;
  333. // 家在数据
  334. this.groupGoods();
  335. return;
  336. }
  337. if (this.goodsType == 0) {
  338. // 加载普通商品详情
  339. this.goodsDetail();
  340. }
  341. // 注册邀请信息
  342. // #ifdef H5
  343. let bool = uni.getStorageSync('weichatBrowser') || '';
  344. if (bool) {
  345. weixindata();
  346. }
  347. // #endif
  348. },
  349. computed: {
  350. ...mapState(['weichatObj', 'baseURL', 'urlFile'])
  351. },
  352. methods: {
  353. navToProductGoods() {
  354. uni.redirectTo({
  355. url: '/pages/product/product?id=' + this.goodsObjact.product_id
  356. });
  357. },
  358. //领取优惠券
  359. Getcoupon() {
  360. uni.navigateTo({
  361. url: '/pages/coupon/getcoupon'
  362. });
  363. },
  364. //详情页
  365. navToDetailPage(item) {
  366. let id = item.id;
  367. uni.navigateTo({
  368. url: '/pages/product/product?id=' + id
  369. });
  370. },
  371. //开通美卡
  372. ToKaitong() {
  373. uni.showToast({
  374. title: '暂未开通',
  375. type: 'top',
  376. duration: 500,
  377. icon: 'none'
  378. });
  379. // uni.navigateTo({
  380. // url: '/pages/user/card'
  381. // });
  382. },
  383. //查看美卡
  384. Tochakan() {
  385. // uni.navigateTo({
  386. // url: '/pages/user/renew'
  387. // });
  388. uni.showToast({
  389. title: '暂未开通',
  390. type: 'top',
  391. duration: 500,
  392. icon: 'none'
  393. });
  394. },
  395. onShareAppMessage(options) {
  396. // 设置菜单中的转发按钮触发转发事件时的转发内容
  397. let pages = getCurrentPages(); //获取加载的页面
  398. let currentPage = pages[pages.length - 1]; //获取当前页面的对象
  399. let url = currentPage.route; //当前页面url
  400. let item = currentPage.options; //如果要获取url中所带的参数可以查看options
  401. let shareObj = {};
  402. console.log(this.userInfo.uid,55)
  403. if (this.goodsType == 0) {
  404. shareObj = {
  405. title: this.goodsObjact.store_name +' 价格:'+ this.goodsObjact.price, // 默认是小程序的名称(可以写slogan等)
  406. path: url + '?id=' + item.id+'&spread='+this.userInfo.uid, // 默认是当前页面,必须是以‘/’开头的完整路径
  407. imageUrl: this.goodsObjact.image,
  408. success: function(res) {
  409. // 转发成功之后的回调
  410. if (res.errMsg == 'shareAppMessage:ok') {
  411. }
  412. },
  413. fail: function() {
  414. // 转发失败之后的回调
  415. if (res.errMsg == 'shareAppMessage:fail cancel') {
  416. // 用户取消转发
  417. } else if (res.errMsg == 'shareAppMessage:fail') {
  418. // 转发失败,其中 detail message 为详细失败信息
  419. }
  420. }
  421. };
  422. }
  423. if (this.goodsType == 1) {
  424. shareObj = {
  425. title: this.goodsObjact.title, // 默认是小程序的名称(可以写slogan等)
  426. path: url + '?id=' + item.id + '&type=' + item.type + '&stoptime=' + item.stoptime +'&spread='+this.userInfo.uid, // 默认是当前页面,必须是以‘/’开头的完整路径
  427. imageUrl: this.goodsObjact.image,
  428. success: function(res) {
  429. // 转发成功之后的回调
  430. if (res.errMsg == 'shareAppMessage:ok') {
  431. }
  432. },
  433. fail: function() {
  434. // 转发失败之后的回调
  435. if (res.errMsg == 'shareAppMessage:fail cancel') {
  436. // 用户取消转发
  437. } else if (res.errMsg == 'shareAppMessage:fail') {
  438. // 转发失败,其中 detail message 为详细失败信息
  439. }
  440. }
  441. };
  442. }
  443. console.log(shareObj)
  444. // 返回shareObj
  445. //   // 来自页面内的按钮的转发
  446. //   if( options.from == 'button' ){
  447. //     // 此处可以修改 shareObj 中的内容
  448. // if(this.goodsType == 0){
  449. // path: url+'?id='+item.id, // 默认是当前页面,必须是以‘/’开头的完整路径
  450. // path: url+'?id='+item.id,
  451. // }
  452. // if(this.goodsType == 1){
  453. // path: url+'?id='+item.id+'&type='+item.type+'&stoptime='+item.stoptime,// 默认是当前页面,必须是以‘/’开头的完整路径
  454. // path: url+'?id='+item.id,
  455. // }
  456. //
  457. //   }
  458. return shareObj;
  459. },
  460. navTo(url) {
  461. uni.navigateTo({
  462. url
  463. });
  464. },
  465. //加入购物车
  466. Addcar(item) {
  467. let obj = this;
  468. cartAdd({
  469. cartNum: '1', //商品数量
  470. uniqueId: '', //商品标签
  471. new: 0, //商品是否新增加到购物车1为不加入0为加入
  472. mer_id: '',
  473. productId: item.id //商品编号
  474. })
  475. .then(function(e) {
  476. uni.showToast({
  477. title: '成功加入购物车',
  478. type: 'top',
  479. duration: 500,
  480. icon: 'none'
  481. });
  482. obj.goodsDetail();
  483. })
  484. .catch(e => {
  485. console.log(e);
  486. });
  487. },
  488. // 获取普通商品信息
  489. goodsDetail() {
  490. let obj = this;
  491. goodsDetail({}, this.goodsid).then(function({ data }) {
  492. obj.list = data;
  493. obj.good_list = data.good_list; //保存猜你喜欢列表
  494. obj.reply = data.reply; //保存评论列表
  495. let goods = data.storeInfo;
  496. obj.goodsObjact = goods;
  497. if (obj.goodsObjact.description != null) {
  498. obj.description = obj.goodsObjact.description.replace(/\<img/gi, '<img class="rich-img"');
  499. } //小程序商品详情图超出屏幕问题
  500. obj.imgList = goods.slider_image; //保存轮播图
  501. obj.specList = data.productAttr; //保存分类列表
  502. obj.productValue = data.productValue; //保存分类查询数据
  503. obj.actionPrice = goods.price; //保存默认选中商品价格
  504. obj.actionImage = goods.image_base; //保存默认选中商品图片
  505. obj.goodsNumberMax = goods.stock; //保存默认选中最大可购买商品数量
  506. obj.shopId = data.mer_id; //保存商店id
  507. // #ifdef H5
  508. obj.$nextTick(function() {
  509. obj.shareDate();
  510. });
  511. // #endif
  512. });
  513. },
  514. // 获取拼团商品详情
  515. groupGoods() {
  516. let obj = this;
  517. groupGoods({}, this.goodsid).then(function({ data }) {
  518. obj.pink = data.pink[0]; //保存拼团信息
  519. let goods = data.storeInfo;
  520. obj.goodsObjact = goods;
  521. if (obj.goodsObjact.description != null) {
  522. obj.description = obj.goodsObjact.description.replace(/\<img/gi, '<img class="rich-img"');
  523. }
  524. obj.imgList = goods.images; //保存轮播图
  525. obj.specList = data.productAttr; //保存分类列表
  526. obj.productValue = data.productValue; //保存分类查询数据
  527. obj.actionPrice = goods.price; //保存默认选中商品价格
  528. obj.actionImage = goods.image_base; //保存默认选中商品图片
  529. obj.goodsNumberMax = 1; //保存默认选中最大可购买商品数量
  530. obj.shopId = data.mer_id; //保存商店id
  531. // #ifdef H5
  532. obj.shareDate();
  533. // #endif
  534. });
  535. },
  536. // 获取秒杀商品详情
  537. seckillGoods() {
  538. let obj = this;
  539. seckillGoods({}, this.goodsid).then(function({ data }) {
  540. let goods = data.storeInfo;
  541. obj.list = data;
  542. obj.goodsObjact = goods;
  543. if (obj.goodsObjact.description != null) {
  544. obj.description = obj.goodsObjact.description.replace(/\<img/gi, '<img class="rich-img"');
  545. }
  546. obj.imgList = goods.images; //保存轮播图
  547. obj.specList = data.productAttr; //保存分类列表
  548. obj.productValue = data.productValue; //保存分类查询数据
  549. obj.actionPrice = goods.price; //保存默认选中商品价格
  550. obj.actionImage = goods.image_base; //保存默认选中商品图片
  551. obj.goodsNumberMax = goods.num; //保存默认选中最大可购买商品数量
  552. obj.shopId = data.mer_id; //保存商店id
  553. // #ifdef H5
  554. obj.shareDate();
  555. // #endif
  556. });
  557. },
  558. // 计算倒计时时间
  559. timeComputed(da, ar) {
  560. let obj = ar;
  561. // 设置到期时间
  562. let time = new Date(da);
  563. // 获取当前时间
  564. let actTime = new Date();
  565. // 获取到期时间具体值
  566. let tH = time.getHours();
  567. let tM = time.getMinutes();
  568. let tS = time.getSeconds();
  569. // 获取当前时间具体值
  570. let aH = actTime.getHours();
  571. let aM = actTime.getMinutes();
  572. let aS = actTime.getSeconds();
  573. // 计算时间,保存需要多少时间到期
  574. obj.stopTimeH = tH - aH;
  575. obj.stopTimeM = tM - aM;
  576. obj.stopTimeS = tS - aS;
  577. },
  578. // #ifdef H5
  579. // 加载微信html5页面分享方法
  580. shareDate() {
  581. let obj = this;
  582. // 保存分享人id链接
  583. let url = window.location.href + '&spread=' + this.userInfo.uid;
  584. // 判断是否微信浏览器
  585. let bool = uni.getStorageSync('weichatBrowser') || '';
  586. if (bool) {
  587. // 过滤微信强制添加的链接地址
  588. url = url.replace(/[\?,&]{0,1}from=singlemessage/g, '');
  589. let data = {
  590. link: url, // 分享链接
  591. imgUrl: obj.goodsObjact.image, // 分享图标
  592. desc: obj.goodsObjact.store_info,
  593. title: obj.goodsObjact.store_name,
  594. success: function() {}
  595. };
  596. obj.weichatObj.updateAppMessageShareData(data);
  597. obj.weichatObj.updateTimelineShareData(data);
  598. }
  599. },
  600. // #endif
  601. // sharelist() {
  602. // let obj = this;
  603. // // 保存分享人id链接
  604. // let url = window.location.href + '&spread=' + this.userInfo.uid;
  605. // // 判断是否微信浏览器
  606. // let bool = uni.getStorageSync('weichatBrowser') || '';
  607. // if (bool) {
  608. // // 过滤微信强制添加的链接地址
  609. // url = url.replace(/[\?,&]{0,1}from=singlemessage/g, '');
  610. // console.log(url)
  611. // let data = {
  612. // link: url, // 分享链接
  613. // imgUrl: obj.goodsObjact.image, // 分享图标
  614. // desc: obj.goodsObjact.store_info,
  615. // title: obj.goodsObjact.store_name,
  616. // success: function() {}
  617. // };
  618. // console.log(data)
  619. // obj.weichatObj.updateAppMessageShareData(data);
  620. // obj.weichatObj.updateTimelineShareData(data);
  621. // }
  622. // },
  623. // #en
  624. // 购买数量变化
  625. numberChange(e) {
  626. this.goodsNumber = e.number;
  627. },
  628. //规格弹窗开关
  629. toggleSpec(str) {
  630. if (this.specClass === 'show') {
  631. this.specClass = 'hide';
  632. setTimeout(() => {
  633. this.specClass = 'none';
  634. }, 250);
  635. } else if (this.specClass === 'none') {
  636. this.specClass = 'show';
  637. }
  638. // 判断是否为数字
  639. if (typeof str == 'number') {
  640. // 保存当前购买类型
  641. this.type = str;
  642. }
  643. },
  644. //选择规格
  645. selectSpec(item, arr, ind) {
  646. arr.attr_value.forEach(function(e) {
  647. e.check = false;
  648. });
  649. item.check = true;
  650. this.specSelected[ind] = item.attr;
  651. let str = this.specSelected.join(',');
  652. this.specSelectedName = this.specSelected.join(' ');
  653. if (this.productValue[str]) {
  654. let data = this.productValue[str];
  655. this.actionPrice = data.price;
  656. this.goodsNumberMax = data.stock;
  657. this.actionImage = data.image;
  658. this.uniqueId = data.unique;
  659. }
  660. },
  661. //分享
  662. share() {
  663. this.$refs.share.toggleMask();
  664. },
  665. //收藏
  666. toFavorite(item) {
  667. let obj = this;
  668. item.userCollect = !item.userCollect;
  669. // 判断是否已经收藏
  670. if (!item.userCollect) {
  671. collectDel({ id: obj.goodsid, category: 'product' }).then(function(e) {
  672. uni.showToast({
  673. title: '成功取消收藏',
  674. type: 'top',
  675. duration: 1500,
  676. icon: 'none'
  677. });
  678. });
  679. } else {
  680. collectAdd({ id: obj.goodsid, category: 'product' }).then(function(e) {
  681. uni.showToast({
  682. title: '成功加入收藏',
  683. type: 'top',
  684. duration: 1500,
  685. icon: 'none'
  686. });
  687. });
  688. }
  689. },
  690. // 立即购买
  691. buy(item) {
  692. let obj = this;
  693. obj.type = item;
  694. // 创建传值对象
  695. let data = {
  696. cartNum: obj.goodsNumber, //商品数量
  697. uniqueId: obj.uniqueId, //商品标签
  698. new: '1', //商品是否新增加到购物车1为不加入0为加入
  699. mer_id: obj.shopId
  700. };
  701. // 判断是否为加入购物车
  702. if (obj.type == 2) {
  703. data.new = 0;
  704. }
  705. // 判断是否为普通商品
  706. if (obj.goodsType == 0) {
  707. data.productId = obj.goodsid; //商品编号
  708. }
  709. // 判断是否为秒杀商品
  710. if (obj.goodsType == 1) {
  711. data.secKillId = obj.goodsid; //秒杀商品编号
  712. data.productId = obj.goodsObjact.product_id; //商品编号
  713. // 判断是否秒杀已经结束
  714. if (obj.seckillObj.stop) {
  715. uni.showModal({
  716. title: '提示',
  717. content: '当前活动已经结束',
  718. showCancel: false
  719. });
  720. return;
  721. }
  722. }
  723. // 判断是否为拼团商品
  724. if (obj.goodsType == 2) {
  725. data.combinationId = obj.goodsid; //拼团编号
  726. data.productId = obj.goodsObjact.product_id; //商品编号
  727. }
  728. cartAdd(data)
  729. .then(function(e) {
  730. let da = e.data;
  731. if (obj.type == 1) {
  732. // 跳转到支付页
  733. uni.navigateTo({
  734. url: '/pages/order/createOrder?id=' + da.cartId
  735. });
  736. }
  737. if (obj.type == 2) {
  738. uni.showToast({
  739. title: '成功加入购物车',
  740. type: 'top',
  741. duration: 2000,
  742. icon: 'none'
  743. });
  744. obj.goodsDetail();
  745. obj.toggleSpec();
  746. }
  747. })
  748. .catch(e => {
  749. console.log(e);
  750. });
  751. },
  752. // 阻止触发上级事件
  753. stopPrevent() {}
  754. }
  755. };
  756. </script>
  757. <style lang="scss">
  758. page {
  759. background: #f0f0f0;
  760. }
  761. //秒杀、拼团底部高度
  762. .contentBottomHeight {
  763. height: 110rpx;
  764. }
  765. //默认商品底部高度
  766. .goodsBottom {
  767. height: 160rpx;
  768. }
  769. .iconenter {
  770. font-size: $font-base + 2rpx;
  771. color: #888;
  772. }
  773. .rich-img {
  774. width: 100% !important;
  775. height: auto;
  776. }
  777. .carousel {
  778. /* #ifdef APP-PLUS */
  779. padding-top: var(--status-bar-height);
  780. /* #endif */
  781. height: 750rpx;
  782. position: relative;
  783. swiper {
  784. height: 100%;
  785. }
  786. .image-wrapper {
  787. width: 100%;
  788. height: 100%;
  789. }
  790. .swiper-item {
  791. display: flex;
  792. justify-content: center;
  793. align-content: center;
  794. height: 750rpx;
  795. overflow: hidden;
  796. image {
  797. width: 100%;
  798. height: 100%;
  799. }
  800. }
  801. }
  802. // 秒杀
  803. .seckill-box-title {
  804. background: linear-gradient(90deg, rgba(239, 78, 81, 1) 0%, rgba(244, 113, 59, 1) 100%) !important;
  805. .price,
  806. .price-tip,
  807. .m-price {
  808. color: #ffffff !important;
  809. font-size: 24rpx;
  810. }
  811. .price-tip {
  812. font-size: $font-base;
  813. }
  814. .price {
  815. font-size: 45rpx !important;
  816. font-weight: bold;
  817. }
  818. }
  819. // 底部拼团、秒杀支付按钮
  820. .goods-pay-box {
  821. position: fixed;
  822. left: 0;
  823. bottom: 0;
  824. z-index: 95;
  825. width: 750rpx;
  826. height: 100rpx;
  827. line-height: 1;
  828. color: #ffffff;
  829. text-align: center;
  830. font-size: $font-lg;
  831. .bgLine {
  832. background: linear-gradient(90deg, rgba(239, 78, 81, 1) 0%, rgba(244, 113, 59, 1) 100%);
  833. }
  834. // 拼团支付按钮
  835. .goods-pay {
  836. display: flex;
  837. align-content: center;
  838. flex-wrap: wrap;
  839. justify-content: center;
  840. .goods-buttom,
  841. .goods-buttom-money {
  842. width: 100%;
  843. }
  844. .goods-buttom-money {
  845. font-size: $font-base;
  846. }
  847. .goods-pay-o{
  848. background-color: #FF4434;
  849. padding: 5rpx 0rpx;
  850. text{
  851. padding: 5rpx 10rpx;
  852. background-color: #FEEEEE;
  853. color: #FF0919;
  854. }
  855. }
  856. .goods-pay-t{
  857. }
  858. }
  859. .bg-pinks{
  860. background-color:#FEEEEE;
  861. }
  862. .goods-pay-stop,
  863. .goods-pay {
  864. padding: 15rpx 0;
  865. height: 100%;
  866. width: 100%;
  867. }
  868. .goods-pay-stop {
  869. background: $color-gray;
  870. line-height: 70rpx;
  871. }
  872. }
  873. /* 标题简介 */
  874. .introduce-section {
  875. position: relative;
  876. background: #fff;
  877. padding: 35rpx 0rpx;
  878. padding-left: 35rpx;
  879. .title {
  880. font-size: 32rpx;
  881. color: $font-color-dark;
  882. height: 50rpx;
  883. width: 70%;
  884. .tip-o{
  885. color: #FF3334;
  886. padding-left: 15rpx;
  887. }
  888. }
  889. .title-box{
  890. color: #FFFFFF;
  891. .title-o{
  892. line-height: 75rpx;
  893. .price{
  894. font-size: 70rpx !important;
  895. }
  896. }
  897. .title-t{
  898. padding-left: 20rpx;
  899. font-size: 24rpx !important;
  900. .peice-out{
  901. text-decoration: line-through;
  902. }
  903. .num{
  904. margin-top: 10rpx;
  905. background-color: #FFFFFF;
  906. color: #FF3A56;
  907. border-radius: 8rpx;
  908. }
  909. }
  910. }
  911. .group{
  912. color: #FFFFFF;
  913. image{
  914. width: 55rpx;
  915. height: 45rpx;
  916. }
  917. .text{
  918. font-size: 40rpx !important;
  919. padding-left: 10rpx;
  920. }
  921. }
  922. .timeStop{
  923. width: 30%;
  924. background-color: #FEEEEE;
  925. height: 120rpx;
  926. padding-left: 25rpx;
  927. .timeStop-name{
  928. padding-top: 15rpx;
  929. width: 100%;
  930. text-align: center;
  931. color: #FF3334;
  932. font-size: 20rpx;
  933. }
  934. }
  935. .shareDate {
  936. position: absolute;
  937. top: 25rpx;
  938. right: 25rpx;
  939. font-size: 26rpx;
  940. color: #3d3f46;
  941. border-radius: 15rpx;
  942. background-color: #ffffff;
  943. height: 60rpx;
  944. line-height: 60rpx;
  945. }
  946. .share-img {
  947. width: 30rpx;
  948. height: 30rpx;
  949. position: relative;
  950. top: 5rpx;
  951. left: 0;
  952. margin-right: 10rpx;
  953. }
  954. .info {
  955. color: #999999;
  956. font-size: 26rpx;
  957. padding-bottom: 15rpx;
  958. }
  959. .progress-box {
  960. width: 260rpx;
  961. position: relative;
  962. margin-top: 15rpx;
  963. line-height: 10px;
  964. .number {
  965. font-size: 17rpx;
  966. position: absolute;
  967. z-index: 999;
  968. top: 3rpx;
  969. left: 15rpx;
  970. color: #ffffff;
  971. }
  972. }
  973. .price-box {
  974. display: flex;
  975. align-items: baseline;
  976. height: 64rpx;
  977. padding: 10rpx 0;
  978. font-size: 26rpx;
  979. color: $uni-color-primary;
  980. }
  981. .price {
  982. font-size: $font-lg + 6rpx;
  983. .text {
  984. padding-left: 5rpx;
  985. color: #b0b0b0;
  986. font-size: 22rpx !important;
  987. }
  988. }
  989. .price-green {
  990. color: #2dbd59;
  991. font-size: 28rpx !important;
  992. text {
  993. background: #2dbd59;
  994. color: #ffffff;
  995. padding: 0rpx 10rpx;
  996. border-radius: 5rpx;
  997. font-size: 22rpx !important;
  998. margin-left: 15rpx;
  999. }
  1000. }
  1001. .m-price {
  1002. margin: 0 12rpx;
  1003. color: $font-color-light;
  1004. text-decoration: line-through;
  1005. margin-left: 25rpx;
  1006. font-size: 24rpx;
  1007. }
  1008. .coupon-tip {
  1009. align-items: center;
  1010. padding: 4rpx 10rpx;
  1011. background: $uni-color-primary;
  1012. font-size: $font-sm;
  1013. color: #fff;
  1014. border-radius: 6rpx;
  1015. line-height: 1;
  1016. transform: translateY(-4rpx);
  1017. }
  1018. .bot-row {
  1019. display: flex;
  1020. align-items: center;
  1021. height: 50rpx;
  1022. font-size: $font-sm;
  1023. color: $font-color-light;
  1024. text {
  1025. flex: 1;
  1026. }
  1027. }
  1028. }
  1029. .green-card {
  1030. width: 100%;
  1031. margin-top: 35rpx;
  1032. border-radius: 35rpx;
  1033. background: #f5f5f5;
  1034. padding: 15rpx 25rpx;
  1035. font-size: 26rpx;
  1036. .card {
  1037. background: linear-gradient(-38deg, rgba(68, 84, 117, 1), rgba(68, 84, 117, 1));
  1038. color: #ffffff;
  1039. padding: 10rpx 15rpx;
  1040. border-radius: 35rpx;
  1041. .card-img {
  1042. width: 32rpx;
  1043. height: 28rpx;
  1044. image {
  1045. width: 100%;
  1046. height: 100%;
  1047. }
  1048. }
  1049. .card_tpl {
  1050. margin-left: 10rpx;
  1051. text {
  1052. color: #f0c55f;
  1053. }
  1054. }
  1055. }
  1056. .card-more {
  1057. color: #1a273d;
  1058. }
  1059. }
  1060. .c-list {
  1061. font-size: $font-sm + 2rpx;
  1062. color: $font-color-base;
  1063. background: #fff;
  1064. .title {
  1065. color: #333333;
  1066. font-size: 32rpx;
  1067. font-weight: bold;
  1068. }
  1069. .c-row {
  1070. display: flex;
  1071. align-items: center;
  1072. padding: 20rpx 30rpx;
  1073. position: relative;
  1074. }
  1075. .tit {
  1076. width: 140rpx;
  1077. }
  1078. .con {
  1079. flex: 1;
  1080. color: $font-color-dark;
  1081. .selected-text {
  1082. margin-right: 10rpx;
  1083. }
  1084. }
  1085. .bz-list {
  1086. height: 40rpx;
  1087. font-size: $font-sm + 2rpx;
  1088. color: $font-color-dark;
  1089. text {
  1090. display: inline-block;
  1091. margin-right: 30rpx;
  1092. }
  1093. }
  1094. .con-list {
  1095. flex: 1;
  1096. display: flex;
  1097. flex-direction: column;
  1098. color: $font-color-dark;
  1099. line-height: 40rpx;
  1100. }
  1101. .red {
  1102. color: #fb6d24;
  1103. }
  1104. }
  1105. //猜你喜欢
  1106. .guess-item {
  1107. padding: 25rpx 25rpx;
  1108. background: #ffffff;
  1109. margin-bottom: 15rpx;
  1110. padding-bottom: 45rpx !important;
  1111. .guess {
  1112. color: #000000;
  1113. font-size: 35rpx;
  1114. font-weight: 500;
  1115. padding-bottom: 25rpx;
  1116. }
  1117. .guess-scroll {
  1118. width: 100%;
  1119. font-size: 24rpx;
  1120. overflow: hidden;
  1121. overflow-x: auto;
  1122. justify-content: flex-start;
  1123. .scroll-list {
  1124. border: 2rpx solid #f0f0f0;
  1125. border-radius: 25rpx;
  1126. margin-right: 15rpx;
  1127. .scoll-img {
  1128. width: 227rpx;
  1129. border-top-right-radius: 25rpx;
  1130. border-top-left-radius: 25rpx;
  1131. height: 227rpx;
  1132. overflow: hidden;
  1133. image {
  1134. width: 100%;
  1135. height: 100%;
  1136. }
  1137. }
  1138. .scoll-name {
  1139. height: 80rpx;
  1140. width: 227rpx;
  1141. font-size: 22rpx;
  1142. padding: 15rpx 15rpx;
  1143. }
  1144. .price-list {
  1145. padding: 25rpx 15rpx;
  1146. padding-right: 25rpx;
  1147. .tpl {
  1148. .red-price {
  1149. color: #f31d29;
  1150. text {
  1151. font-size: 35rpx !important;
  1152. font-weight: bold;
  1153. }
  1154. }
  1155. .grey-price {
  1156. text-decoration: line-through;
  1157. color: #999999;
  1158. font-size: 10px !important;
  1159. }
  1160. }
  1161. .img {
  1162. width: 45rpx;
  1163. height: 45rpx;
  1164. image {
  1165. width: 100%;
  1166. height: 100%;
  1167. }
  1168. }
  1169. }
  1170. }
  1171. }
  1172. }
  1173. /* 评价 */
  1174. .eva-section {
  1175. display: flex;
  1176. flex-direction: column;
  1177. padding: 20rpx 30rpx;
  1178. background: #fff;
  1179. margin-top: 16rpx;
  1180. .e-header {
  1181. display: flex;
  1182. align-items: center;
  1183. height: 70rpx;
  1184. font-size: $font-sm + 2rpx;
  1185. color: $font-color-light;
  1186. .tit {
  1187. font-size: $font-base + 2rpx;
  1188. color: $font-color-dark;
  1189. margin-right: 4rpx;
  1190. }
  1191. .tip {
  1192. flex: 1;
  1193. text-align: right;
  1194. }
  1195. .iconenter {
  1196. margin-left: 10rpx;
  1197. }
  1198. }
  1199. }
  1200. .eva-box {
  1201. display: flex;
  1202. padding: 20rpx 0;
  1203. .portrait {
  1204. flex-shrink: 0;
  1205. width: 80rpx;
  1206. height: 80rpx;
  1207. border-radius: 100px;
  1208. }
  1209. .right {
  1210. flex: 1;
  1211. display: flex;
  1212. flex-direction: column;
  1213. font-size: $font-base;
  1214. color: $font-color-base;
  1215. padding-left: 26rpx;
  1216. .con {
  1217. font-size: $font-base;
  1218. color: $font-color-dark;
  1219. padding: 20rpx 0;
  1220. }
  1221. .bot {
  1222. display: flex;
  1223. justify-content: space-between;
  1224. font-size: $font-sm;
  1225. color: $font-color-light;
  1226. }
  1227. }
  1228. }
  1229. .con_image {
  1230. width: 130rpx;
  1231. height: 130rpx;
  1232. display: inline-block;
  1233. padding: 15rpx;
  1234. image {
  1235. width: 100%;
  1236. height: 100%;
  1237. }
  1238. }
  1239. /* 详情 */
  1240. .detail-desc {
  1241. background: #fff;
  1242. /deep/ img {
  1243. max-width: 100% !important;
  1244. display: inline !important;
  1245. }
  1246. /deep/ div {
  1247. max-width: 100% !important;
  1248. }
  1249. .d-header {
  1250. display: flex;
  1251. justify-content: center;
  1252. align-items: center;
  1253. height: 80rpx;
  1254. font-size: $font-base + 2rpx;
  1255. color: $font-color-dark;
  1256. position: relative;
  1257. text {
  1258. padding: 0 20rpx;
  1259. background: #fff;
  1260. position: relative;
  1261. z-index: 1;
  1262. }
  1263. &:after {
  1264. position: absolute;
  1265. left: 50%;
  1266. top: 50%;
  1267. transform: translateX(-50%);
  1268. width: 300rpx;
  1269. height: 0;
  1270. content: '';
  1271. border-bottom: 1px solid #ccc;
  1272. }
  1273. }
  1274. }
  1275. /* 规格选择弹窗 */
  1276. .attr-content {
  1277. padding: 10rpx 30rpx;
  1278. .a-t {
  1279. display: flex;
  1280. image {
  1281. width: 170rpx;
  1282. height: 170rpx;
  1283. flex-shrink: 0;
  1284. margin-top: -40rpx;
  1285. border-radius: 8rpx;
  1286. }
  1287. .right {
  1288. display: flex;
  1289. flex-direction: column;
  1290. padding-left: 24rpx;
  1291. font-size: $font-sm + 2rpx;
  1292. color: $font-color-base;
  1293. line-height: 42rpx;
  1294. .price {
  1295. font-size: $font-lg;
  1296. color: $uni-color-primary;
  1297. margin-bottom: 10rpx;
  1298. }
  1299. .selected-text {
  1300. margin-right: 10rpx;
  1301. }
  1302. }
  1303. }
  1304. .attr-list {
  1305. display: flex;
  1306. flex-direction: column;
  1307. font-size: $font-base + 2rpx;
  1308. color: $font-color-base;
  1309. padding-top: 30rpx;
  1310. padding-left: 10rpx;
  1311. }
  1312. .item-list {
  1313. padding: 20rpx 0 0;
  1314. display: flex;
  1315. flex-wrap: wrap;
  1316. text {
  1317. display: flex;
  1318. align-items: center;
  1319. justify-content: center;
  1320. background: #eee;
  1321. margin-right: 20rpx;
  1322. margin-bottom: 20rpx;
  1323. border-radius: 100rpx;
  1324. min-width: 60rpx;
  1325. height: 60rpx;
  1326. padding: 0 20rpx;
  1327. font-size: $font-base;
  1328. color: $font-color-dark;
  1329. }
  1330. .selected {
  1331. background: #fbebee;
  1332. color: $uni-color-primary;
  1333. }
  1334. }
  1335. }
  1336. /* 弹出层 */
  1337. .popup {
  1338. position: fixed;
  1339. left: 0;
  1340. top: 0;
  1341. right: 0;
  1342. bottom: 0;
  1343. z-index: 99;
  1344. &.show {
  1345. display: block;
  1346. .mask {
  1347. animation: showPopup 0.2s linear both;
  1348. }
  1349. .layer {
  1350. animation: showLayer 0.2s linear both;
  1351. }
  1352. }
  1353. &.hide {
  1354. .mask {
  1355. animation: hidePopup 0.2s linear both;
  1356. }
  1357. .layer {
  1358. animation: hideLayer 0.2s linear both;
  1359. }
  1360. }
  1361. &.none {
  1362. display: none;
  1363. }
  1364. .mask {
  1365. position: fixed;
  1366. top: 0;
  1367. width: 100%;
  1368. height: 100%;
  1369. z-index: 1;
  1370. background-color: rgba(0, 0, 0, 0.4);
  1371. }
  1372. .layer {
  1373. position: fixed;
  1374. z-index: 99;
  1375. bottom: 0;
  1376. width: 100%;
  1377. min-height: 30vh;
  1378. border-radius: 10rpx 10rpx 0 0;
  1379. background-color: #fff;
  1380. .btn {
  1381. height: 66rpx;
  1382. line-height: 66rpx;
  1383. border-radius: 100rpx;
  1384. background: $uni-color-primary;
  1385. font-size: $font-base + 2rpx;
  1386. color: #fff;
  1387. margin: 30rpx auto 20rpx;
  1388. }
  1389. }
  1390. @keyframes showPopup {
  1391. 0% {
  1392. opacity: 0;
  1393. }
  1394. 100% {
  1395. opacity: 1;
  1396. }
  1397. }
  1398. @keyframes hidePopup {
  1399. 0% {
  1400. opacity: 1;
  1401. }
  1402. 100% {
  1403. opacity: 0;
  1404. }
  1405. }
  1406. @keyframes showLayer {
  1407. 0% {
  1408. transform: translateY(120%);
  1409. }
  1410. 100% {
  1411. transform: translateY(0%);
  1412. }
  1413. }
  1414. @keyframes hideLayer {
  1415. 0% {
  1416. transform: translateY(0);
  1417. }
  1418. 100% {
  1419. transform: translateY(120%);
  1420. }
  1421. }
  1422. }
  1423. /* 底部操作菜单 */
  1424. .page-bottom {
  1425. position: fixed;
  1426. bottom: 0rpx;
  1427. z-index: 95;
  1428. display: flex;
  1429. justify-content: center;
  1430. align-items: center;
  1431. width: 750rpx;
  1432. height: 120rpx;
  1433. background-color: #ffffff;
  1434. // box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.5);
  1435. // border-radius: 16rpx;
  1436. .p-b-btn {
  1437. display: flex;
  1438. flex-direction: column;
  1439. align-items: center;
  1440. justify-content: center;
  1441. font-size: $font-sm;
  1442. color: $font-color-base;
  1443. width: 96rpx;
  1444. height: 80rpx;
  1445. .iconfont {
  1446. font-size: 40rpx;
  1447. line-height: 48rpx;
  1448. color: $font-color-light;
  1449. }
  1450. &.active,
  1451. &.active .iconfont {
  1452. color: $uni-color-primary;
  1453. }
  1454. .icon-fenxiang2 {
  1455. font-size: 42rpx;
  1456. transform: translateY(-2rpx);
  1457. }
  1458. .iconlikefill {
  1459. font-size: 46rpx;
  1460. }
  1461. image {
  1462. width: 56rpx;
  1463. height: 58rpx;
  1464. }
  1465. }
  1466. .action-btn-group {
  1467. display: flex;
  1468. height: 76rpx;
  1469. border-radius: 100px;
  1470. overflow: hidden;
  1471. margin-left: 20rpx;
  1472. position: relative;
  1473. &:after {
  1474. content: '';
  1475. position: absolute;
  1476. top: 50%;
  1477. right: 50%;
  1478. transform: translateY(-50%);
  1479. height: 28rpx;
  1480. width: 0;
  1481. border-right: 1px solid rgba(255, 255, 255, 0.5);
  1482. }
  1483. .action-btn {
  1484. display: flex;
  1485. align-items: center;
  1486. justify-content: center;
  1487. width: 270rpx;
  1488. height: 100%;
  1489. font-size: $font-base;
  1490. padding: 0;
  1491. border-radius: 0;
  1492. background: transparent;
  1493. &.buy-now-btn {
  1494. background-color: #303e49;
  1495. }
  1496. &.add-cart-btn {
  1497. background-color: $base-color;
  1498. }
  1499. }
  1500. }
  1501. }
  1502. </style>