Browse Source

feat: 更改优惠券逻辑

黎海 2 years ago
parent
commit
ecee641e6a

+ 151 - 133
src/components/common/layout/layout.vue

@@ -22,8 +22,10 @@
22 22
           {{$route.name}}
23 23
         </div>
24 24
         <div class="right">
25
-          <div @click="onAppMessage" class="news">
26
-            <span class="dot" v-show="hasUnreadMessage"></span>
25
+          <div @click="onAppMessage"
26
+               class="news">
27
+            <span class="dot"
28
+                  v-show="hasUnreadMessage"></span>
27 29
             <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/news.png" />
28 30
           </div>
29 31
           <div class="head-img"><img :src="userInfo.avatar_url"></div>
@@ -46,93 +48,102 @@
46 48
     </div>
47 49
     <minePupop :show="msgPupopVisible">
48 50
       <div class="block">
49
-          <div class="title">
50
-            <div @click="clearUnreadMsgsByType(0)" class="clear">
51
-              <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/clearMsg.png" alt="">
52
-              <div class="">清除未读</div>
53
-            </div>
54
-            <div class="txt">消息</div>
55
-            <div class="delete-pupop" @click="closeMsgPanel">
56
-              <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/delete.png" alt />
57
-            </div>
51
+        <div class="title">
52
+          <div @click="clearUnreadMsgsByType(0)"
53
+               class="clear">
54
+            <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/clearMsg.png"
55
+                 alt="">
56
+            <div class="">清除未读</div>
58 57
           </div>
59
-          <div class="msg-con">
60
-            <van-list 
61
-              v-model="mainPanelMsgListLoading"
62
-              :finished="mainPanelMsgListFinished"
63
-              finished-text="没有更多了"
64
-              @load="getMainPanelMessageList"
65
-              :immediate-check="false"
66
-            >
67
-              <div class="order-msg">
68
-                <div class="success">
69
-                  <div class="flex justify-between" @click="toMsgDetail(1)">
70
-                    <div class="desc flex items-center">
71
-                      <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/make.png" alt="" />
72
-                      <div class="title">预约成功信息</div>
73
-                    </div>
74
-                    <div class="count flex flex-column justify-center items-center">
75
-                      <!-- <div class="time">10:23</div> -->
76
-                      <div class="num" v-if="orderSuccessUnreadNum">{{orderSuccessUnreadNum}}</div>
77
-                    </div>
58
+          <div class="txt">消息</div>
59
+          <div class="delete-pupop"
60
+               @click="closeMsgPanel">
61
+            <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/delete.png"
62
+                 alt />
63
+          </div>
64
+        </div>
65
+        <div class="msg-con">
66
+          <van-list v-model="mainPanelMsgListLoading"
67
+                    :finished="mainPanelMsgListFinished"
68
+                    finished-text="没有更多了"
69
+                    @load="getMainPanelMessageList"
70
+                    :immediate-check="false">
71
+            <div class="order-msg">
72
+              <div class="success">
73
+                <div class="flex justify-between"
74
+                     @click="toMsgDetail(1)">
75
+                  <div class="desc flex items-center">
76
+                    <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/make.png"
77
+                         alt="" />
78
+                    <div class="title">预约成功信息</div>
78 79
                   </div>
79
-                </div>
80
-                <div class="cancel">
81
-                  <div class="flex justify-between" @click="toMsgDetail(2)">
82
-                    <div class="desc flex items-center">
83
-                      <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/cancelOrder.png" alt="" />
84
-                      <div class="title">预约取消信息</div>
85
-                    </div>
86
-                    <div class="count flex flex-column justify-center items-center">
87
-                      <!-- <div class="time">10:23</div> -->
88
-                      <div class="num" v-if="orderCancelUnreadNum">{{orderCancelUnreadNum}}</div>
89
-                    </div>
80
+                  <div class="count flex flex-column justify-center items-center">
81
+                    <!-- <div class="time">10:23</div> -->
82
+                    <div class="num"
83
+                         v-if="orderSuccessUnreadNum">{{orderSuccessUnreadNum}}</div>
90 84
                   </div>
91 85
                 </div>
92 86
               </div>
93
-              <div class="ready-msg flex justify-between items-center" 
94
-                v-for="(item, index) in msgPanelList" 
95
-                :key="index"
96
-                @click="readMsgToOrderDetails(item)"
97
-              >
98
-                <div class="content-bar flex flex-column">
99
-                  <div class="desc-info">{{item.project_name}}</div>
100
-                  <div class="desc-time">{{`${item.device_name} (${item.room}) 还有${item.minute}分钟开始` | ellipsis(80)}}</div>
101
-                </div>
102
-                <div class="count flex flex-column items-center">
103
-                  <div class="time">{{item.create_time}}</div>
104
-                  <div class="dot" v-if="!item.is_read && allUnread"></div>
87
+              <div class="cancel">
88
+                <div class="flex justify-between"
89
+                     @click="toMsgDetail(2)">
90
+                  <div class="desc flex items-center">
91
+                    <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/cancelOrder.png"
92
+                         alt="" />
93
+                    <div class="title">预约取消信息</div>
94
+                  </div>
95
+                  <div class="count flex flex-column justify-center items-center">
96
+                    <!-- <div class="time">10:23</div> -->
97
+                    <div class="num"
98
+                         v-if="orderCancelUnreadNum">{{orderCancelUnreadNum}}</div>
99
+                  </div>
105 100
                 </div>
106 101
               </div>
107
-            </van-list>
108
-          </div>
102
+            </div>
103
+            <div class="ready-msg flex justify-between items-center"
104
+                 v-for="(item, index) in msgPanelList"
105
+                 :key="index"
106
+                 @click="readMsgToOrderDetails(item)">
107
+              <div class="content-bar flex flex-column">
108
+                <div class="desc-info">{{item.project_name}}</div>
109
+                <div class="desc-time">{{`${item.device_name} (${item.room}) 还有${item.minute}分钟开始` | ellipsis(80)}}</div>
110
+              </div>
111
+              <div class="count flex flex-column items-center">
112
+                <div class="time">{{item.create_time}}</div>
113
+                <div class="dot"
114
+                     v-if="!item.is_read && allUnread"></div>
115
+              </div>
116
+            </div>
117
+          </van-list>
118
+        </div>
109 119
       </div>
110 120
     </minePupop>
111 121
     <minePupop :show="msgSuccessDetailPupopVisible">
112 122
       <div class="block detail">
113 123
         <div class="title">
114
-          <div @click="backMsgPanel" class="back flex items-center">
115
-            <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/back.png" alt="" />
124
+          <div @click="backMsgPanel"
125
+               class="back flex items-center">
126
+            <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/back.png"
127
+                 alt="" />
116 128
           </div>
117 129
           <div class="txt">消息</div>
118
-          <div class="delete-msg flex items-center" @click="clearUnreadMsgsByType(1)">
119
-            <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/clearMsg.png" alt />
130
+          <div class="delete-msg flex items-center"
131
+               @click="clearUnreadMsgsByType(1)">
132
+            <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/clearMsg.png"
133
+                 alt />
120 134
             <div class="">清除未读</div>
121 135
           </div>
122 136
         </div>
123 137
         <div class="detail-msg-con">
124
-          <van-list 
125
-            v-model="detailSuccessMsgListLoading"
126
-            :finished="detailSuccessMsgListFinished"
127
-            finished-text="没有更多了"
128
-            @load="getMessageByType(orderMsgType)"
129
-            :immediate-check="false"
130
-          >
131
-            <div class="msg-bar flex justify-between items-center" 
132
-              v-for="(item, index) in msgSuccessDetailList" 
133
-              :key="index"
134
-              @click="readMsgToOrderDetails(item)"
135
-            >
138
+          <van-list v-model="detailSuccessMsgListLoading"
139
+                    :finished="detailSuccessMsgListFinished"
140
+                    finished-text="没有更多了"
141
+                    @load="getMessageByType(orderMsgType)"
142
+                    :immediate-check="false">
143
+            <div class="msg-bar flex justify-between items-center"
144
+                 v-for="(item, index) in msgSuccessDetailList"
145
+                 :key="index"
146
+                 @click="readMsgToOrderDetails(item)">
136 147
               <div class="info flex">
137 148
                 <div class="name">{{item.nickname}}</div>
138 149
                 <div class="project">成功预约{{item.order_time}}</div>
@@ -140,7 +151,8 @@
140 151
               </div>
141 152
               <div class="flex flex-column items-center">
142 153
                 <div class="time">{{item.create_time}}</div>
143
-                <div class="dot" v-if="!item.is_read && successUnread"></div>
154
+                <div class="dot"
155
+                     v-if="!item.is_read && successUnread"></div>
144 156
               </div>
145 157
             </div>
146 158
           </van-list>
@@ -150,28 +162,29 @@
150 162
     <minePupop :show="msgCancelDetailPupopVisible">
151 163
       <div class="block detail">
152 164
         <div class="title">
153
-          <div @click="backMsgPanel" class="back flex items-center">
154
-            <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/back.png" alt="" />
165
+          <div @click="backMsgPanel"
166
+               class="back flex items-center">
167
+            <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/back.png"
168
+                 alt="" />
155 169
           </div>
156 170
           <div class="txt">消息</div>
157
-          <div class="delete-msg flex items-center" @click="clearUnreadMsgsByType(2)">
158
-            <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/clearMsg.png" alt />
171
+          <div class="delete-msg flex items-center"
172
+               @click="clearUnreadMsgsByType(2)">
173
+            <img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/clearMsg.png"
174
+                 alt />
159 175
             <div class="">清除未读</div>
160 176
           </div>
161 177
         </div>
162 178
         <div class="detail-msg-con">
163
-          <van-list 
164
-            v-model="detailCancelMsgListLoading"
165
-            :finished="detailCancelMsgListFinished"
166
-            finished-text="没有更多了"
167
-            @load="getMessageByType(orderMsgType)"
168
-            :immediate-check="false"
169
-          >
179
+          <van-list v-model="detailCancelMsgListLoading"
180
+                    :finished="detailCancelMsgListFinished"
181
+                    finished-text="没有更多了"
182
+                    @load="getMessageByType(orderMsgType)"
183
+                    :immediate-check="false">
170 184
             <div class="msg-bar flex justify-between items-center"
171
-              v-for="(item, index) in msgCancelDetailList"
172
-              :key="index"
173
-              @click="readMsgToOrderDetails(item)"
174
-            >
185
+                 v-for="(item, index) in msgCancelDetailList"
186
+                 :key="index"
187
+                 @click="readMsgToOrderDetails(item)">
175 188
               <div class="info flex">
176 189
                 <div class="name">{{item.nickname}}</div>
177 190
                 <div class="project">取消预约{{item.order_time}}</div>
@@ -179,20 +192,27 @@
179 192
               </div>
180 193
               <div class="flex flex-column items-center">
181 194
                 <div class="time">{{item.create_time}}</div>
182
-                <div class="dot" v-if="!item.is_read"></div>
195
+                <div class="dot"
196
+                     v-if="!item.is_read"></div>
183 197
               </div>
184 198
             </div>
185 199
           </van-list>
186 200
         </div>
187 201
       </div>
188 202
     </minePupop>
189
-    <audio ref="orderSuccessMp3" id="orderSuccessMp3" muted>
203
+    <audio ref="orderSuccessMp3"
204
+           id="orderSuccessMp3"
205
+           muted>
190 206
       <source src="@/assets/audio/order_success.mp3" />
191 207
     </audio>
192
-    <audio ref="orderReadyMp3_15" id="orderReadyMp3_15" muted>
208
+    <audio ref="orderReadyMp3_15"
209
+           id="orderReadyMp3_15"
210
+           muted>
193 211
       <source src="@/assets/audio/order_ready_15.mp3" />
194 212
     </audio>
195
-    <audio ref="orderReadyMp3_5" id="orderReadyMp3_5" muted>
213
+    <audio ref="orderReadyMp3_5"
214
+           id="orderReadyMp3_5"
215
+           muted>
196 216
       <source src="@/assets/audio/order_ready_5.mp3" />
197 217
     </audio>
198 218
   </div>
@@ -249,7 +269,6 @@ export default {
249 269
   },
250 270
   async created () {
251 271
     this.getUserInfo()
252
-
253 272
     console.log('开始连接...')
254 273
     let token = this.$store.state.comVal.token || localStorage.getItem('token')
255 274
     //申请一个WebSocket对象,参数是服务端地址,同http协议使用http://开头一样,WebSocket协议的url使用ws://开头,另外安全的WebSocket协议使用wss://开头
@@ -258,12 +277,12 @@ export default {
258 277
       //当WebSocket创建成功时,触发onopen事件
259 278
       console.log("连接成功");
260 279
       this.timer = setInterval(() => {
261
-        this.wsInstance.send(JSON.stringify({type:'ping'}));
280
+        this.wsInstance.send(JSON.stringify({ type: 'ping' }));
262 281
       }, 30000);
263 282
     }
264 283
     this.wsInstance.onmessage = (e) => {
265 284
       //当客户端收到服务端发来的消息时,触发onmessage事件,参数e.data包含server传递过来的数据
266
-      console.log('收到消息',e.data)
285
+      console.log('收到消息', e.data)
267 286
       let data = JSON.parse(e.data);
268 287
       if (data.data.type === 'order_success') {
269 288
         console.log('预约成功信息播报')
@@ -289,11 +308,11 @@ export default {
289 308
     }
290 309
 
291 310
     await this.queryHasUnreadMessage()
292
-    this.timer1 = setInterval(async() => {
311
+    this.timer1 = setInterval(async () => {
293 312
       await this.queryHasUnreadMessage()
294 313
     }, 20000)
295 314
   },
296
-  mounted () {},
315
+  mounted () { },
297 316
   beforeDestroy () {
298 317
     // 关闭WebSocket连接并清除定时器
299 318
     this.wsInstance.close()
@@ -330,7 +349,7 @@ export default {
330 349
       this.wsInstance.close()
331 350
       clearInterval(this.timer)
332 351
       clearInterval(this.timer1)
333
-      
352
+
334 353
       this.$router.replace('/login')
335 354
     },
336 355
     changeMenu (index) {
@@ -345,28 +364,28 @@ export default {
345 364
     async queryHasUnreadMessage () {
346 365
       let resp = await api.hasUnreadMessage()
347 366
       if (resp.code === 200) {
348
-        this.hasUnreadMessage =  resp.data ? true : false
367
+        this.hasUnreadMessage = resp.data ? true : false
349 368
       }
350 369
     },
351 370
     async getMainPanelMessageList (page = this.mainPanelMessagePage) {
352 371
       // setTimeout(async() => {
353
-        let resp = await api.getMessageList({ page: page, limit: this.mainPanelMessageLimit })
354
-        if (resp.code = 200) {
355
-          this.orderSuccessUnreadNum = resp.data.reserved
356
-          this.orderCancelUnreadNum = resp.data.cancel
372
+      let resp = await api.getMessageList({ page: page, limit: this.mainPanelMessageLimit })
373
+      if (resp.code = 200) {
374
+        this.orderSuccessUnreadNum = resp.data.reserved
375
+        this.orderCancelUnreadNum = resp.data.cancel
357 376
 
358
-          if (this.mainPanelMessagePage === 1) {
359
-            this.msgPanelList = resp.data.list
360
-          } else {
361
-            this.msgPanelList = [...this.msgPanelList, ...resp.data.list]
362
-          }
377
+        if (this.mainPanelMessagePage === 1) {
378
+          this.msgPanelList = resp.data.list
379
+        } else {
380
+          this.msgPanelList = [...this.msgPanelList, ...resp.data.list]
381
+        }
363 382
 
364
-          this.mainPanelMessagePage++
365
-          this.mainPanelMsgListLoading = false;
366
-          if (this.msgPanelList.length >= resp.data.total) {
367
-            this.mainPanelMsgListFinished = true;
368
-          }
383
+        this.mainPanelMessagePage++
384
+        this.mainPanelMsgListLoading = false;
385
+        if (this.msgPanelList.length >= resp.data.total) {
386
+          this.mainPanelMsgListFinished = true;
369 387
         }
388
+      }
370 389
       // }, 1000);
371 390
     },
372 391
     async getMessageByType (type, page = this.detailSuccessMessagePage) {
@@ -379,7 +398,7 @@ export default {
379 398
           } else {
380 399
             this.msgSuccessDetailList = [...this.msgSuccessDetailList, ...resp.data.list]
381 400
           }
382
-          
401
+
383 402
           this.detailSuccessMessagePage++
384 403
           this.detailSuccessMsgListLoading = false;
385 404
           if (this.msgSuccessDetailList.length >= resp.data.total) {
@@ -420,20 +439,20 @@ export default {
420 439
       this.msgPupopVisible = false
421 440
       // this.getMessageByType(param)
422 441
       if (param === 1) {
423
-      this.msgSuccessDetailList = []
424
-      this.detailSuccessMessagePage = 1
425
-      this.detailSuccessMsgListLoading = false
426
-      this.detailSuccessMsgListFinished = false
427
-      this.getMessageByType(param, 1)
442
+        this.msgSuccessDetailList = []
443
+        this.detailSuccessMessagePage = 1
444
+        this.detailSuccessMsgListLoading = false
445
+        this.detailSuccessMsgListFinished = false
446
+        this.getMessageByType(param, 1)
428 447
 
429 448
         this.msgSuccessDetailPupopVisible = true
430 449
       } else {
431
-      this.msgCancelDetailList = []
432
-      this.detailCancelMessagePage = 1
433
-      this.detailCancelMsgListLoading = false
434
-      this.detailCancelMsgListFinished = false
435
-      
436
-      this.getMessageByType(param, 1)
450
+        this.msgCancelDetailList = []
451
+        this.detailCancelMessagePage = 1
452
+        this.detailCancelMsgListLoading = false
453
+        this.detailCancelMsgListFinished = false
454
+
455
+        this.getMessageByType(param, 1)
437 456
 
438 457
         this.msgCancelDetailPupopVisible = true
439 458
       }
@@ -443,7 +462,7 @@ export default {
443 462
     backMsgPanel () {
444 463
       this.msgSuccessDetailPupopVisible = false
445 464
       this.msgCancelDetailPupopVisible = false
446
-      
465
+
447 466
       this.getMainPanelMessageList()
448 467
       this.msgPupopVisible = true
449 468
     },
@@ -465,7 +484,7 @@ export default {
465 484
     async readMsgToOrderDetails (source) {
466 485
       // console.log(source)
467 486
       if (!source.is_read) {
468
-        let clearMsgByIdResp = await api.clearMessageById({id: source.id})
487
+        let clearMsgByIdResp = await api.clearMessageById({ id: source.id })
469 488
         if (clearMsgByIdResp.code === 200) {
470 489
           this.getMainPanelMessageList()
471 490
         }
@@ -490,7 +509,7 @@ export default {
490 509
           this.msgPupopVisible = false
491 510
           this.msgSuccessDetailPupopVisible = false
492 511
           this.msgCancelDetailPupopVisible = false
493
-          
512
+
494 513
           this.$router.push({
495 514
             path: "/historicalOrder/details",
496 515
             query: {
@@ -528,7 +547,7 @@ export default {
528 547
       },
529 548
       set (val) {
530 549
         this.MsgType = val
531
-      } 
550
+      }
532 551
     }
533 552
   },
534 553
 }
@@ -671,7 +690,7 @@ export default {
671 690
   width: 9px;
672 691
   height: 9px;
673 692
   border-radius: 50%;
674
-  background-color: #FF6945;
693
+  background-color: #ff6945;
675 694
   margin-top: 10px;
676 695
 }
677 696
 .dot-activated {
@@ -717,7 +736,8 @@ export default {
717 736
     overflow: auto;
718 737
     margin-top: 21px;
719 738
     .order-msg {
720
-      .success, .cancel {
739
+      .success,
740
+      .cancel {
721 741
         .desc {
722 742
           img {
723 743
             width: 36px;
@@ -744,8 +764,7 @@ export default {
744 764
             box-sizing: border-box;
745 765
             color: #ffffff;
746 766
             border-radius: 50%;
747
-            background-color: #FF6945;
748
-            
767
+            background-color: #ff6945;
749 768
           }
750 769
         }
751 770
       }
@@ -766,7 +785,6 @@ export default {
766 785
           font-weight: 500;
767 786
           line-height: 18px;
768 787
         }
769
-        
770 788
       }
771 789
       .count {
772 790
         .time {

+ 54 - 6
src/pages/confirmOrder/addOrder/index.vue

@@ -238,8 +238,12 @@
238 238
                      size="mini">
239 239
             <el-option v-for="item in classifyList"
240 240
                        :key="item.id"
241
+                       style=" display: flex;justify-content: space-between ;align-items: center;line-height: inherit;"
241 242
                        :label="item.name"
242 243
                        :value="item.id">
244
+              <span style="float: left">{{ item.name }}</span>
245
+              <span v-if="item.recommend==1"
246
+                    style="float: right;color: #fa7d22ff;font-size: 13px;background: #ffefeb;border-radius: 4px;border: 1px solid #fa7d22;height: 18px;padding: 2px 6px;">推荐</span>
243 247
             </el-option>
244 248
           </el-select>
245 249
         </div>
@@ -252,8 +256,13 @@
252 256
                      size="mini">
253 257
             <el-option v-for="item in projectList"
254 258
                        :key="item.id"
259
+                       style=" display: flex;justify-content: space-between ;align-items: center;line-height: inherit; padding: 0 12px;"
255 260
                        :label="item.name"
256
-                       :value="item.id"></el-option>
261
+                       :value="item.id">
262
+              <span style="float: left">{{ item.name |ellipsis(14) }}</span>
263
+              <span v-if="item.recommend==1"
264
+                    style="float: right;color: #fa7d22ff;font-size: 13px;background: #ffefeb;border-radius: 4px;border: 1px solid #fa7d22;height: 18px;padding: 2px 6px;">推荐</span>
265
+            </el-option>
257 266
           </el-select>
258 267
         </div>
259 268
         <div class="products-select">
@@ -496,6 +505,7 @@ export default {
496 505
       });
497 506
     },
498 507
     addProject () {
508
+      this.classifyInfo = ""
499 509
       this.projectInfo = "";
500 510
       this.productsInfo = "";
501 511
       this.isEditProject = false;
@@ -614,11 +624,48 @@ export default {
614 624
         );
615 625
         return;
616 626
       }
617
-      this.getWeekDate();
618
-      this.getOrderTime();
619
-      this.order_time = "";
620
-      this.tsTableIndex = 0;
621
-      this.isTs = true;
627
+
628
+      let that = this;
629
+      let order_data = [];
630
+      this.order_data.project_list.forEach(item => {
631
+        let order_data_info = {};
632
+        order_data_info["id"] = item.id;
633
+        if (item.product_ids != "") {
634
+          order_data_info["product_id"] = item.product_ids;
635
+        }
636
+        order_data.push(order_data_info);
637
+      });
638
+      let params = {
639
+        user_id: this.userInfo.user_id,
640
+        order_data: JSON.stringify(order_data),
641
+        // order_day: this.tsTableList[this.tsTableIndex].order_day,
642
+        // order_time: this.timeIndexText
643
+      };
644
+      this.$loading({
645
+        lock: true,
646
+        text: '加载中',
647
+        spinner: 'el-icon-loading',
648
+        background: 'rgba(0, 0, 0, 0.7)'
649
+      })
650
+      api.padOrderAdd(params).then(res => {
651
+        if (res.code == 200) {
652
+          this.$loading().close()
653
+          // 关闭当前页面并且跳转
654
+          that.$router.push({
655
+            path: "/confirmOrder/details",
656
+            query: {
657
+              id: res.data.order_id
658
+            }
659
+          });
660
+        }
661
+      });
662
+
663
+
664
+      // this.getWeekDate();
665
+      // this.getOrderTime();
666
+      // this.order_time = "";
667
+      // this.tsTableIndex = 0;
668
+      // this.isTs = true;
622 669
     },
623 670
     //确定时间选择
624 671
     comfigTs () {
@@ -1239,6 +1286,7 @@ export default {
1239 1286
       overflow: scroll;
1240 1287
       .coupon-info {
1241 1288
         width: 345px;
1289
+        height: fit-content;
1242 1290
         margin-bottom: 20px;
1243 1291
         padding: 20px 14px 10px 14px;
1244 1292
         position: relative;

+ 184 - 34
src/pages/confirmOrder/details/index.vue

@@ -203,9 +203,19 @@
203 203
              @click="isCoupun=false"><img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/delete.png"
204 204
                alt=""></div>
205 205
         <div class="coupon-pupop-title">选择优惠券</div>
206
+        <div class="tatle">
207
+          <div class="tatle-list">
208
+            <div :class="['tatle-info',item.display==true?'tatle-info-active':'']"
209
+                 v-for="item,index in couponTatleList"
210
+                 @click="changeTable(item,index)"
211
+                 :key="index">{{item.name}}</div>
212
+          </div>
213
+        </div>
206 214
         <ul class="coupon-lists">
207 215
           <li class="coupon-info"
208 216
               v-for="item,index in couponList"
217
+              @click="selectPupop(item,index)"
218
+              :style="item.isSelect?'border: 1px solid #FA7D22;':''"
209 219
               :key="index">
210 220
             <!-- 1: '抵扣券',
211 221
       2: '满减券',
@@ -221,13 +231,12 @@
221 231
                 <div class="price-tips">{{item.full_price}}</div>
222 232
               </div>
223 233
               <div class="coupon-tip">
224
-                <div class="tips-title">{{item.coupon_name}}</div>
225
-                <div class="tips-ts">有效期至{{item.ex_time}}</div>
234
+                <div class="tips-title">{{item.coupon_name | ellipsis(14)}}</div>
235
+                <!-- <div class="tips-ts">有效期至{{item.ex_time}}</div> -->
226 236
               </div>
227
-              <div class="choice-icon"
228
-                   @click="selectPupop(item,index)"><img :src="item.isSelect?select:unSelect"></div>
237
+              <div class="choice-icon"><img :src="item.isSelect?select:unSelect"></div>
229 238
             </div>
230
-            <div class="bottom">
239
+            <!-- <div class="bottom">
231 240
               <div class="coupon-notes"
232 241
                    @click="isOver=!isOver">
233 242
                 <div class="notes-text min-size">
@@ -237,7 +246,7 @@
237 246
                 <div class="notes-icon"><img :src="isOver?open:unOpen"
238 247
                        alt=""></div>
239 248
               </div>
240
-            </div>
249
+            </div> -->
241 250
           </li>
242 251
         </ul>
243 252
         <div class="coupon-confirm"
@@ -259,8 +268,12 @@
259 268
                      size="mini">
260 269
             <el-option v-for="item in classifyList"
261 270
                        :key="item.id"
271
+                       style=" display: flex;justify-content: space-between ;align-items: center;line-height: inherit;"
262 272
                        :label="item.name"
263 273
                        :value="item.id">
274
+              <span style="float: left">{{ item.name }}</span>
275
+              <span v-if="item.recommend==1"
276
+                    style="float: right;color: #fa7d22ff;font-size: 13px;background: #ffefeb;border-radius: 4px;border: 1px solid #fa7d22;height: 18px;padding: 2px 6px;">推荐</span>
264 277
             </el-option>
265 278
           </el-select>
266 279
         </div>
@@ -274,7 +287,11 @@
274 287
             <el-option v-for="item in projectList"
275 288
                        :key="item.id"
276 289
                        :label="item.name"
290
+                       style=" display: flex;justify-content: space-between ;align-items: center;line-height: inherit; padding: 0 12px;"
277 291
                        :value="item.id">
292
+              <span style="float: left">{{ item.name |ellipsis(14) }}</span>
293
+              <span v-if="item.recommend==1"
294
+                    style="float: right;color: #fa7d22ff;font-size: 13px;background: #ffefeb;border-radius: 4px;border: 1px solid #fa7d22;height: 18px;padding: 2px 6px;">推荐</span>
278 295
             </el-option>
279 296
           </el-select>
280 297
         </div>
@@ -422,9 +439,11 @@
422 439
           </div>
423 440
         </div>
424 441
         <div v-else>
425
-          <div class="pay-title">支付成</div>
442
+          <div class="pay-title">支付成</div>
426 443
           <div class="pay-suc"><img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/paySuc.png"
427 444
                  alt=""></div>
445
+          <div class="suc-tips">美容项目即将开始</div>
446
+          <div class="suc-zoom">请带领用户移步到 <span class="device_name">{{device_name}}</span> <span class="zoom">{{room}}</span></div>
428 447
           <div class="pay-button"
429 448
                @click="toHome">返回首页</div>
430 449
         </div>
@@ -498,6 +517,25 @@ export default {
498 517
           isSelect: false
499 518
         },
500 519
       ],
520
+      //优惠券类型
521
+      couponTatleList: [
522
+        {
523
+          id: 0,
524
+          name: '用户券',
525
+          display: true
526
+        },
527
+        {
528
+          id: 1,
529
+          name: '美团',
530
+          display: false
531
+        },
532
+        {
533
+          id: 2,
534
+          name: '抖音券',
535
+          display: false
536
+        },
537
+      ],
538
+      platform: 0,
501 539
       timesInfo: '',
502 540
       reservationPrice: 0,//预约费用
503 541
       projectInfo: '',
@@ -530,6 +568,8 @@ export default {
530 568
       showMoney: 0, // 价值总额
531 569
       discountPrice: 0,//活动后金额
532 570
       discount: 0,//折扣类型
571
+      device_name: '',//支付成功后的设备
572
+      room: '',//设备房间
533 573
       // showRuleText: 10086,
534 574
 
535 575
     };
@@ -577,7 +617,6 @@ export default {
577 617
             this.order_data.discountPrice = this.showMoney
578 618
           }
579 619
         })
580
-        console.log(Number(this.order_data.discountPrice).toFixed(2), 'this.order_data.discountPrice.toFixed(2)');
581 620
         this.discountPrice = Number(this.order_data.discountPrice).toFixed(2)
582 621
         this.calculationPrice()
583 622
       })
@@ -626,6 +665,7 @@ export default {
626 665
       })
627 666
     },
628 667
     addProject () {
668
+      this.classifyInfo = ''
629 669
       this.projectInfo = ''
630 670
       this.productsInfo = ''
631 671
       this.isEditProject = false
@@ -732,11 +772,40 @@ export default {
732 772
     //确定订单&支付
733 773
     determine () {
734 774
       if (this.isChange) {
735
-        this.getWeekDate()
736
-        this.getOrderTime()
737
-        this.order_time = ''
738
-        this.tsTableIndex = 0
739
-        this.isTs = true
775
+        let order_data = []
776
+        this.order_data.project_list.forEach(item => {
777
+          let order_data_info = {}
778
+          order_data_info['id'] = item.id
779
+          if (item.product_ids != "") {
780
+            order_data_info['product_id'] = item.product_ids
781
+          }
782
+          order_data.push(order_data_info)
783
+        })
784
+        let params = {
785
+          id: this.id,
786
+          order_data: JSON.stringify(order_data),
787
+          // order_day: this.tsTableList[this.tsTableIndex].order_day,
788
+          // order_time: this.timeIndexText
789
+        }
790
+        this.$loading({
791
+          lock: true,
792
+          text: '加载中',
793
+          spinner: 'el-icon-loading',
794
+          background: 'rgba(0, 0, 0, 0.7)'
795
+        })
796
+        api.setOrderUpdate(params).then(res => {
797
+          this.$loading().close()
798
+          if (res.code == 200) {
799
+            this.getOrderInfo()
800
+            this.isTs = false
801
+            this.isChange = false
802
+          }
803
+        })
804
+        // this.getWeekDate()
805
+        // this.getOrderTime()
806
+        // this.order_time = ''
807
+        // this.tsTableIndex = 0
808
+        // this.isTs = true
740 809
       } else {
741 810
         this.choicePayType = true
742 811
       }
@@ -780,17 +849,33 @@ export default {
780 849
         this.reservationPrice += Number(res.price)
781 850
       })
782 851
     },
852
+    //切换优惠券tatle
853
+    changeTable (item, index) {
854
+      this.couponTatleList.forEach((res, i) => {
855
+        if (index == i) {
856
+          res.display = true
857
+          this.platform = item.id
858
+          this.couponList = []
859
+          this.page = 1
860
+          this.onCoupon()
861
+        } else {
862
+          res.display = false
863
+        }
864
+      })
865
+    },
783 866
 
784 867
     //获取订单优惠券
868
+
785 869
     onCoupon () {
786 870
       if (this.couponList.length > 0) {
787 871
         this.isCoupun = true
788 872
         return
789 873
       }
790
-
874
+      // platform 优惠券平台,0本地(用户券:默认),1美团券,2抖音券
791 875
       let params = {
792 876
         id: this.id,
793 877
         page: this.page,
878
+        platform: this.platform,
794 879
         limit: this.limit
795 880
       }
796 881
       api.getOrderCoupon(params).then(res => {
@@ -830,13 +915,17 @@ export default {
830 915
       let coupon_data = []
831 916
       if (this.isSelectCoup.length > 0) {
832 917
         this.isSelectCoup.forEach(item => {
833
-          if (item.type != 4) {
834
-            params['coupon_id'] = item.id
918
+          if (this.platform != 0) {
919
+            params['scoupon_id'] = item.id
835 920
           } else {
836
-            let couponInfo = {}
837
-            couponInfo['id'] = item.projectids
838
-            couponInfo['coupon_id'] = item.id
839
-            coupon_data.push(couponInfo)
921
+            if (item.type != 4) {
922
+              params['coupon_id'] = item.id
923
+            } else {
924
+              let couponInfo = {}
925
+              couponInfo['id'] = item.projectids
926
+              couponInfo['coupon_id'] = item.id
927
+              coupon_data.push(couponInfo)
928
+            }
840 929
           }
841 930
         })
842 931
       }
@@ -863,7 +952,6 @@ export default {
863 952
             }, 1000)
864 953
           }
865 954
         }
866
-
867 955
       })
868 956
     },
869 957
     changePayStatus () {
@@ -876,6 +964,8 @@ export default {
876 964
       api.payStatus({ id: this.id, }).then(res => {
877 965
         if (res.data.pay_status == 1) {
878 966
           clearInterval(this.payStatusInterval)
967
+          this.device_name = res.data.device_name
968
+          this.room = res.data.room
879 969
           this.isPayCode = false
880 970
         }
881 971
       })
@@ -1629,7 +1719,7 @@ export default {
1629 1719
     background: #ffffff;
1630 1720
     border-radius: 8px;
1631 1721
     position: relative;
1632
-    padding: 42px;
1722
+    padding: 40px 20px;
1633 1723
     .delete-pupop {
1634 1724
       width: 32px;
1635 1725
       position: absolute;
@@ -1647,29 +1737,60 @@ export default {
1647 1737
       line-height: 20px;
1648 1738
       text-align: center;
1649 1739
     }
1740
+    .tatle {
1741
+      margin-top: 20px;
1742
+      .tatle-list {
1743
+        display: flex;
1744
+        padding-left: 20px;
1745
+        .tatle-info {
1746
+          width: 104px;
1747
+          height: 30px;
1748
+          line-height: 30px;
1749
+          margin-left: 10px;
1750
+          background: #f7f8fa;
1751
+          border-radius: 10px 10px 0px 0px;
1752
+          font-size: 14px;
1753
+          font-family: PingFangSC-Regular, PingFang SC;
1754
+          font-weight: 400;
1755
+          color: #999999;
1756
+          text-align: center;
1757
+        }
1758
+        .tatle-info-active {
1759
+          background: #fffaf6;
1760
+          color: #fa7d22;
1761
+        }
1762
+      }
1763
+    }
1650 1764
     .coupon-lists {
1651 1765
       display: inline-block;
1652 1766
       position: relative;
1767
+      width: 100%;
1768
+      background: #fffaf6;
1769
+      border-radius: 8px;
1653 1770
       left: 50%;
1654 1771
       transform: translateX(-50%);
1655
-      margin-top: 20px;
1772
+      padding: 10px 10px 0 10px;
1773
+      display: flex;
1774
+      flex-wrap: wrap;
1656 1775
       height: 228px;
1657 1776
       overflow: scroll;
1658 1777
       .coupon-info {
1659
-        width: 345px;
1778
+        margin-left: 10px;
1779
+        width: 225px;
1780
+        height: fit-content;
1660 1781
         margin-bottom: 20px;
1661 1782
         padding: 20px 14px 10px 14px;
1662 1783
         position: relative;
1663
-        background: #fff4e6;
1664
-        border-radius: 12px;
1784
+        background: #ffffff;
1785
+        border-radius: 8px;
1665 1786
         .coupon-tips-text {
1666 1787
           position: absolute;
1667 1788
           left: 0;
1668 1789
           top: 0;
1669 1790
           padding: 0 8px;
1670 1791
           height: 18px;
1671
-          background: #875617;
1672
-          border-radius: 12px 0px 12px 0px;
1792
+          background: #fa7d22;
1793
+          border-radius: 8px 0px 8px 0px;
1673 1794
           font-size: 12px;
1674 1795
           font-family: PingFangSC-Medium, PingFang SC;
1675 1796
           font-weight: 500;
@@ -1681,9 +1802,9 @@ export default {
1681 1802
         .top {
1682 1803
           display: flex;
1683 1804
           justify-content: space-between;
1684
-          align-items: center;
1805
+          align-items: end;
1685 1806
           padding-bottom: 10px;
1686
-          border-bottom: 1px dashed #ffdfb6;
1807
+          // border-bottom: 1px dashed #ffdfb6;
1687 1808
           .all-free {
1688 1809
             font-size: 22px;
1689 1810
             font-family: PingFangSC-Medium, PingFang SC;
@@ -1712,6 +1833,7 @@ export default {
1712 1833
             }
1713 1834
           }
1714 1835
           .discount-over {
1836
+            width: 50px;
1715 1837
             font-size: 22px;
1716 1838
             font-family: PingFangSC-Medium, PingFang SC;
1717 1839
             font-weight: 500;
@@ -1720,10 +1842,11 @@ export default {
1720 1842
           }
1721 1843
           .coupon-tip {
1722 1844
             .tips-title {
1723
-              font-size: 16px;
1845
+              width: 126px;
1846
+              font-size: 14px;
1724 1847
               font-family: PingFangSC-Medium, PingFang SC;
1725 1848
               font-weight: 500;
1726
-              color: #875617;
1849
+              color: #333333;
1727 1850
               line-height: 22px;
1728 1851
             }
1729 1852
             .tips-ts {
@@ -2000,7 +2123,7 @@ export default {
2000 2123
       }
2001 2124
     }
2002 2125
     .pay-title {
2003
-      font-size: 14px;
2126
+      font-size: 16px;
2004 2127
       font-family: PingFangSC-Medium, PingFang SC;
2005 2128
       font-weight: 500;
2006 2129
       color: #333333;
@@ -2009,12 +2132,39 @@ export default {
2009 2132
     }
2010 2133
     .pay-suc {
2011 2134
       margin-top: 40px;
2012
-      margin-bottom: 80px;
2013 2135
       text-align: center;
2014 2136
       img {
2015 2137
         width: 140px;
2016 2138
       }
2017 2139
     }
2140
+    .suc-tips {
2141
+      text-align: center;
2142
+      margin-top: 20px;
2143
+      font-size: 14px;
2144
+      font-family: PingFangSC-Regular, PingFang SC;
2145
+      font-weight: 400;
2146
+      color: #333333;
2147
+      line-height: 20px;
2148
+    }
2149
+    .suc-zoom {
2150
+      text-align: center;
2151
+      margin-top: 23px;
2152
+      font-size: 14px;
2153
+      font-family: PingFangSC-Regular, PingFang SC;
2154
+      font-weight: 400;
2155
+      color: #333333;
2156
+      line-height: 20px;
2157
+      .device_name {
2158
+        margin-left: 10px;
2159
+        color: #fa7d22;
2160
+      }
2161
+      .zoom {
2162
+        margin-left: 10px;
2163
+        font-size: 18px;
2164
+        color: #fa7d22;
2165
+      }
2166
+    }
2167
+
2018 2168
     .pay-price {
2019 2169
       margin-top: 10px;
2020 2170
       font-size: 14px;

+ 21 - 17
vue.config.js

@@ -3,8 +3,12 @@
3 3
 const MiniCssExtractPlugin = require('mini-css-extract-plugin');
4 4
 
5 5
 module.exports = {
6
-  publicPath: process.env.env_config === 'prod' ? 'https://h5-cms-vue.ijolijoli.com/dist' :
6
+  // 测试
7
+  publicPath: process.env.env_config === 'prod' ? 'https://h5-cms-vue.ijolijoli.com/test_pad/dist' :
7 8
     process.env.env_config === 'test' ? '/vapps/calory/' : '/dist/',
9
+  // 正式
10
+  // publicPath: process.env.env_config === 'prod' ? 'https://h5-cms-vue.ijolijoli.com/dist' :
11
+  //   process.env.env_config === 'test' ? '/vapps/calory/' : '/dist/',
8 12
   // 设置跨域
9 13
   crossorigin: 'anonymous',
10 14
   /**
@@ -42,22 +46,22 @@ module.exports = {
42 46
   css: {
43 47
     loaderOptions: {
44 48
       postcss: {
45
-          plugins: [
46
-              require("postcss-px-to-viewport")({
47
-                unitToConvert: "px", // 把什么单位转换成vw
48
-                viewportWidth: 1000, // 视口宽度,设计稿宽度
49
-                viewportHeight: 600, // 视口高度,设计稿高度
50
-                unitPrecision: 5, // 转换成vw单位的小数点后的保留位数
51
-                propList: ["*"], // 属性列表,表示你要把哪些css属性的px转换成vw
52
-                viewportUnit: "vw", // 使用的单位,目前可选单位有vw,vh。
53
-                fontViewportUnit: "vw", // 字体使用的单位
54
-                selectorBlackList: ['van', 'el-'], // 匹配不被转换为vw的选择器
55
-                minPixelValue: 1,
56
-                mediaQuery: false,
57
-                replace: true, // 是否直接更换属性值,而不添加备用属性
58
-                exclude: /(\/|\\)(node_modules)(\/|\\)/,
59
-              })
60
-          ]
49
+        plugins: [
50
+          require("postcss-px-to-viewport")({
51
+            unitToConvert: "px", // 把什么单位转换成vw
52
+            viewportWidth: 1000, // 视口宽度,设计稿宽度
53
+            viewportHeight: 600, // 视口高度,设计稿高度
54
+            unitPrecision: 5, // 转换成vw单位的小数点后的保留位数
55
+            propList: ["*"], // 属性列表,表示你要把哪些css属性的px转换成vw
56
+            viewportUnit: "vw", // 使用的单位,目前可选单位有vw,vh。
57
+            fontViewportUnit: "vw", // 字体使用的单位
58
+            selectorBlackList: ['van', 'el-'], // 匹配不被转换为vw的选择器
59
+            minPixelValue: 1,
60
+            mediaQuery: false,
61
+            replace: true, // 是否直接更换属性值,而不添加备用属性
62
+            exclude: /(\/|\\)(node_modules)(\/|\\)/,
63
+          })
64
+        ]
61 65
       }
62 66
     }
63 67
   }