瀏覽代碼

feat: 修复 门店检测的问题

黎海 2 年之前
父節點
當前提交
05f66ffcd3

+ 60 - 27
src/pages/confirmOrder/details/index.vue

@@ -143,25 +143,34 @@
143 143
           </div> -->
144 144
 
145 145
           <div v-if="1==1">
146
+            <div>
147
+              <div class="coupon-ps"
148
+                   v-for="item,index in isSelectCoup"
149
+                   :key="index">
150
+                <div>{{item.coupon_name}}</div>
151
+                <div class="cou-price"
152
+                     v-if="item.type==4?true:false">抵扣{{item.projectName}}</div>
153
+                <div class="cou-price"
154
+                     v-if="item.type==3?true:false">抵扣全部项目(除升级包)</div>
155
+                <div class="cou-price"
156
+                     v-if="item.type==2?true:false">¥{{item.price}}</div>
157
+                <div class="cou-price"
158
+                     v-if="item.type==1?true:false">¥{{item.price}}</div>
159
+                <!-- <div class="cou-price">-¥{{price}}</div> -->
160
+              </div>
161
+            </div>
146 162
             <div class="coupon-ps"
147
-                 v-for="item,index in isSelectCoup"
148
-                 :key="index">
149
-              <div>{{item.coupon_name}}</div>
150
-              <div class="cou-price"
151
-                   v-if="item.type==4?true:false">抵扣{{item.projectName}}</div>
152
-              <div class="cou-price"
153
-                   v-if="item.type==3?true:false">抵扣全部项目(除升级包)</div>
163
+                 v-if="discount!=0">
164
+              <div></div>
165
+              <div v-if="discount!=20"
166
+                   class="cou-price"> {{discount==100?'仪器免费体验':'新人5折优惠'}}</div>
154 167
               <div class="cou-price"
155
-                   v-if="item.type==2?true:false">¥{{item.price}}</div>
156
-              <div class="cou-price"
157
-                   v-if="item.type==1?true:false">¥{{item.price}}</div>
158
-              <!-- <div class="cou-price">-¥{{price}}</div> -->
168
+                   v-else-if=" isSelectCoup.length&&(order_data.project_list.length - isSelectCoup.length)>=3">{{'任意三个项目8折'}}</div>
159 169
             </div>
160 170
           </div>
161
-
162 171
         </div>
163 172
         <div class="over-price">
164
-          合计: <span class="price-num"><span class="min-size">¥</span>{{showMoney}}<span class="min-size"></span></span>
173
+          合计: <span class="price-num"><span class="min-size">¥</span>{{isSelectCoup.length>0?showMoney:discountPrice}}<span class="min-size"></span></span>
165 174
         </div>
166 175
       </div>
167 176
       <div class="payment"
@@ -339,7 +348,7 @@
339 348
              @click="choicePayType=false"><img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/delete.png"
340 349
                alt=""></div>
341 350
         <div class="pay-title">选择支付方式</div>
342
-        <div class="pay-price">¥<span>{{showMoney}}</span></div>
351
+        <div class="pay-price">¥<span>{{isSelectCoup.length>0?showMoney:discountPrice}}</span></div>
343 352
         <div class="pay-list">
344 353
           <div class="pay-info"
345 354
                v-for="item,index in payList"
@@ -369,7 +378,7 @@
369 378
                alt=""></div>
370 379
         <div v-if="isPayCode">
371 380
           <div class="pay-title">请扫码支付</div>
372
-          <div class="pay-price">¥<span>{{showMoney}}</span></div>
381
+          <div class="pay-price">¥<span>{{isSelectCoup.length>0?showMoney:discountPrice}}</span></div>
373 382
           <div class="banner">
374 383
             <div id="qrCode"
375 384
                  class="qrCode"
@@ -478,6 +487,8 @@ export default {
478 487
       isSelectCoup: [], // 选择的优惠券
479 488
       // 下面是支付的数据
480 489
       showMoney: 0, // 价值总额
490
+      discountPrice: 0,//活动后金额
491
+      discount: 0,//折扣类型
481 492
       // showRuleText: 10086,
482 493
 
483 494
     };
@@ -500,6 +511,19 @@ export default {
500 511
         this.order_data = res.data.order_data
501 512
         this.showMoney = res.data.order_data.price
502 513
         this.poreList = res.data.detail_list
514
+        this.order_data['discountPrice'] = 0
515
+        //折扣类型,0.无折扣,20.任意三个项目8折,50.新人五折活动,100.仪器免费使用权益
516
+        this.order_data.project_list.forEach(item => {
517
+          if (this.discount == 20) {
518
+            this.order_data.discountPrice += Number(item.price) * 0.8
519
+          } else if (this.discount == 50) {
520
+            this.order_data.discountPrice += Number(item.price) * 0.5
521
+          } else if (this.discount == 0) {
522
+            this.order_data.discountPrice = this.showMoney
523
+          }
524
+        })
525
+        console.log(Number(this.order_data.discountPrice).toFixed(2), 'this.order_data.discountPrice.toFixed(2)');
526
+        this.discountPrice = Number(this.order_data.discountPrice).toFixed(2)
503 527
         this.calculationPrice()
504 528
       })
505 529
     },
@@ -626,7 +650,7 @@ export default {
626 650
       let tsTableList = []
627 651
       for (let i = 0; i < 7; i++) {
628 652
         //显示周一
629
-        let ShowTime = nowTime + (i + 1) * oneDayTime;
653
+        let ShowTime = nowTime + (i) * oneDayTime;
630 654
         //初始化日期时间
631 655
         let myDate = new Date(ShowTime);
632 656
         let year = myDate.getFullYear();
@@ -728,7 +752,8 @@ export default {
728 752
       // 卡券,项目券数据包, id:订单项目ID, coupon_id:优惠券ID, 如:[{ "id": 1220, coupon_id: 199 }]isSelectCoup
729 753
       let params = {
730 754
         id: this.id,
731
-        pay_way: payWayList[0].pay_way
755
+        pay_way: payWayList[0].pay_way,
756
+        discount: this.discount
732 757
       }
733 758
 
734 759
       let coupon_data = []
@@ -894,7 +919,6 @@ export default {
894 919
       let productDiscount = this.couponList // 卡券列表
895 920
       console.log(this.couponList, 'this.couponList');
896 921
       (productDiscount)
897
-      // debugger
898 922
       if (isSelectCoup.length > 0 && isSelectCoup[0].type && isSelectCoup[0].type == 4) {
899 923
         for (let i = 0; i < isSelectCoup.length; i++) { // 首先遍历卡券
900 924
           if (!isSelectCoup[i].projectids) { // 如果卡券没绑定项目
@@ -957,6 +981,12 @@ export default {
957 981
           }
958 982
         }
959 983
         this.showMoney = money.toFixed(2)
984
+        if (this.order_data.project_list.length - this.isSelectCoup.length >= 3) {
985
+          console.log(money, 'money');
986
+          money = (money * 0.8).toFixed(2)
987
+          console.log(money, 'money');
988
+
989
+        }
960 990
       } else if (isSelectCoup[0].type == 3) {
961 991
         for (let i = 0; i < project_list.length; i++) {
962 992
           money = money - Number(project_list[i].price)
@@ -965,10 +995,8 @@ export default {
965 995
       } else {
966 996
         money = money - Number(isSelectCoup[0].price)
967 997
       }
968
-
969
-      this.showMoney = money.toFixed(2)
970
-
971
-
998
+      console.log(this.showMoney, 'showMoney', money);
999
+      this.showMoney = money
972 1000
     },
973 1001
 
974 1002
 
@@ -1005,10 +1033,13 @@ export default {
1005 1033
         this.$set(this.programmeList[index], 'onSelect', true)
1006 1034
       }
1007 1035
     },
1008
-    onSubmit () {
1009
-
1010
-    },
1011
-    submitFrequency () { },
1036
+    //获取订单折扣类型
1037
+    getOrderDiscount () {
1038
+      api.getOrderDiscount({ id: this.id }).then(res => {
1039
+        this.discount = res.data.discount
1040
+        this.getOrderInfo()
1041
+      })
1042
+    }
1012 1043
   },
1013 1044
 
1014 1045
   created () {
@@ -1016,8 +1047,10 @@ export default {
1016 1047
     if (id) {
1017 1048
       this.id = id
1018 1049
     }
1019
-    this.getOrderInfo()
1050
+
1020 1051
     this.getProjectList()
1052
+    this.getOrderDiscount()
1053
+
1021 1054
   },
1022 1055
 
1023 1056
   mounted () {

+ 4 - 3
src/pages/confirmOrder/index.vue

@@ -30,7 +30,7 @@ export default {
30 30
         this.ticket = res.data.ticket
31 31
         this.$nextTick(() => {
32 32
           this.bindQRCode();
33
-          // this.checkCode()
33
+          this.checkCode()
34 34
         })
35 35
       })
36 36
     },
@@ -39,13 +39,14 @@ export default {
39 39
         api.checkCode({ ticket: this.ticket }).then(res => {
40 40
           if (res.data.status == 1) {
41 41
             clearInterval(this.checkCodeInterval)
42
+            this.getOrderByCode()
42 43
           }
43 44
         })
44 45
       }, 1000)
45 46
       //十分钟强制清除,防止页面崩溃
46 47
       this.checkCodeTimeout = setTimeout(() => {
47 48
         clearTimeout(this.checkCodeTimeout)
48
-      }, 600000)
49
+      }, 360000)
49 50
     },
50 51
     getOrderByCode () {
51 52
       api.getOrderByCode({ ticket: this.ticket }).then(res => {
@@ -53,7 +54,7 @@ export default {
53 54
           this.$router.push({
54 55
             path: '/confirmOrder/details',
55 56
             query: {
56
-              id: res.order_id
57
+              id: res.data.order_id
57 58
             }
58 59
           })
59 60
         }

+ 0 - 3
src/pages/customerMan/details/index.vue

@@ -206,7 +206,6 @@ export default {
206 206
         this.lableList = res.data.tags;
207 207
         this.order_total = res.data.order_total;
208 208
         this.programmeList = res.data.scheme_list;
209
-
210 209
         // this.programmeList = res.data.order_data.project_list;
211 210
         // this.coupon_list = res.data.order_data.coupon_list;
212 211
       });
@@ -238,8 +237,6 @@ export default {
238 237
         }
239 238
       });
240 239
     },
241
-    onSubmit () { },
242
-    submitFrequency () { }
243 240
   },
244 241
 
245 242
   created () {

+ 42 - 19
src/pages/customerMan/myOrder/index.vue

@@ -2,6 +2,7 @@
2 2
   <div class="order">
3 3
     <div class="warp">
4 4
       <el-tabs type="border-card"
5
+               @tab-click="changeTab"
5 6
                v-model="activeName">
6 7
         <el-tab-pane label="项目订单"
7 8
                      name="first">
@@ -51,10 +52,9 @@
51 52
             <div class="pagin">
52 53
               <el-pagination background
53 54
                              layout="prev, pager, next"
54
-                             @size-change="handleSizeChange"
55 55
                              @current-change="handleCurrentChange"
56 56
                              :current-page.sync="currentPage1"
57
-                             :total="1000"></el-pagination>
57
+                             :total="total"></el-pagination>
58 58
             </div>
59 59
           </div>
60 60
         </el-tab-pane>
@@ -65,8 +65,7 @@
65 65
                       :data="couponData"
66 66
                       tooltip-effect="dark"
67 67
                       height="354"
68
-                      style="width: 100%;border-radius: 8px;"
69
-                      @row-click="handleSelectionChange">
68
+                      style="width: 100%;border-radius: 8px;">
70 69
 
71 70
               <!-- create_time: "2022-03-10 10:39:19"
72 71
 ex_time: "2022.03.17 23:59"
@@ -104,10 +103,9 @@ type: "全额券" -->
104 103
             <div class="pagin">
105 104
               <el-pagination background
106 105
                              layout="prev, pager, next"
107
-                             @size-change="handleSizeChange"
108 106
                              @current-change="handleCurrentChange"
109 107
                              :current-page.sync="currentPage1"
110
-                             :total="1000"></el-pagination>
108
+                             :total="total"></el-pagination>
111 109
             </div>
112 110
           </div>
113 111
         </el-tab-pane>
@@ -119,8 +117,7 @@ type: "全额券" -->
119 117
                       :data="goodData"
120 118
                       tooltip-effect="dark"
121 119
                       height="354"
122
-                      style="width: 100%;border-radius: 8px;"
123
-                      @row-click="handleSelectionChange">
120
+                      style="width: 100%;border-radius: 8px;">
124 121
 
125 122
               <!-- create_time: "2022-03-19 22:53:40"
126 123
 goods: [{order_id: 47, name: "润百颜玻尿酸屏障调理面膜", num: 1}]
@@ -164,10 +161,9 @@ status: 5 -->
164 161
             <div class="pagin">
165 162
               <el-pagination background
166 163
                              layout="prev, pager, next"
167
-                             @size-change="handleSizeChange"
168 164
                              @current-change="handleCurrentChange"
169 165
                              :current-page.sync="currentPage1"
170
-                             :total="1000"></el-pagination>
166
+                             :total="total"></el-pagination>
171 167
             </div>
172 168
           </div>
173 169
         </el-tab-pane>
@@ -238,7 +234,8 @@ export default {
238 234
       couponData: [],
239 235
       goodData: [],
240 236
       projectData: [],
241
-      total: ""
237
+      total: 100,
238
+      limit: 10
242 239
     };
243 240
   },
244 241
   computed: {},
@@ -283,14 +280,36 @@ export default {
283 280
         this.total = res.data.total;
284 281
       });
285 282
     },
286
-
287
-    handleSizeChange (val) {
288
-    },
289 283
     handleCurrentChange (val) {
284
+      this.currentPage1 = val
285
+      if (this.activeName == 'first') {
286
+        this.getUserProject();
287
+      } else if (this.activeName == 'second') {
288
+        this.getUserCoupon();
289
+      } else if (this.activeName == 'third') {
290
+        this.getUserGoods();
291
+      }
292
+    },
293
+    handleSelectionChange (row, column, event) {
294
+      this.$router.push({
295
+        path: "/historicalOrder/details",
296
+        query: {
297
+          id: row.id
298
+        }
299
+      });
290 300
     },
291
-    handleSelectionChange (row, column, event) { },
292 301
     onSubmit () { },
293
-    submitFrequency () { }
302
+    submitFrequency () { },
303
+    changeTab (e) {
304
+      this.currentPage1 = 1
305
+      if (e.index == 0) {
306
+        this.getUserProject();
307
+      } else if (e.index == 1) {
308
+        this.getUserCoupon();
309
+      } else if (e.index == 2) {
310
+        this.getUserGoods();
311
+      }
312
+    }
294 313
   },
295 314
 
296 315
   created () {
@@ -298,9 +317,13 @@ export default {
298 317
     let activeName = this.$route.query.activeName
299 318
     this.activeName = activeName
300 319
     this.id = id;
301
-    this.getUserCoupon();
302
-    this.getUserGoods();
303
-    this.getUserProject();
320
+    if (this.activeName == 'first') {
321
+      this.getUserProject();
322
+    } else if (this.activeName == 'second') {
323
+      this.getUserCoupon();
324
+    } else if (this.activeName == 'third') {
325
+      this.getUserGoods();
326
+    }
304 327
   },
305 328
 
306 329
   mounted () { }

+ 1 - 10
src/pages/historicalOrder/index.vue

@@ -61,7 +61,7 @@
61 61
                          label="状态"
62 62
                          show-overflow-tooltip>
63 63
           <template slot-scope="scope">
64
-            <div :class="'color'+scope.row.status">{{statusStr[scope.row.status]}}</div>
64
+            <div :style="scope.row.status==0?'color: #FC3019':scope.row.status==5?'color: #A999EA':'color: #61D09D;'">{{ scope.row.status==0?'未支付':scope.row.status==5?'已取消':'待使用' }}</div>
65 65
           </template>
66 66
         </el-table-column>
67 67
       </el-table>
@@ -92,15 +92,6 @@ export default {
92 92
       total: 0,
93 93
       product: "",
94 94
       coupon: "",
95
-      statusStr: [
96
-        "已预约",
97
-        "未支付",
98
-        "已支付",
99
-        "待使用",
100
-        "正在使用",
101
-        "已结算",
102
-        "已取消"
103
-      ],
104 95
       couponList: [
105 96
         {
106 97
           value: "选项1",

+ 16 - 8
src/pages/home/index.vue

@@ -72,7 +72,7 @@ export default {
72 72
           image: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/make.png',
73 73
           num: 0,
74 74
           name: '预约订单',
75
-          type: 1,
75
+          type: 0,
76 76
         },
77 77
         {
78 78
           image: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/unpaid.png',
@@ -138,13 +138,21 @@ export default {
138 138
 
139 139
     },
140 140
     toOrderDetails (e) {
141
-      if (e.status != 0) return
142
-      this.$router.push({
143
-        path: '/confirmOrder/details',
144
-        query: {
145
-          id: e.id
146
-        }
147
-      })
141
+      if (e.status == 0) {
142
+        this.$router.push({
143
+          path: '/confirmOrder/details',
144
+          query: {
145
+            id: e.id
146
+          }
147
+        })
148
+      } else {
149
+        this.$router.push({
150
+          path: "/historicalOrder/details",
151
+          query: {
152
+            id: e.id
153
+          }
154
+        });
155
+      }
148 156
     },
149 157
     initData () {
150 158
 

+ 3 - 0
src/server/home.js

@@ -66,6 +66,9 @@ export default class Home {
66 66
   static payStatus (parms) {
67 67
     return $http.get(url.payStatus, parms);
68 68
   }
69
+  static getOrderDiscount (parms) {
70
+    return $http.get(url.getOrderDiscount, parms);
71
+  }
69 72
 
70 73
   // 获取历史订单
71 74
   static getOrderList (parms) {

+ 2 - 0
src/server/urls.js

@@ -37,6 +37,8 @@ export default {
37 37
   orderPay: '/v2/pad/order/pay',
38 38
   //支付状态
39 39
   payStatus: '/v2/pad/order/pay_status',
40
+  //活动折扣
41
+  getOrderDiscount: '/v2/pad/order/discount',
40 42
 
41 43
   /**
42 44
    *  by ListKer