product01.vue 30 KB

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