You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1994 lines
46 KiB

6 months ago
  1. <template>
  2. <view class="container" id="productPage">
  3. <jumpBall :start.sync="num" :element.sync="element" @msg="jbMsg" :speed="animaTime" :index="9999"/>
  4. <!-- 滑动图片 -->
  5. <view class="carousel">
  6. <swiper indicator-dots circular=true duration="400">
  7. <swiper-item class="swiper-item" v-for="(item,index) in goodsInfoData.img" :key="index" @click="previewImg(item,goodsInfoData.img)">
  8. <view class="image-wrapper">
  9. <image
  10. :src="item"
  11. class="loaded"
  12. mode="aspectFill"
  13. ></image>
  14. </view>
  15. </swiper-item>
  16. </swiper>
  17. </view>
  18. <view class="container-box introduce-section" >
  19. <text class="title">{{ goodsInfoData.mc }}</text>
  20. <view class="tag-box">
  21. <text class="tag-item">{{goodsInfoData.gg}}</text>
  22. </view>
  23. <!-- <view class="bot-row"> -->
  24. <!-- <text>月售{{ goodsInfoData.monthly_sales ? goodsInfoData.monthly_sales : 0 }}</text> -->
  25. <!-- <text>售量: {{ goodsInfoData.sellnum ? goodsInfoData.sellnum : 0 }}</text> -->
  26. <!-- <text>库存: {{goodsInfoData.kcnum}}</text> -->
  27. <!-- <text>浏览量: 768</text> -->
  28. <!-- </view> -->
  29. <!-- <text class="sdtext">{{goodsInfoData.sdtext}}</text> -->
  30. </view>
  31. <view class="container-box shopping-cart" :class="{'barBorder':showBorder}">
  32. <view class="price-box" >
  33. <text class="price-tip" v-if="price>0">¥</text>
  34. <text class="price" v-if="price>0">{{ price }}</text>
  35. <text class="price" v-else></text>
  36. <text class="dw">{{goodsInfoData.dw}}</text>
  37. <!-- 显示原价打折 -->
  38. <!-- <block v-if="goodsInfoData.oldprice != 0 && goodsInfoData.oldprice > goodsInfoData.price">
  39. <text class="m-price" >¥{{ goodsInfoData.oldprice }}</text>
  40. <text class="coupon-tip" >{{(goodsInfoData.price/goodsInfoData.oldprice * 10).toFixed(1)}}</text>
  41. </block> -->
  42. </view>
  43. <!-- <view class="add-btn" v-if="goodsInfoData.kcnum" @click="addGoodsChange(1,goodsInfoData,true)">
  44. <i class="hxicon icon-add" id="eleAdd"></i>
  45. <text>加入购物车</text>
  46. </view> -->
  47. <view class="spbz" v-if="goodsInfoData.inputnum">
  48. <input style="font-size: 28upx;color: #41A863;" type="text" :value="goodsInfoData.bz" @input="inputchangeBz($event,goodsInfoData.bz,goodsInfoData.id)" placeholder="输入备注">
  49. <input style="font-size: 28upx;color: #41A863;" type="text" :value="goodsInfoData.fudw" @input="inputchangeFudw($event,goodsInfoData.fudw,goodsInfoData.id)" placeholder="输入副单位">
  50. </view>
  51. <view class="number" v-if="goodsInfoData.kcnum">
  52. <view class="sub" @tap.stop="sub(goodsInfoData.id)" >
  53. <view class="jian">-</view>
  54. </view>
  55. <view class="input" @tap.stop="discard" >
  56. <input type="digit" v-model="goodsInfoData.inputnum==0?'':goodsInfoData.inputnum" @input="inputchange($event,goodsInfoData.inputnum,goodsInfoData.id,goodsInfoData.kcnum,0)" />
  57. </view>
  58. <view class="add" @tap.stop="add(goodsInfoData.id)">
  59. <view class="jia">
  60. <image src="../../static/img/addicon.png"></image>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="line-weight"></view>
  66. <!-- <view class="c-list">
  67. <view class="c-row b-b" @click="toggleSpec">
  68. <text class="tit">规格选择</text>
  69. <view class="con">
  70. <text class="selected-text" v-for="(sItem, sIndex) in specSelected" :key="sIndex">
  71. {{sItem.name}}
  72. </text>
  73. </view>
  74. <text class="hxicon icon-right"></text>
  75. </view>
  76. </view> -->
  77. <view class="line-weight"></view>
  78. <!-- 详情 -->
  79. <view class="container-box">
  80. <view class="tabs-box" >
  81. <view class="" style="width: 210px;height: 100%;">
  82. <view class="hx-tabs">
  83. <view class="hx-tabs-item" v-for="(item,i) in tabs" :key="i" :class="{'hx-tabs-active': swiperCurrent == i}" @click="swiperChange(i,item.id)" >
  84. <text>{{item.name}}</text>
  85. </view>
  86. <view class="hx-tabs-slider-box" :style="{left:swiperCurrentSliderLeft + 'px'}">
  87. <view class="hx-tabs-slider"></view>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="info-box" id="detail">
  93. <view class="info-item" v-for="(item,i) in goodsInfoData.detail" :key="i">
  94. <text class="left">{{item.tit}}</text>
  95. <text class="right">{{item.txt}}</text>
  96. </view>
  97. </view>
  98. </view>
  99. <view class="line-weight"></view>
  100. <view class="detail-desc" id="coll">
  101. <view class="d-header">
  102. <text>图文详情</text>
  103. </view>
  104. <rich-text :nodes="goodsInfoData.cpdesc"></rich-text>
  105. </view>
  106. <!-- 购物车 -->
  107. <view class="foot" @touchmove.stop.prevent="mpClear" :style="{height: footHeight}" v-if="showFoot">
  108. <view class="zz" @click="hideShoppingCar"></view>
  109. <view class="btn-box">
  110. <view class="btn-box-left" @click="contact">
  111. <view class="imgBox">
  112. <image src="../../static/img/boss.png" mode=""></image>
  113. </view>
  114. <text>返回首页</text>
  115. </view>
  116. <view class="btn-box-line"></view>
  117. <view class="btn-box-center" @click="showShoppingCar">
  118. <view class="cart" :animation="cartAnimationData">
  119. <view class="tag cartNum" v-if="goodsTotalNumber>0">{{goodsTotalNumber}}</view>
  120. <image :src="goodsTotalNumber ? '/static/img/cart.png' : '/static/img/cart1.png'" mode=""></image>
  121. </view>
  122. <view class="priceBox">
  123. <view class="hx-txt-18 hx-color-white" v-if="goodsTotalPrice>0">
  124. {{goodsTotalPrice|toFixed}}
  125. </view>
  126. <!-- <view class="hx-txt-10 hx-color-gray">
  127. 另需配送费{{shippingDees}}
  128. </view> -->
  129. </view>
  130. </view>
  131. <view class="btn-box-right">
  132. <view class="jiesuan" v-if="goodsTotalPrice>0 && goodsTotalPrice >= startingPrice" @click="jiesuan">
  133. 去结算
  134. </view>
  135. <view class="pscj hx-txt-10 hx-color-gray" v-else>
  136. <!-- <text v-if="startingPrice>=0">{{-(goodsTotalPrice-startingPrice)|toFixed}}起送</text> -->
  137. </view>
  138. </view>
  139. </view>
  140. <view class="cart-box" :style="{display: showCar ? 'flex' : 'none'}">
  141. <view class="box-container rebate-box" v-if="showDiscount">
  142. <text>已加购列表</text>
  143. </view>
  144. <view class="box-container operating-box">
  145. <view class="operating-box_right">
  146. </view>
  147. <view class="operating-box_left clear" @click="clearShoppingCart">
  148. <i class="hxicon icon-delete"></i>
  149. <text>清空购物车</text>
  150. </view>
  151. </view>
  152. <view class=" goods-box">
  153. <view class="" style="flex: 1;">
  154. <scroll-view scroll-y="true" class="goods-list-scroll" :scroll-top="carGoodsScrollTop">
  155. <view class="goods-list">
  156. <view class="box" v-for="(rowData,i) in shoppCart" :key="i" v-if="rowData.num>0">
  157. <view class="m-store-item">
  158. <view class="m-img">
  159. <image style="width: 100%;height: 100%;" :src="rowData.img" mode="aspectFit"></image>
  160. </view>
  161. <view class="m-text">
  162. <view class="m-title">
  163. {{rowData.mc}}
  164. </view>
  165. <view class="m-descripe">
  166. {{rowData.miaos}}
  167. </view>
  168. <view class="m-price-box" >
  169. <view class="symbol"></view>
  170. <view class="m-price">{{rowData.price}}</view>
  171. <view class="m-old-price" v-if="rowData.oldprice">
  172. <text>{{rowData.oldprice}}</text>
  173. </view>
  174. </view>
  175. <view class="m-distance" >
  176. <view :class="'addEle2_' + i" class="jumpPosition">
  177. </view>
  178. <hx-number-box @change="addGoodsChange" :value="rowData.num" :rowData="rowData" :disabled="disabled" :clickTime="400" @addChange="touchOnAddGoods('.addEle2_' + i,rowData)"></hx-number-box>
  179. </view>
  180. </view>
  181. </view>
  182. </view>
  183. </view>
  184. </scroll-view>
  185. </view>
  186. </view>
  187. </view>
  188. </view>
  189. <hx-preview-img :list.sync="previewImgList" :current.sync="currentImg" :start.sync="PINum"></hx-preview-img>
  190. </view>
  191. </template>
  192. <script>
  193. import jumpBall from '@/components/hx-jump-ball/hx-jump-ball.vue';
  194. import hxNumberBox from "@/components/uni-number-box/uni-number-box.vue";
  195. import hxPreviewImg from "@/components/hx-preview-img/hx-preview-img.vue";
  196. //引入测试数据
  197. import testData from "@/common/testdata.js";
  198. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  199. export default{
  200. components: {
  201. hxNumberBox,
  202. jumpBall,
  203. hxPreviewImg
  204. },
  205. data() {
  206. return {
  207. specClass: 'none',
  208. specSelected:[],
  209. //tabs
  210. tabs: [
  211. {name:'详情',id: 'detail'},
  212. {name:'图文',id: 'coll'},
  213. ],
  214. swiperCurrent: 0,
  215. swiperCurrentSliderLeft: 0,
  216. showRing: true,
  217. showTabs: true,
  218. showBorder: false,
  219. favorite: true,
  220. //小球动画
  221. num:1,
  222. element: [],
  223. animaTime: 300,
  224. cartAnimation: {},
  225. cartAnimationData: {},
  226. //购物车
  227. shoppingCartAll:[],
  228. //商家信息
  229. storeData: [],
  230. //显示购物车
  231. showFoot:true,
  232. //配送费
  233. shippingDees: 0,
  234. //配送起步价
  235. startingPrice:0,
  236. //购物车商品价格合计
  237. goodsTotalPrice: 0,
  238. //购物车商品数量合计
  239. goodsTotalNumber: 0,
  240. //购物车
  241. shoppCart: [],
  242. //foot 高度
  243. footHeight: '0',
  244. //显示购物车
  245. showCar: false,
  246. //购物车中商品滚动条位置
  247. carGoodsScrollTop: 0,
  248. //购物车缓存 Storage 名称
  249. shoppingCartStorageName: 'cartlist',
  250. //购物车显示折扣
  251. showDiscount:true,
  252. //商品信息
  253. goodsInfoData: {},
  254. //商品评价
  255. goodsEvaData: {},
  256. currentImg: '',
  257. previewImgList: [],
  258. PINum: 0,
  259. specList: [
  260. {id: 1, name: '尺寸',},
  261. {id: 2, name: '颜色',},
  262. ],
  263. specChildList: [
  264. {id: 1, pid: 1, name: 'XS',},
  265. {id: 2, pid: 1, name: 'S',},
  266. {id: 3, pid: 1, name: 'M',},
  267. {id: 4,pid: 1,name: 'L',},
  268. {id: 5,pid: 1,name: 'XL',},
  269. {id: 6,pid: 1,name: 'XXL',},
  270. {id: 7,pid: 2,name: '白色',},
  271. {id: 8,pid: 2,name: '珊瑚粉',},
  272. {id: 9,pid: 2,name: '草木绿',},
  273. ],
  274. gid:0,
  275. price:'',///传过来的价格
  276. };
  277. },
  278. onShow(){
  279. this.init();
  280. },
  281. filters: {
  282. toFixed:function(x) {
  283. return parseFloat(x).toFixed(2);
  284. }
  285. },
  286. async onLoad(options){
  287. let that = this;
  288. //接收传值,id里面放的是商品id
  289. this.gid = options.gid;
  290. this.price=options.price;
  291. uni.showLoading({
  292. title: '加载中'
  293. });
  294. this.gooddetail(this.gid)
  295. //规格 默认选中第一条
  296. this.specList.forEach(item=>{
  297. for(let cItem of this.specChildList){
  298. if(cItem.pid === item.id){
  299. this.$set(cItem, 'selected', true);
  300. this.specSelected.push(cItem);
  301. break; //forEach不能使用break
  302. }
  303. }
  304. })
  305. this.cartAnimation = uni.createAnimation({
  306. duration: 800,
  307. timingFunction: "ease",
  308. delay: 0
  309. });
  310. let userinfo=uni.getStorageSync('userinfo');
  311. this.add_read_record(this.gid,userinfo.uid);
  312. },
  313. filters: {
  314. toFixed:function(x) {
  315. return parseFloat(x).toFixed(2);
  316. }
  317. },
  318. methods:{
  319. //减操作
  320. sub(id) {
  321. let getcartlist = uni.getStorageSync('cartlist');
  322. let isexit = this.findidfromstor(id);
  323. for (let i = 0; i < getcartlist.length; i++) {
  324. if (isexit.id == getcartlist[i].id) { //找到商品一样的商品
  325. getcartlist[i].num--; //数量减
  326. if (getcartlist[i].num <= 0) {
  327. //删除当前商品缓存
  328. getcartlist.splice(i, 1);
  329. uni.setStorageSync('cartlist', getcartlist)
  330. break; //跳出循环
  331. } else {
  332. getcartlist[i].total = parseFloat((getcartlist[i].num * getcartlist[i].price) * 100) / 100
  333. uni.setStorageSync('cartlist', getcartlist)
  334. break; //跳出循环
  335. }
  336. }
  337. }
  338. this.checkshownum();
  339. },
  340. // 增加数量,type 0-推荐商品,1-猜你喜欢商品
  341. add(id) {
  342. let getcartlist = uni.getStorageSync('cartlist');
  343. //首次加购物车
  344. if (getcartlist == '') {
  345. let setcart=[];
  346. setcart[0]=this.goodsInfoData;
  347. //计算每个商品的总价格
  348. setcart.map((item, index) => {
  349. item.total = parseFloat((item.price * item.num) * 100) / 100
  350. });
  351. uni.setStorageSync('cartlist', setcart);
  352. } else {
  353. //已有商品在购物车
  354. let isexit = this.findidfromstor(id);
  355. if (!isexit) {
  356. //购物车中还没当前商品
  357. //不存在
  358. getcartlist.push(this.goodsInfoData);
  359. for (let i = 0; i < getcartlist.length; i++) {
  360. if (id == getcartlist[i].id) {
  361. getcartlist[i].total = parseFloat((getcartlist[i].num * getcartlist[i].price) * 100) / 100
  362. }
  363. }
  364. uni.setStorageSync('cartlist', getcartlist);
  365. } else {
  366. //存在
  367. for (let i = 0; i < getcartlist.length; i++) {
  368. if (isexit.id == getcartlist[i].id) { //找到商品一样的商品
  369. getcartlist[i].num++; //数量自增
  370. if (getcartlist[i].num > getcartlist[i].kcnum) {
  371. uni.showToast({
  372. title: '库存不足!',
  373. icon: 'none'
  374. })
  375. break; //跳出循环
  376. } else {
  377. getcartlist[i].total = parseFloat((getcartlist[i].num * getcartlist[i].price) * 100) / 100
  378. uni.setStorageSync('cartlist', getcartlist)
  379. break; //跳出循环
  380. }
  381. }
  382. }
  383. }
  384. }
  385. this.checkshownum();
  386. //更新本地储存
  387. },
  388. // input框直接加入购物车
  389. inputadd(id, type,inputnum) {
  390. let getcartlist = uni.getStorageSync('cartlist');
  391. //首次加购物车
  392. if (getcartlist == '') {
  393. let goodsLists=[];
  394. goodsLists[0]=this.goodsInfoData;
  395. //计算每个商品的总价格
  396. goodsLists.map((item, index) => {
  397. item.total = parseFloat((item.price * inputnum) * 100) / 100;
  398. item.num = parseFloat(inputnum);
  399. });
  400. uni.setStorageSync('cartlist', goodsLists);
  401. } else {
  402. //已有商品在购物车
  403. let isexit = this.findidfromstor(id);
  404. if (!isexit) {
  405. //购物车中还没当前商品
  406. //不存在
  407. this.$set(this.goodsInfoData, 'inputnum', inputnum);
  408. getcartlist.push(this.goodsInfoData);
  409. for (let i = 0; i < getcartlist.length; i++) {
  410. if (id == getcartlist[i].id) {
  411. getcartlist[i].num=inputnum;
  412. getcartlist[i].total = parseFloat((getcartlist[i].num * getcartlist[i].price) * 100) / 100
  413. }
  414. }
  415. uni.setStorageSync('cartlist', getcartlist);
  416. } else {
  417. //存在
  418. for (let i = 0; i < getcartlist.length; i++) {
  419. if (isexit.id == getcartlist[i].id) { //找到商品一样的商品
  420. getcartlist[i].num=inputnum; //数量自增
  421. if (getcartlist[i].num > getcartlist[i].kcnum) {
  422. uni.showToast({
  423. title: '库存不足!',
  424. icon: 'none'
  425. })
  426. break; //跳出循环
  427. } else {
  428. getcartlist[i].total = parseFloat((getcartlist[i].num * getcartlist[i].price) * 100) / 100
  429. uni.setStorageSync('cartlist', getcartlist)
  430. break; //跳出循环
  431. }
  432. }
  433. }
  434. }
  435. }
  436. this.checkshownum();
  437. },
  438. inputchange(inputsl,inputnum, id, kcnum,type) {
  439. inputnum=parseFloat(inputsl.detail.value);
  440. let getcartlist = uni.getStorageSync('cartlist');
  441. if (inputnum > 0) {
  442. if (inputnum > kcnum) {
  443. uni.showToast({
  444. title: '库存不足',
  445. icon: 'none'
  446. })
  447. return;
  448. }
  449. this.inputadd(id,type,inputnum);//input框直接添加购物车
  450. } else {
  451. for (let i = 0; i < getcartlist.length; i++) {
  452. if (id == getcartlist[i].id) { //找到商品一样的商品
  453. getcartlist[i].num = 0;
  454. uni.setStorageSync('cartlist', getcartlist)
  455. break; //跳出循环
  456. }
  457. }
  458. this.checkshownum();
  459. }
  460. },
  461. inputchangeBz(inputsl,inputnum, id) {
  462. inputnum=inputsl.detail.value;
  463. let getcartlist = uni.getStorageSync('cartlist');
  464. for (let i = 0; i < getcartlist.length; i++) {
  465. if (id == getcartlist[i].id) { //找到商品一样的商品
  466. getcartlist[i].bz = inputnum;
  467. uni.setStorageSync('cartlist', getcartlist)
  468. break; //跳出循环
  469. }
  470. }
  471. this.shoppCart=getcartlist;
  472. },
  473. inputchangeFudw(inputsl,inputnum, id) {
  474. inputnum=inputsl.detail.value;
  475. let getcartlist = uni.getStorageSync('cartlist');
  476. for (let i = 0; i < getcartlist.length; i++) {
  477. if (id == getcartlist[i].id) { //找到商品一样的商品
  478. getcartlist[i].fudw = inputnum;
  479. uni.setStorageSync('cartlist', getcartlist)
  480. break; //跳出循环
  481. }
  482. }
  483. this.shoppCart=getcartlist;
  484. },
  485. //初始化购物车数据
  486. checkshownum() {
  487. this.goodsTotalNumber=0;
  488. this.goodsTotalPrice=0;
  489. this.$set(this.goodsInfoData, 'inputnum', 0)
  490. let getcartlist = uni.getStorageSync('cartlist');
  491. for (let i = 0; i < getcartlist.length; i++) {
  492. if(this.goodsInfoData.id==getcartlist[i]['id']){
  493. this.$set(this.goodsInfoData, 'inputnum', getcartlist[i]['num'])
  494. this.$set(this.goodsInfoData, 'bz', getcartlist[i]['bz'])
  495. this.$set(this.goodsInfoData, 'fudw', getcartlist[i]['fudw'])
  496. }
  497. if(getcartlist[i]['num']<=0){
  498. getcartlist.splice(i, 1);
  499. break;
  500. }else{
  501. //计算商品总价
  502. this.goodsTotalPrice +=parseFloat(getcartlist[i].total*100)/100 ;
  503. //商品总数量
  504. this.goodsTotalNumber += parseInt(getcartlist[i].num)
  505. }
  506. }
  507. uni.setStorageSync('cartlist', getcartlist)
  508. this.shoppCart=getcartlist;
  509. },
  510. //从本地存储中根据id获取数组
  511. findidfromstor(id){
  512. let arr=uni.getStorageSync('cartlist');
  513. for(let i=0;i<arr.length;i++){
  514. if(arr[i]['id']==id){
  515. return arr[i];
  516. break;//跳出循环
  517. }
  518. }
  519. },
  520. //添加浏览记录
  521. async add_read_record(id,uid) {
  522. await this.$api.add_read_record({action:'add_read_record',cpid:id,uid:uid});
  523. },
  524. async gooddetail(gid) {
  525. let reinfo=await this.$api.gooddetail({action:'gooddetail',gid:gid});
  526. this.goodsInfoData=reinfo.data;
  527. this.$set(this.goodsInfoData, 'price', this.price)
  528. this.checkshownum();
  529. this.startingPrice=reinfo.data.lessmoney;
  530. // this.init();
  531. uni.hideLoading();
  532. },
  533. async checkkc() {
  534. let that = this;
  535. let carts = uni.getStorageSync(that.shoppingCartStorageName) || [];
  536. // that.goodsTotalNumber=0;
  537. let gids='';
  538. for(let i in carts){
  539. gids=gids+','+carts[i].id;
  540. }
  541. gids=gids.substr(1);
  542. let userinfo=uni.getStorageSync('userinfo');
  543. let reinfo=await this.$api.checkkc({action:'checkkc',gids:gids,uid:userinfo.uid});
  544. let getcheckarr=reinfo.data;
  545. if(getcheckarr){
  546. for(let i=0;i<getcheckarr.length;i++){
  547. for(let j=0;j<carts.length;j++){
  548. if(getcheckarr[i].id==carts[j].id){
  549. this.$set(carts[j],'kucun',getcheckarr[i].kucun);
  550. this.$set(carts[j], 'price', getcheckarr[i].price);
  551. this.$set(carts[j], 'total', getcheckarr[i].price*carts[i].num);
  552. }
  553. }
  554. }
  555. }
  556. //根据缓存数据 获取购物车中属于本商店的商品
  557. that.shoppCart=carts;
  558. that.goodsTotalPrice=0;
  559. for(let i in that.shoppCart){
  560. if(that.shoppCart[i].num>0){
  561. //计算商品总价
  562. that.goodsTotalPrice +=parseFloat(that.shoppCart[i].total*100)/100 ;
  563. //商品总数量
  564. // that.goodsTotalNumber += parseInt(that.shoppCart[i].num)
  565. }
  566. }
  567. //初始化起步价和配送费
  568. //that.startingPrice = 0;
  569. that.shippingDees = 0;
  570. that.setLabelNumber();
  571. },
  572. init(){
  573. this.checkkc();
  574. },
  575. //返回
  576. backPage(){
  577. var pages = getCurrentPages().length;
  578. //console.log(pages);
  579. if(pages == 1){
  580. // uni.switchTab({
  581. // url: '/pages/index/index'
  582. // });
  583. uni.redirectTo({
  584. url: '/pages/index/index'
  585. });
  586. }else{
  587. uni.navigateBack();
  588. }
  589. },
  590. //tab 事件
  591. swiperChange(index,idName) {
  592. this.swiperCurrent = index;
  593. this.swiperCurrentSliderLeft= 70 * index;
  594. //滚动至指定位置
  595. //最终位置 = 目标节点坐标 - 目标节点坐标 - 状态栏高度 - 导航栏高度44 - 价格栏高度
  596. let view = uni.createSelectorQuery().select("#productPage");
  597. view.boundingClientRect(data => {
  598. let view2 = uni.createSelectorQuery().select("#" + idName);
  599. view2.boundingClientRect(data2 => {
  600. let view3 = uni.createSelectorQuery().select(".shopping-cart");
  601. view3.fields({
  602. size: true
  603. }, res => {
  604. uni.pageScrollTo({
  605. duration:300,
  606. scrollTop:data2.top - data.top - statusBarHeight - 44 - res.height
  607. })
  608. }).exec();
  609. }).exec();
  610. }).exec();
  611. },
  612. //导航栏滑动时的操作
  613. navbarScroll(scroll){
  614. let top = scroll.scrollTop
  615. let that = this
  616. this.pageScrollTop = scroll.scrollTop
  617. let view = uni.createSelectorQuery().select(".shopping-cart");
  618. view.fields({
  619. rect: true
  620. }, data => {
  621. if(data.top - statusBarHeight<= 44){
  622. that.showBorder = true;
  623. }else{
  624. that.showBorder = false;
  625. }
  626. }).exec();
  627. if(top < 120){
  628. that.showRing = true;
  629. }else{
  630. that.showRing = false;
  631. this.navSearchBgOpacity = 1
  632. this.navSearchColor = '#888888'
  633. }
  634. },
  635. mpClear(e) {
  636. // TODO nvue 取消冒泡
  637. e.stopPropagation()
  638. },
  639. //显示购物车
  640. showShoppingCar(){
  641. if(this.goodsTotalNumber == 0){
  642. return;
  643. }
  644. this.footHeight = '100%';
  645. this.showCar = true;
  646. this.carGoodsScrollTop = 0;
  647. },
  648. //隐藏购物车
  649. hideShoppingCar(){
  650. this.footHeight = '0';
  651. this.showCar = false;
  652. },
  653. //清空购物车
  654. clearShoppingCart(){
  655. let that = this;
  656. uni.showModal({
  657. title: '温馨提示',
  658. content: '是否清空购物车?',
  659. success: function (res) {
  660. if (res.confirm) {
  661. that.shoppCart = [];
  662. that.storeData.shoppingCart = [];
  663. for(let i in that.shoppingCartAll){
  664. if(that.shoppingCartAll[i].storeId == that.storeData.storeId){
  665. that.shoppingCartAll[i] = that.storeData
  666. }
  667. }
  668. uni.setStorageSync(that.shoppingCartStorageName,that.shoppingCartAll);
  669. for(let i in that.goodsList){
  670. that.goodsList[i].number = 0;
  671. }
  672. for(let i in that.categoryList){
  673. that.categoryList[i].number = 0;
  674. }
  675. //购物车商品价格合计
  676. that.goodsTotalPrice = 0;
  677. //购物车商品数量合计
  678. that.goodsTotalNumber = 0;
  679. that.hideShoppingCar();
  680. } else if (res.cancel) {
  681. console.log('用户点击取消');
  682. }
  683. }
  684. });
  685. },
  686. //增加商品后的回调事件
  687. touchOnAddGoods(ele,data){
  688. this.element = [ele,'.cart'];
  689. if(this.num<0){
  690. uni.showToast({
  691. title:'库存0'
  692. })
  693. }
  694. this.num ++;
  695. },
  696. //新增商品计算价格
  697. addGoodsChange(number,dataArr,status){
  698. number = Number(number)
  699. var that = this;
  700. let shoppCart = this.shoppCart;
  701. let totalPrice = 0;
  702. let totalNumber = 0;
  703. let existedGoods = false;
  704. //console.log(shoppCart,'当前shoppcart')
  705. let rowData = {
  706. id: dataArr.id,
  707. mc: dataArr.mc,
  708. miaos: dataArr.miaos,
  709. img: dataArr.img[0],
  710. price: this.price,
  711. num:dataArr.num,
  712. gg:dataArr.gg,
  713. kcnum:dataArr.kcnum
  714. }
  715. var yes=0;//控制加入购物车小球
  716. //检查该商品是否为第一次添加,如果为第二次添加,则直接修改商品数量,并计算出合计
  717. for(var i in shoppCart){
  718. //非第一次添加
  719. if(shoppCart[i].id == rowData.id){
  720. //如果为加入购物车则为叠加
  721. if(status){
  722. number = shoppCart[i].num + number
  723. }
  724. if(this.goodsInfoData.kcnum<number){
  725. uni.showToast({
  726. title:'库存不足!',
  727. icon:'none'
  728. });
  729. yes=1;
  730. break;
  731. }
  732. shoppCart[i].num = rowData.num = number;
  733. shoppCart[i].total =parseFloat((number * shoppCart[i].price)*100)/100;
  734. existedGoods = true;
  735. break;
  736. }
  737. }
  738. if(yes==0){
  739. //点击添加购物车时生效
  740. if(status){
  741. that.element = ['#eleAdd','.cart'];
  742. that.num ++;
  743. }
  744. //第一次添加
  745. if(!existedGoods){
  746. rowData.num = number;
  747. rowData.total =parseFloat((number * rowData.price)*100)/100
  748. shoppCart.push(rowData);
  749. }
  750. console.log(shoppCart);
  751. //计算总商品数量和总价
  752. for(var i in shoppCart){
  753. //总价
  754. totalPrice +=parseFloat(shoppCart[i].total*100)/100
  755. totalNumber += parseInt(shoppCart[i].num)
  756. }
  757. //更改商品列表中的已购买数量
  758. for(let i in that.goodsList){
  759. if(that.goodsList[i].id == rowData.id){
  760. that.goodsList[i] = rowData
  761. break;
  762. }
  763. }
  764. that.shoppCart = shoppCart;
  765. if(that.goodsTotalPrice < totalPrice){
  766. //更具小球动画延时更改数据
  767. setTimeout(function(){
  768. that.goodsTotalPrice = totalPrice
  769. that.goodsTotalNumber = totalNumber
  770. },that.animaTime + 150);
  771. }else{
  772. that.goodsTotalPrice = totalPrice
  773. that.goodsTotalNumber = totalNumber
  774. }
  775. //门店第一次添加该商品
  776. let isFirstAddGoods = true;
  777. //that.storeData.shoppingCart = that.shoppCart;
  778. if(that.shoppCart.length>0){
  779. isFirstAddGoods=false;
  780. }
  781. // for(let i in that.shoppingCartAll){
  782. // that.shoppingCartAll[i] = that.storeData
  783. // isFirstAddGoods = false
  784. // }
  785. that.setLabelNumber();
  786. // if(isFirstAddGoods === true){
  787. // that.shoppingCartAll.push(that.storeData)
  788. // }
  789. if(that.goodsTotalNumber == 0){
  790. that.hideShoppingCar();
  791. }
  792. //购物车商品数据缓存至本地
  793. uni.setStorageSync(that.shoppingCartStorageName,that.shoppCart);
  794. }
  795. },
  796. //计算每类商品购买的总数
  797. setLabelNumber(){
  798. let that = this;
  799. //计算每一类购买商品的总数量
  800. for(let j in that.categoryList){
  801. let n = 0;
  802. for(var i in that.shoppCart){
  803. n += that.shoppCart[i].num;
  804. }
  805. that.categoryList[j].num = n;
  806. }
  807. },
  808. //去结算
  809. jiesuan(){
  810. let userinfo=uni.getStorageSync('userinfo')
  811. if(userinfo.uid==''||userinfo.uid==undefined){
  812. uni.showModal({
  813. title: '温馨提示',
  814. content: '您还没登录,请登录',
  815. success: function (res) {
  816. if (res.confirm) {
  817. uni.navigateTo({
  818. url:'/pages/user/login'
  819. })
  820. } else if (res.cancel) {
  821. console.log('用户点击取消');
  822. }
  823. }
  824. });
  825. }else{
  826. let tmpList=[];
  827. // this.shoppCart = uni.getStorageSync(this.shoppingCartStorageName) || [];
  828. let len = this.shoppCart.length;
  829. for(let i=0;i<len;i++){
  830. if(this.shoppCart[i].num>0){
  831. tmpList.push(this.shoppCart[i]);
  832. }
  833. }
  834. if(tmpList.length<1){
  835. uni.showToast({
  836. title:'请选择商品结算',
  837. icon:'none'
  838. });
  839. return ;
  840. }
  841. //获取消息模板
  842. // wx.requestSubscribeMessage({
  843. // tmplIds: ['xrga_0YidesSMMfOxNaLmzvpfu42RdOYaA85D8ru88k'],
  844. // success (res) {}
  845. // })
  846. uni.setStorage({
  847. key:'buylist',
  848. data:tmpList,
  849. success: () => {
  850. uni.navigateTo({
  851. url:'../orderconfirmation/orderconfirmation'
  852. })
  853. }
  854. })
  855. }
  856. },
  857. //联系商家
  858. contact(){
  859. uni.switchTab({
  860. url:'../index/index'
  861. })
  862. },
  863. //小球回调
  864. jbMsg(res){
  865. let that = this;
  866. that.cartAnimation.matrix(1, 0, 0, 0.7, 0, 7).step({duration: 100})
  867. that.cartAnimationData = that.cartAnimation.export();
  868. //动画在app端有bug,所以必须写延迟才能解决
  869. setTimeout(function() {
  870. that.cartAnimation.matrix(1, 0, 0, 1, 0, 0).step({duration: 150});
  871. that.cartAnimationData = that.cartAnimation.export();
  872. },100);
  873. },
  874. //预览图片
  875. previewImg(imgSrc,list){
  876. this.currentImg = imgSrc
  877. this.previewImgList = list
  878. this.PINum++
  879. },
  880. //规格弹窗开关
  881. toggleSpec() {
  882. if(this.specClass === 'show'){
  883. this.specClass = 'hide';
  884. setTimeout(() => {
  885. this.specClass = 'none';
  886. }, 250);
  887. }else if(this.specClass === 'none'){
  888. this.specClass = 'show';
  889. }
  890. },
  891. //选择规格
  892. selectSpec(index, pid){
  893. let list = this.specChildList;
  894. list.forEach(item=>{
  895. if(item.pid === pid){
  896. this.$set(item, 'selected', false);
  897. }
  898. })
  899. this.$set(list[index], 'selected', true);
  900. //存储已选择
  901. /**
  902. * 修复选择规格存储错误
  903. * 将这几行代码替换即可
  904. * 选择的规格存放在specSelected中
  905. */
  906. this.specSelected = [];
  907. list.forEach(item=>{
  908. if(item.selected === true){
  909. this.specSelected.push(item);
  910. }
  911. })
  912. },
  913. //分享
  914. share(){
  915. this.$refs.share.toggleMask();
  916. },
  917. //收藏
  918. toFavorite(){
  919. this.favorite = !this.favorite;
  920. },
  921. buy(){
  922. uni.navigateTo({
  923. url: `/pages/shop/order/createOrder`
  924. })
  925. },
  926. stopPrevent(){},
  927. },
  928. }
  929. </script>
  930. <style lang='scss'>
  931. .sdtext{
  932. padding: 5upx 10upx;
  933. border-radius: 8upx;
  934. color: #fff;
  935. font-size: 25upx;
  936. background-color: #31AA5A;
  937. }
  938. //主题颜色
  939. $hx-theme-color: #FFC107;
  940. $hx-theme-color-light: #FFEB3B;
  941. page{
  942. background: #ffffff;
  943. padding-bottom: 160upx;
  944. }
  945. /*边框*/
  946. .b-b:after,
  947. .b-t:after {
  948. position: absolute;
  949. z-index: 3;
  950. left: 0;
  951. right: 0;
  952. height: 0;
  953. content: '';
  954. transform: scaleY(.5);
  955. border-bottom: 1px solid #E4E7ED;
  956. }
  957. .b-b:after {
  958. bottom: 0;
  959. }
  960. .b-t:after {
  961. top: 0;
  962. }
  963. .hx-txt-10{
  964. font-size: 10px;
  965. }
  966. .hx-txt-12{
  967. font-size: 12px;
  968. }
  969. .hx-txt-14{
  970. font-size: 14px;
  971. }
  972. .hx-txt-16{
  973. font-size: 16px;
  974. }
  975. .hx-txt-18{
  976. font-size: 18px;
  977. }
  978. .hx-txt-22{
  979. font-size: 22px;
  980. }
  981. .hx-color-gray{
  982. color: #bbbbbb;
  983. }
  984. .hx-color-white{
  985. color: #FFFFFF;
  986. }
  987. .hx-color-black{
  988. color: #333333;
  989. }
  990. .hx-txt-weigth{
  991. font-weight: bold;
  992. }
  993. .hx-mb-10{
  994. margin-bottom: 10px;
  995. }
  996. .hx-mt-15{
  997. margin-top: 15px;
  998. }
  999. .hx-shadow{
  1000. box-shadow: 0px 6upx 16upx rgba(173, 173, 173, 0.2);
  1001. }
  1002. .barBorder{
  1003. box-shadow: 0 1px 6px #ccc;
  1004. border-top: 1px solid #f1f1f1;
  1005. }
  1006. .icon-right{
  1007. font-size: 16px;
  1008. color: #888;
  1009. }
  1010. .carousel {
  1011. height: 722upx;
  1012. position:relative;
  1013. swiper{
  1014. height: 100%;
  1015. }
  1016. .image-wrapper{
  1017. width: 100%;
  1018. height: 100%;
  1019. }
  1020. .swiper-item {
  1021. display: flex;
  1022. justify-content: center;
  1023. align-content: center;
  1024. height: 750upx;
  1025. overflow: hidden;
  1026. image {
  1027. width: 100%;
  1028. height: 100%;
  1029. }
  1030. }
  1031. }
  1032. .line-weight{
  1033. background-color: #efefef;
  1034. height: 10px;
  1035. }
  1036. .container-box{
  1037. background: #fff;
  1038. padding: 10px 15px;
  1039. }
  1040. /* 标题简介 */
  1041. .introduce-section{
  1042. padding-bottom: 0;
  1043. .title{
  1044. font-size: 30upx;
  1045. color: #5A5A5A;
  1046. height: 50upx;
  1047. line-height: 50upx;
  1048. font-weight: bold;
  1049. }
  1050. .dw{
  1051. font-size: 28upx;
  1052. color: #303133;
  1053. }
  1054. .tag-box{
  1055. display: flex;
  1056. align-items:baseline;
  1057. margin: 6px 0 4px;
  1058. flex-wrap: wrap;
  1059. .tag-item{
  1060. align-items: center;
  1061. padding: 2px 5px;
  1062. background: #efefef;
  1063. margin-bottom: 8px;
  1064. font-size: 10px;
  1065. margin-right: 10px;
  1066. border-radius: 3px;
  1067. color: #555555;
  1068. }
  1069. }
  1070. .bot-row{
  1071. display:flex;
  1072. align-items:center;
  1073. height: 20px;
  1074. font-size: 12px;
  1075. color: #909399;
  1076. text{
  1077. flex: 1;
  1078. }
  1079. }
  1080. }
  1081. /* 价格 */
  1082. .shopping-cart{
  1083. position: sticky;
  1084. top: 0;
  1085. /* top: calc(44px + var(--status-bar-height)); */
  1086. padding-top: 10px;
  1087. display: flex;
  1088. justify-content: space-between;
  1089. background: #ffffff;
  1090. z-index: 10;
  1091. .price-box{
  1092. display:flex;
  1093. align-items:baseline;
  1094. font-size: 12px;
  1095. color:#ff582b;
  1096. .price{
  1097. font-size: 20px;
  1098. }
  1099. .m-price{
  1100. margin:0 6px;
  1101. color: #909399;
  1102. text-decoration: line-through;
  1103. font-size: 12px;
  1104. }
  1105. .coupon-tip{
  1106. align-items: center;
  1107. padding: 4upx 10upx;
  1108. background: #FF5722;
  1109. font-size: 12px;
  1110. color: #fff;
  1111. border-radius: 3px;
  1112. line-height: 1;
  1113. transform: translateY(-4upx);
  1114. }
  1115. }
  1116. .add-btn{
  1117. border-radius: 50px;
  1118. background-color: #39A74D;
  1119. padding: 3px 10px;
  1120. display: flex;
  1121. height: 25px;
  1122. align-items: center;
  1123. color: #fff;
  1124. i{
  1125. font-weight: bold;
  1126. margin-left: -4px;
  1127. margin-right: 3px;
  1128. }
  1129. text{
  1130. font-size: 13px;
  1131. font-weight: bold;
  1132. color: #fff;
  1133. }
  1134. }
  1135. }
  1136. .tabs-box{
  1137. width: 100%;
  1138. z-index: 10;
  1139. background-color: white;
  1140. height: 40px;
  1141. .hx-tabs{
  1142. position: relative;
  1143. display: flex;
  1144. height:100%;
  1145. &-item{
  1146. display: flex;
  1147. flex-direction: row;
  1148. justify-content: left;
  1149. align-items: center;
  1150. width: 70px;
  1151. color:#666666;
  1152. text{
  1153. font-size: 16px;
  1154. }
  1155. }
  1156. &-active{
  1157. color:#333333;
  1158. font-weight: bold;
  1159. }
  1160. &-slider-box{
  1161. position: absolute;
  1162. display: flex;
  1163. justify-content: left;
  1164. bottom: 0;
  1165. width: 70px;
  1166. }
  1167. &-slider{
  1168. display: flex;
  1169. background: #FFC107;
  1170. width: 20px;
  1171. height: 2px;
  1172. margin-left: 6px;
  1173. }
  1174. }
  1175. }
  1176. /* 详情 */
  1177. .info-box{
  1178. display: flex;
  1179. flex-direction: column;
  1180. padding-top: 12px;
  1181. .info-item{
  1182. display: flex;
  1183. flex-direction: row;
  1184. align-items: flex-start;
  1185. font-size: 13px;
  1186. margin-bottom: 6px;
  1187. .left{
  1188. color: #909399;
  1189. width: 84px;
  1190. }
  1191. .right{
  1192. font-size: 28upx;
  1193. color: #505050;
  1194. flex: 1;
  1195. }
  1196. }
  1197. }
  1198. .c-list{
  1199. font-size: 13px;
  1200. color: #606266;
  1201. background: #fff;
  1202. .c-row{
  1203. display:flex;
  1204. align-items:center;
  1205. padding: 20upx 30upx;
  1206. position:relative;
  1207. }
  1208. .tit{
  1209. width: 140upx;
  1210. }
  1211. .con{
  1212. flex: 1;
  1213. color: #303133;
  1214. .selected-text{
  1215. margin-right: 10upx;
  1216. }
  1217. }
  1218. .bz-list{
  1219. height: 40upx;
  1220. font-size: 13px;
  1221. color: #303133;
  1222. text{
  1223. display: inline-block;
  1224. margin-right: 30upx;
  1225. }
  1226. }
  1227. .con-list{
  1228. flex: 1;
  1229. display:flex;
  1230. flex-direction: column;
  1231. color: #303133;
  1232. line-height: 40upx;
  1233. }
  1234. .red{
  1235. color: #fa436a;
  1236. }
  1237. }
  1238. .eva-box{
  1239. display: flex;
  1240. padding: 10px 0;
  1241. border-bottom: 1px solid #f5f5f5;
  1242. .right{
  1243. flex: 1;
  1244. display: flex;
  1245. flex-direction: column;
  1246. font-size: 14px;
  1247. color: #606266;
  1248. padding-left: 26upx;
  1249. .con{
  1250. font-size: 14px;
  1251. color: #303133;
  1252. padding: 10px 0 6px;
  1253. }
  1254. .bot{
  1255. display: flex;
  1256. justify-content: space-between;
  1257. font-size: 12px;
  1258. color:#909399;
  1259. }
  1260. .praise-box{
  1261. margin-top: 4px;
  1262. display: flex;
  1263. flex-direction: row;
  1264. .hxicon{
  1265. color: #F0AD4E;
  1266. margin-right: 6px;
  1267. }
  1268. .tread{
  1269. color: #909399;
  1270. }
  1271. .praise-txt{
  1272. color:#909399;
  1273. font-size: 12px;
  1274. }
  1275. }
  1276. .imgs {
  1277. display: flex;
  1278. flex-wrap: wrap;
  1279. padding-top: 4px;
  1280. .imgs-box {
  1281. width: 25%;
  1282. padding-right: 5px;
  1283. box-sizing: border-box;
  1284. image{
  1285. border-radius: 4px;
  1286. }
  1287. }
  1288. }
  1289. }
  1290. }
  1291. /* 详情 */
  1292. .detail-desc{
  1293. background: #fff;
  1294. margin-top: 16upx;
  1295. .d-header{
  1296. display: flex;
  1297. justify-content: center;
  1298. align-items: center;
  1299. height: 80upx;
  1300. font-size: 15px;
  1301. color: #303133;
  1302. position: relative;
  1303. text{
  1304. padding: 0 20upx;
  1305. background: #fff;
  1306. position: relative;
  1307. z-index: 1;
  1308. }
  1309. &:after{
  1310. position: absolute;
  1311. left: 50%;
  1312. top: 50%;
  1313. transform: translateX(-50%);
  1314. width: 300upx;
  1315. height: 0;
  1316. content: '';
  1317. border-bottom: 1px solid #ccc;
  1318. }
  1319. }
  1320. }
  1321. /* 规格选择弹窗 */
  1322. .attr-content{
  1323. padding: 10upx 30upx;
  1324. .a-t{
  1325. display: flex;
  1326. image{
  1327. width: 170upx;
  1328. height: 170upx;
  1329. flex-shrink: 0;
  1330. margin-top: -40upx;
  1331. border-radius: 8upx;;
  1332. }
  1333. .right{
  1334. display: flex;
  1335. flex-direction: column;
  1336. padding-left: 24upx;
  1337. font-size: 13px;
  1338. color: #606266;
  1339. line-height: 42upx;
  1340. .price{
  1341. font-size: 17px;
  1342. color: #fa436a;
  1343. margin-bottom: 10upx;
  1344. }
  1345. .selected-text{
  1346. margin-right: 10upx;
  1347. }
  1348. }
  1349. }
  1350. .attr-list{
  1351. display: flex;
  1352. flex-direction: column;
  1353. font-size: 15px;
  1354. color: #606266;
  1355. padding-top: 30upx;
  1356. padding-left: 10upx;
  1357. }
  1358. .item-list{
  1359. padding: 20upx 0 0;
  1360. display: flex;
  1361. flex-wrap: wrap;
  1362. text{
  1363. display: flex;
  1364. align-items: center;
  1365. justify-content: center;
  1366. background: #eee;
  1367. margin-right: 20upx;
  1368. margin-bottom: 20upx;
  1369. border-radius: 100upx;
  1370. min-width: 60upx;
  1371. height: 60upx;
  1372. padding: 0 20upx;
  1373. font-size: 14px;
  1374. color: #303133;
  1375. }
  1376. .selected{
  1377. background: #fbebee;
  1378. color: #fa436a;
  1379. }
  1380. }
  1381. }
  1382. /* 弹出层 */
  1383. .popup {
  1384. position: fixed;
  1385. left: 0;
  1386. top: 0;
  1387. right: 0;
  1388. bottom: 0;
  1389. z-index: 99;
  1390. &.show {
  1391. display: block;
  1392. .mask{
  1393. animation: showPopup 0.2s linear both;
  1394. }
  1395. .layer {
  1396. animation: showLayer 0.2s linear both;
  1397. }
  1398. }
  1399. &.hide {
  1400. .mask{
  1401. animation: hidePopup 0.2s linear both;
  1402. }
  1403. .layer {
  1404. animation: hideLayer 0.2s linear both;
  1405. }
  1406. }
  1407. &.none {
  1408. display: none;
  1409. }
  1410. .mask{
  1411. position: fixed;
  1412. top: 0;
  1413. width: 100%;
  1414. height: 100%;
  1415. z-index: 1;
  1416. background-color: rgba(0, 0, 0, 0.4);
  1417. }
  1418. .layer {
  1419. position: fixed;
  1420. z-index: 99;
  1421. bottom: 0;
  1422. width: 100%;
  1423. min-height: 40vh;
  1424. border-radius: 10upx 10upx 0 0;
  1425. background-color: #fff;
  1426. .btn{
  1427. height: 66upx;
  1428. line-height: 66upx;
  1429. border-radius: 100upx;
  1430. background: #fa436a;
  1431. font-size: 15px;
  1432. color: #fff;
  1433. margin: 30upx auto 20upx;
  1434. }
  1435. }
  1436. @keyframes showPopup {
  1437. 0% {
  1438. opacity: 0;
  1439. }
  1440. 100% {
  1441. opacity: 1;
  1442. }
  1443. }
  1444. @keyframes hidePopup {
  1445. 0% {
  1446. opacity: 1;
  1447. }
  1448. 100% {
  1449. opacity: 0;
  1450. }
  1451. }
  1452. @keyframes showLayer {
  1453. 0% {
  1454. transform: translateY(120%);
  1455. }
  1456. 100% {
  1457. transform: translateY(0%);
  1458. }
  1459. }
  1460. @keyframes hideLayer {
  1461. 0% {
  1462. transform: translateY(0);
  1463. }
  1464. 100% {
  1465. transform: translateY(120%);
  1466. }
  1467. }
  1468. }
  1469. /* 底部操作菜单 */
  1470. .page-bottom{
  1471. position:fixed;
  1472. left: 30upx;
  1473. bottom:30upx;
  1474. z-index: 95;
  1475. display: flex;
  1476. justify-content: center;
  1477. align-items: center;
  1478. width: 690upx;
  1479. height: 100upx;
  1480. background: rgba(255,255,255,.9);
  1481. box-shadow: 0 0 20upx 0 rgba(0,0,0,.5);
  1482. border-radius: 16upx;
  1483. .p-b-btn{
  1484. display:flex;
  1485. flex-direction: column;
  1486. align-items: center;
  1487. justify-content: center;
  1488. font-size: 12px;
  1489. color: #606266;
  1490. width: 96upx;
  1491. height: 80upx;
  1492. .hxicon{
  1493. font-size: 40upx;
  1494. line-height: 48upx;
  1495. color: #909399;
  1496. }
  1497. &.active, &.active .hxicon{
  1498. color: #fa436a;
  1499. }
  1500. .icon-fenxiang2{
  1501. font-size: 42upx;
  1502. transform: translateY(-2upx);
  1503. }
  1504. .icon-likefill{
  1505. font-size: 46upx;
  1506. }
  1507. }
  1508. .action-btn-group{
  1509. display: flex;
  1510. height: 76upx;
  1511. border-radius: 100px;
  1512. overflow: hidden;
  1513. box-shadow: 0 20upx 40upx -16upx #fa436a;
  1514. box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  1515. background: linear-gradient(to right, #ffac30,#fa436a,#F56C6C);
  1516. margin-left: 20upx;
  1517. position:relative;
  1518. &:after{
  1519. content: '';
  1520. position:absolute;
  1521. top: 50%;
  1522. right: 50%;
  1523. transform: translateY(-50%);
  1524. height: 28upx;
  1525. width: 0;
  1526. border-right: 1px solid rgba(255,255,255,.5);
  1527. }
  1528. .action-btn{
  1529. display:flex;
  1530. align-items: center;
  1531. justify-content: center;
  1532. width: 180upx;
  1533. height: 100%;
  1534. font-size: 14px ;
  1535. padding: 0;
  1536. border-radius: 0;
  1537. background: transparent;
  1538. }
  1539. }
  1540. }
  1541. /* foot */
  1542. .foot{
  1543. position: fixed;
  1544. display: flex;
  1545. z-index: 12;
  1546. justify-content:center;
  1547. align-items : center;
  1548. bottom: 0;
  1549. height: 100%;
  1550. width: 100%;
  1551. /*width: calc(100% - 32px);*/
  1552. .btn-box{
  1553. position:absolute;
  1554. display: flex;
  1555. bottom: 6px;
  1556. justify-content:center;
  1557. align-items : center;
  1558. margin:0;
  1559. height: 45px;
  1560. width: calc(100% - 32px);
  1561. z-index: 9;
  1562. &-left{
  1563. background: #434846;
  1564. border-top-left-radius:50px;
  1565. border-top-right-radius:9px;
  1566. border-bottom-left-radius:50px;
  1567. border-bottom-right-radius:9px;
  1568. padding-left: 6upx;
  1569. display: flex;
  1570. flex-direction:column;
  1571. justify-content:center;
  1572. align-self: center;
  1573. width: 70px;
  1574. height: 100%;
  1575. color: #fff;
  1576. text-align: center;
  1577. .imgBox{
  1578. display: flex;
  1579. text-align: center;
  1580. justify-content:center;
  1581. image{
  1582. width: 20px;
  1583. height: 20px;
  1584. }
  1585. }
  1586. text{
  1587. font-size: 20upx;
  1588. }
  1589. }
  1590. &-line{
  1591. background: #ffffff;
  1592. width: 2px;
  1593. height: 100%;
  1594. }
  1595. &-center{
  1596. height: 100%;
  1597. flex: auto;
  1598. display: flex;
  1599. justify-content:flex-start;
  1600. align-self: center;
  1601. align-items: center;
  1602. background: #434846;
  1603. border-top-left-radius:8upx;
  1604. border-bottom-left-radius:8upx;
  1605. padding-left: 10upx;
  1606. .cart{
  1607. position: relative;
  1608. width: 36px;
  1609. height: 36px;
  1610. image{
  1611. width: 100%;
  1612. height: 100%;
  1613. }
  1614. .tag{
  1615. position: absolute;
  1616. right: 12upx;
  1617. top: 16upx;
  1618. height: 18px;
  1619. width: 18px;
  1620. background-color: #ff4000;
  1621. color: #ffffff;
  1622. border-radius: 50%;
  1623. z-index: 1;
  1624. font-size: 10px;
  1625. text-align: center;
  1626. line-height: 18px;
  1627. }
  1628. }
  1629. .priceBox{
  1630. flex: auto;
  1631. }
  1632. }
  1633. &-right{
  1634. width: 70px;
  1635. height: 100%;
  1636. position: relative;
  1637. display: flex;
  1638. justify-content:flex-start;
  1639. align-self: center;
  1640. align-items: center;
  1641. .pscj{
  1642. width: 100%;
  1643. height: 100%;
  1644. border-top-right-radius:100upx;
  1645. border-bottom-right-radius:100upx;
  1646. background: #434846;
  1647. text-align: center;
  1648. display: flex;
  1649. justify-content:center;
  1650. align-self: center;
  1651. align-items: center;
  1652. }
  1653. .jiesuan{
  1654. width: 100%;
  1655. height: 100%;
  1656. font-size: 28upx;
  1657. border-top-right-radius:100upx;
  1658. border-bottom-right-radius:100upx;
  1659. text-align: center;
  1660. display: flex;
  1661. justify-content:center;
  1662. align-self: center;
  1663. align-items: center;
  1664. background: linear-gradient(45deg, #67C979, #39A74D);
  1665. font-weight: bold;
  1666. color: #fff;
  1667. }
  1668. }
  1669. }
  1670. .zz{
  1671. position: absolute;
  1672. top: 0;
  1673. left: 0;
  1674. right: 0;
  1675. bottom: 0;
  1676. background-color: rgba(0,0,0,.7);
  1677. z-index: 1;
  1678. }
  1679. .cart-box{
  1680. display: flex;
  1681. justify-content: flex-start;
  1682. flex-flow: column;
  1683. background: #ffffff;
  1684. position: absolute;
  1685. bottom: 0;
  1686. z-index: 2;
  1687. max-height: 66%;
  1688. padding-bottom: 62px;
  1689. border-top-left-radius: 16px;
  1690. border-top-right-radius: 16px;
  1691. overflow: hidden;
  1692. width: 100%;
  1693. .rebate-box{
  1694. height: 30px;
  1695. background: #39A74D;
  1696. color: #fff;
  1697. text-align: center;
  1698. line-height: 30px;
  1699. font-size: 14px;
  1700. }
  1701. .box-container{
  1702. box-sizing: border-box;
  1703. padding:0 16px;
  1704. }
  1705. .operating-box{
  1706. font-size: 12px;
  1707. line-height: 40px;
  1708. height: 40px;
  1709. border-bottom: 1px solid #f6f6f6;
  1710. color: #666666;
  1711. display: flex;
  1712. flex-direction: row;
  1713. &_right{
  1714. flex: 1;
  1715. }
  1716. &_left{
  1717. display: flex;
  1718. flex-direction: row;
  1719. }
  1720. }
  1721. .goods-box{
  1722. height: 100%;
  1723. overflow: hidden;
  1724. flex: 1;
  1725. display: flex;
  1726. .goods-list-scroll{
  1727. height: 100%;
  1728. .goods-list{
  1729. width: 100%;
  1730. display: flex;
  1731. flex-wrap: wrap;
  1732. .box{
  1733. width: 100%;
  1734. border-bottom: 1px solid #f6f6f6;
  1735. box-sizing: border-box;
  1736. padding: 0 16px;
  1737. .m-store-item{
  1738. display: flex;
  1739. flex-direction: row;
  1740. width: 100%;
  1741. justify-content: space-between;
  1742. align-items: flex-end;
  1743. padding-top: 15px;
  1744. padding-bottom: 15px;
  1745. .m-img{
  1746. flex: 0 0 85px;
  1747. height: 85px;
  1748. background: #eee;
  1749. border-radius: 4px;
  1750. }
  1751. .m-text{
  1752. flex: 1;
  1753. position: relative;
  1754. height: 85px;
  1755. padding: 0 6px;
  1756. display: flex;
  1757. align-content: space-between;
  1758. flex-direction: column;
  1759. .m-title{
  1760. font-size: 16px;
  1761. color:#555555;
  1762. height: 21px;
  1763. font-weight: bold;
  1764. }
  1765. .m-descripe{
  1766. font-size: 12px;
  1767. color:#999999;
  1768. margin-top: 5px;
  1769. height: 35px;
  1770. }
  1771. .m-price-box{
  1772. height: 24px;
  1773. font-weight: bold;
  1774. display: flex;
  1775. flex-direction: row;
  1776. align-items: flex-end;
  1777. .symbol{
  1778. color:#ff582b;
  1779. font-size: 12px;
  1780. }
  1781. .m-price{
  1782. position: relative;
  1783. top: 2px;
  1784. font-size: 18px;
  1785. color:#ff582b;
  1786. }
  1787. .m-old-price{
  1788. margin-left: 3px;
  1789. display: flex;
  1790. flex-direction: row;
  1791. font-size: 10px;
  1792. color:#999999;
  1793. margin-top: 5upx;
  1794. text-decoration: line-through;
  1795. font-weight: normal;
  1796. }
  1797. }
  1798. .m-distance{
  1799. position: absolute;
  1800. right: 0;
  1801. bottom: -4px;
  1802. z-index: 16;
  1803. color:#b2b2b2;
  1804. font-size: 20upx;
  1805. text-align: right;
  1806. .jumpPosition{
  1807. position: absolute;
  1808. bottom: 23px;
  1809. right: 0;
  1810. z-index: 2;
  1811. width: 28px;
  1812. height: 28px;
  1813. }
  1814. }
  1815. }
  1816. }
  1817. }
  1818. }
  1819. }
  1820. }
  1821. }
  1822. }
  1823. .spbz {
  1824. display: flex;
  1825. align-items: center;
  1826. margin-right: 20upx;
  1827. margin-left: 36upx;
  1828. flex-direction:column;
  1829. background-color: #f1f1f1;
  1830. padding-left: 8upx;
  1831. }
  1832. .number {
  1833. display: flex;
  1834. justify-content: flex-end;
  1835. margin-right: 30upx;
  1836. margin-bottom: 10upx;
  1837. .input {
  1838. width: 70upx;
  1839. height: 45upx;
  1840. margin: 0 10upx;
  1841. // background-color: #f3f3f3;
  1842. border-bottom: 1upx #ADADAD solid;
  1843. input {
  1844. width: 60upx;
  1845. height: 60upx;
  1846. display: flex;
  1847. justify-content: center;
  1848. align-items: center;
  1849. text-align: center;
  1850. font-size: 26upx;
  1851. }
  1852. }
  1853. .sub,
  1854. .add {
  1855. width: 45upx;
  1856. height: 45upx;
  1857. border-radius: 5upx;
  1858. }
  1859. .jia {
  1860. display: flex;
  1861. width: 45upx;
  1862. height: 45upx;
  1863. justify-content: center;
  1864. justify-items: center;
  1865. align-items: center;
  1866. background-color: #41A863;
  1867. color: #fff;
  1868. border-radius: 50%;
  1869. image {
  1870. width: 40upx;
  1871. height: 40upx;
  1872. padding: 7upx;
  1873. }
  1874. }
  1875. .jian {
  1876. display: flex;
  1877. width: 45upx;
  1878. height: 45upx;
  1879. justify-content: center;
  1880. justify-items: center;
  1881. align-items: center;
  1882. background-color: #41A863;
  1883. color: #fff;
  1884. border-radius: 50%;
  1885. padding-bottom: 10upx;
  1886. }
  1887. }
  1888. </style>