黎海 2 years ago
parent
commit
2d1d682454

+ 5 - 0
package-lock.json

@@ -15911,6 +15911,11 @@
15911
       "integrity": "sha1-J1b0bLMlgFTF9HI96K5+hzAqHM8=",
15911
       "integrity": "sha1-J1b0bLMlgFTF9HI96K5+hzAqHM8=",
15912
       "dev": true
15912
       "dev": true
15913
     },
15913
     },
15914
+    "vue-infinite-scroll": {
15915
+      "version": "2.0.2",
15916
+      "resolved": "https://registry.npmjs.org/vue-infinite-scroll/-/vue-infinite-scroll-2.0.2.tgz",
15917
+      "integrity": "sha512-n+YghR059YmciANGJh9SsNWRi1YZEBVlODtmnb/12zI+4R72QZSWd+EuZ5mW6auEo/yaJXgxzwsuhvALVnm73A=="
15918
+    },
15914
     "vue-jest": {
15919
     "vue-jest": {
15915
       "version": "3.0.4",
15920
       "version": "3.0.4",
15916
       "resolved": "https://registry.npm.taobao.org/vue-jest/download/vue-jest-3.0.4.tgz",
15921
       "resolved": "https://registry.npm.taobao.org/vue-jest/download/vue-jest-3.0.4.tgz",

+ 1 - 0
package.json

@@ -17,6 +17,7 @@
17
     "js-cookie": "^3.0.1",
17
     "js-cookie": "^3.0.1",
18
     "qrcodejs2": "0.0.2",
18
     "qrcodejs2": "0.0.2",
19
     "vue": "^2.6.6",
19
     "vue": "^2.6.6",
20
+    "vue-infinite-scroll": "^2.0.2",
20
     "vue-router": "^3.0.1",
21
     "vue-router": "^3.0.1",
21
     "vuex": "^3.0.1"
22
     "vuex": "^3.0.1"
22
   },
23
   },

+ 2 - 2
src/components/common/layout/leftMenu.vue

@@ -88,8 +88,8 @@ export default {
88
   },
88
   },
89
   watch: {
89
   watch: {
90
     $route (to, from) {
90
     $route (to, from) {
91
-      let patname = `/${window.location.pathname.split('/')[1]}`
92
-      console.log(patname, 'patname');
91
+      let patname = `/${window.location.hash.split('/')[1]}`
92
+      console.log(patname, 'patname', window.location);
93
       this.menu.forEach((item, index) => {
93
       this.menu.forEach((item, index) => {
94
         if (patname == item.path) {
94
         if (patname == item.path) {
95
           this.nowIndex = index
95
           this.nowIndex = index

+ 3 - 0
src/main.js

@@ -7,6 +7,7 @@ import ElementUI from 'element-ui'
7
 import 'element-ui/lib/theme-chalk/index.css'
7
 import 'element-ui/lib/theme-chalk/index.css'
8
 import auth from './common/auth'
8
 import auth from './common/auth'
9
 import { injectGlobal } from './common/'
9
 import { injectGlobal } from './common/'
10
+import infiniteScroll from "vue-infinite-scroll";
10
 import './style/reset.less'
11
 import './style/reset.less'
11
 import './style/common.less'
12
 import './style/common.less'
12
 import './assets/font/iconfont.css'
13
 import './assets/font/iconfont.css'
@@ -14,6 +15,8 @@ import './style/index.less'
14
 import './filters/filter'
15
 import './filters/filter'
15
 //全局注入
16
 //全局注入
16
 Vue.use(ElementUI)
17
 Vue.use(ElementUI)
18
+Vue.use(infiniteScroll);
19
+
17
 injectGlobal()
20
 injectGlobal()
18
 
21
 
19
 window.globalVue = "";
22
 window.globalVue = "";

+ 75 - 16
src/pages/confirmOrder/details/index.vue

@@ -154,32 +154,34 @@
154
              @click="isCoupun=false"><img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/delete.png"
154
              @click="isCoupun=false"><img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/delete.png"
155
                alt=""></div>
155
                alt=""></div>
156
         <div class="coupon-pupop-title">选择优惠券</div>
156
         <div class="coupon-pupop-title">选择优惠券</div>
157
-        <ul class="coupon-lists"
158
-            infinite-scroll-distance="10"
159
-            style="overflow:auto"
160
-            v-infinite-scroll="onCoupon">
157
+        <ul class="coupon-lists">
161
           <li class="coupon-info"
158
           <li class="coupon-info"
162
               v-for="item,index in couponList"
159
               v-for="item,index in couponList"
163
               :key="index">
160
               :key="index">
161
+            <div class="coupon-tips-text">{{item.type==1?'无条件抵扣券':item.type==2?'满减券':item.type==3?'全额券':'项目全减券'}}</div>
164
             <div class="top">
162
             <div class="top">
165
-              <div class="discount">
166
-                <div class="price-num"><span class="size">¥</span>10<span class="size">.00</span></div>
167
-                <div class="price-tips">满100元可用</div>
163
+              <div v-if="item.type!=2"
164
+                   class="discount-over">全免</div>
165
+              <div v-else
166
+                   class="discount">
167
+                <div class="price-num"><span class="size">¥</span>{{item.price}}</div>
168
+                <div class="price-tips">{{item.full_price}}</div>
168
               </div>
169
               </div>
169
               <div class="coupon-tip">
170
               <div class="coupon-tip">
170
-                <div class="tips-title">{{item.full_price}}</div>
171
+                <div class="tips-title">{{item.coupon_name}}</div>
171
                 <div class="tips-ts">有效期至{{item.ex_time}}</div>
172
                 <div class="tips-ts">有效期至{{item.ex_time}}</div>
172
               </div>
173
               </div>
173
-              <div class="choice-icon"><img :src="select"></div>
174
+              <div class="choice-icon"
175
+                   @click="selectPupop(item,index)"><img :src="item.Select?select:unSelect"></div>
174
             </div>
176
             </div>
175
             <div class="bottom">
177
             <div class="bottom">
176
-              <div class="coupon-notes">
178
+              <div class="coupon-notes"
179
+                   @click="isOver=!isOver">
177
                 <div class="notes-text min-size">
180
                 <div class="notes-text min-size">
178
                   <span v-if="!isOver">{{item.coupon_desc |ellipsis(20)}}</span>
181
                   <span v-if="!isOver">{{item.coupon_desc |ellipsis(20)}}</span>
179
                   <span v-else>{{item.coupon_desc}}</span>
182
                   <span v-else>{{item.coupon_desc}}</span>
180
                 </div>
183
                 </div>
181
-                <div class="notes-icon"
182
-                     @click="isOver=!isOver"><img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/openNotes.png"
184
+                <div class="notes-icon"><img :src="isOver?open:unOpen"
183
                        alt=""></div>
185
                        alt=""></div>
184
               </div>
186
               </div>
185
             </div>
187
             </div>
@@ -317,6 +319,8 @@ export default {
317
   components: { minePupop },
319
   components: { minePupop },
318
   data () {
320
   data () {
319
     return {
321
     return {
322
+      open: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/openNotes.png',
323
+      unOpen: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/upDate.png',
320
       select: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/select.png',
324
       select: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/select.png',
321
       unSelect: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/unSelect.png',
325
       unSelect: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/unSelect.png',
322
       userInfo: {
326
       userInfo: {
@@ -355,7 +359,12 @@ export default {
355
           mini: 242
359
           mini: 242
356
         }
360
         }
357
       ],
361
       ],
362
+      //优惠券列表
358
       couponList: [],
363
       couponList: [],
364
+      //已选择的优惠券
365
+      selectCouponList: [],
366
+      //已选择优惠券的id(同一个id只能选择一张优惠券)
367
+      selectCouponListId: [],
359
       timesInfo: '',
368
       timesInfo: '',
360
       reservationPrice: 0,//预约费用
369
       reservationPrice: 0,//预约费用
361
       projectInfo: '',
370
       projectInfo: '',
@@ -373,7 +382,7 @@ export default {
373
       isChange: false,//项目是否有改变
382
       isChange: false,//项目是否有改变
374
       isEditProject: false,//是否编辑项目
383
       isEditProject: false,//是否编辑项目
375
       page: 1,
384
       page: 1,
376
-      limit: 10,
385
+      limit: 20,
377
     };
386
     };
378
   },
387
   },
379
   computed: {
388
   computed: {
@@ -569,6 +578,7 @@ export default {
569
         this.reservationPrice += Number(res.price)
578
         this.reservationPrice += Number(res.price)
570
       })
579
       })
571
     },
580
     },
581
+    //获取订单优惠券
572
     onCoupon () {
582
     onCoupon () {
573
       let params = {
583
       let params = {
574
         id: this.id,
584
         id: this.id,
@@ -576,14 +586,39 @@ export default {
576
         limit: this.limit
586
         limit: this.limit
577
       }
587
       }
578
       api.getOrderCoupon(params).then(res => {
588
       api.getOrderCoupon(params).then(res => {
579
-        this.couponList = res.data.list
589
+        this.couponList = [...this.couponList, ...res.data.list]
590
+        this.couponList.forEach(item => {
591
+          this.$set(item, 'Select', false)
592
+        })
593
+        this.page++
594
+        if (this.couponList.length < res.data.total) {
595
+          this.onCoupon()
596
+        }
580
       })
597
       })
581
       this.isCoupun = true
598
       this.isCoupun = true
582
     },
599
     },
600
+    //数组包含关系
601
+    includes (arr1, arr2) {
602
+      return arr2.every(val => arr1.includes(val));
603
+    },
604
+    selectPupop (item, index) {
605
+
606
+      if (item.type = 4) {
607
+
608
+      } else {
609
+
610
+      }
611
+      this.couponList[index].Select = !this.couponList[index].Select
612
+      this.selectCouponList = this.couponList.filter(res => {
613
+        return res.Select == true
614
+      })
615
+      this.selectCouponList.forEach(res => {
616
+
617
+      })
618
+
619
+    },
583
     changeActive (e) {
620
     changeActive (e) {
584
-      console.log(e, 'eeeeeee');
585
       this.active = e
621
       this.active = e
586
-      console.log(this.active, 'this.active');
587
     },
622
     },
588
     selectTime (item) {
623
     selectTime (item) {
589
       if (item.status == 0) return
624
       if (item.status == 0) return
@@ -1085,10 +1120,27 @@ export default {
1085
       overflow: scroll;
1120
       overflow: scroll;
1086
       .coupon-info {
1121
       .coupon-info {
1087
         width: 345px;
1122
         width: 345px;
1123
+        margin-bottom: 20px;
1088
         padding: 20px 14px 10px 14px;
1124
         padding: 20px 14px 10px 14px;
1089
         position: relative;
1125
         position: relative;
1090
         background: #fff4e6;
1126
         background: #fff4e6;
1091
         border-radius: 12px;
1127
         border-radius: 12px;
1128
+        .coupon-tips-text {
1129
+          position: absolute;
1130
+          left: 0;
1131
+          top: 0;
1132
+          padding: 0 8px;
1133
+          height: 18px;
1134
+          background: #875617;
1135
+          border-radius: 12px 0px 12px 0px;
1136
+          font-size: 12px;
1137
+          font-family: PingFangSC-Medium, PingFang SC;
1138
+          font-weight: 500;
1139
+          color: #ffffff;
1140
+          line-height: 18px;
1141
+          zoom: 0.83;
1142
+          text-align: center;
1143
+        }
1092
         .top {
1144
         .top {
1093
           display: flex;
1145
           display: flex;
1094
           justify-content: space-between;
1146
           justify-content: space-between;
@@ -1122,6 +1174,13 @@ export default {
1122
               line-height: 17px;
1174
               line-height: 17px;
1123
             }
1175
             }
1124
           }
1176
           }
1177
+          .discount-over {
1178
+            font-size: 22px;
1179
+            font-family: PingFangSC-Medium, PingFang SC;
1180
+            font-weight: 500;
1181
+            color: #ff3007;
1182
+            line-height: 30px;
1183
+          }
1125
           .coupon-tip {
1184
           .coupon-tip {
1126
             .tips-title {
1185
             .tips-title {
1127
               font-size: 16px;
1186
               font-size: 16px;