黎海 2 years ago
parent
commit
2d1d682454

+ 5 - 0
package-lock.json

@@ -15911,6 +15911,11 @@
15911 15911
       "integrity": "sha1-J1b0bLMlgFTF9HI96K5+hzAqHM8=",
15912 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 15919
     "vue-jest": {
15915 15920
       "version": "3.0.4",
15916 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 17
     "js-cookie": "^3.0.1",
18 18
     "qrcodejs2": "0.0.2",
19 19
     "vue": "^2.6.6",
20
+    "vue-infinite-scroll": "^2.0.2",
20 21
     "vue-router": "^3.0.1",
21 22
     "vuex": "^3.0.1"
22 23
   },

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

@@ -88,8 +88,8 @@ export default {
88 88
   },
89 89
   watch: {
90 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 93
       this.menu.forEach((item, index) => {
94 94
         if (patname == item.path) {
95 95
           this.nowIndex = index

+ 3 - 0
src/main.js

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

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

@@ -154,32 +154,34 @@
154 154
              @click="isCoupun=false"><img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/delete.png"
155 155
                alt=""></div>
156 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 158
           <li class="coupon-info"
162 159
               v-for="item,index in couponList"
163 160
               :key="index">
161
+            <div class="coupon-tips-text">{{item.type==1?'无条件抵扣券':item.type==2?'满减券':item.type==3?'全额券':'项目全减券'}}</div>
164 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 169
               </div>
169 170
               <div class="coupon-tip">
170
-                <div class="tips-title">{{item.full_price}}</div>
171
+                <div class="tips-title">{{item.coupon_name}}</div>
171 172
                 <div class="tips-ts">有效期至{{item.ex_time}}</div>
172 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 176
             </div>
175 177
             <div class="bottom">
176
-              <div class="coupon-notes">
178
+              <div class="coupon-notes"
179
+                   @click="isOver=!isOver">
177 180
                 <div class="notes-text min-size">
178 181
                   <span v-if="!isOver">{{item.coupon_desc |ellipsis(20)}}</span>
179 182
                   <span v-else>{{item.coupon_desc}}</span>
180 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 185
                        alt=""></div>
184 186
               </div>
185 187
             </div>
@@ -317,6 +319,8 @@ export default {
317 319
   components: { minePupop },
318 320
   data () {
319 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 324
       select: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/select.png',
321 325
       unSelect: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/unSelect.png',
322 326
       userInfo: {
@@ -355,7 +359,12 @@ export default {
355 359
           mini: 242
356 360
         }
357 361
       ],
362
+      //优惠券列表
358 363
       couponList: [],
364
+      //已选择的优惠券
365
+      selectCouponList: [],
366
+      //已选择优惠券的id(同一个id只能选择一张优惠券)
367
+      selectCouponListId: [],
359 368
       timesInfo: '',
360 369
       reservationPrice: 0,//预约费用
361 370
       projectInfo: '',
@@ -373,7 +382,7 @@ export default {
373 382
       isChange: false,//项目是否有改变
374 383
       isEditProject: false,//是否编辑项目
375 384
       page: 1,
376
-      limit: 10,
385
+      limit: 20,
377 386
     };
378 387
   },
379 388
   computed: {
@@ -569,6 +578,7 @@ export default {
569 578
         this.reservationPrice += Number(res.price)
570 579
       })
571 580
     },
581
+    //获取订单优惠券
572 582
     onCoupon () {
573 583
       let params = {
574 584
         id: this.id,
@@ -576,14 +586,39 @@ export default {
576 586
         limit: this.limit
577 587
       }
578 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 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 620
     changeActive (e) {
584
-      console.log(e, 'eeeeeee');
585 621
       this.active = e
586
-      console.log(this.active, 'this.active');
587 622
     },
588 623
     selectTime (item) {
589 624
       if (item.status == 0) return
@@ -1085,10 +1120,27 @@ export default {
1085 1120
       overflow: scroll;
1086 1121
       .coupon-info {
1087 1122
         width: 345px;
1123
+        margin-bottom: 20px;
1088 1124
         padding: 20px 14px 10px 14px;
1089 1125
         position: relative;
1090 1126
         background: #fff4e6;
1091 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 1144
         .top {
1093 1145
           display: flex;
1094 1146
           justify-content: space-between;
@@ -1122,6 +1174,13 @@ export default {
1122 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 1184
           .coupon-tip {
1126 1185
             .tips-title {
1127 1186
               font-size: 16px;