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.

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