|
@@ -84,7 +84,8 @@
|
84
|
84
|
<div class="project">
|
85
|
85
|
<div class="project-title">
|
86
|
86
|
<div>共<span>{{order_data.project_list?order_data.project_list.length:0}}个</span>项目</div>
|
87
|
|
- <div class="add-project"
|
|
87
|
+ <div v-if="order_data.type!='one'"
|
|
88
|
+ class="add-project"
|
88
|
89
|
@click="addProject">添加</div>
|
89
|
90
|
</div>
|
90
|
91
|
<div class="project-list">
|
|
@@ -95,12 +96,12 @@
|
95
|
96
|
<div class="project-content">
|
96
|
97
|
<div class="title-price">
|
97
|
98
|
<div class="project-tit">{{item.name | ellipsis(14)}}</div>
|
98
|
|
- <div class="project-price"><span class="min-size">¥</span>{{item.price}}</div>
|
|
99
|
+ <div class="project-price"><span class="min-size">¥</span>{{Number(item.price).toFixed(2)}}</div>
|
99
|
100
|
</div>
|
100
|
101
|
<div class="project-tips">{{item.product_names}}</div>
|
101
|
102
|
<div class="project-zoom">
|
102
|
103
|
<div> <span v-if="item.device_name">{{item.device_name}}({{item.room}}){{item.use_time}}分钟</span></div>
|
103
|
|
- <div><img @click="eidt(item)"
|
|
104
|
+ <div v-if="order_data.type!='one'"><img @click="eidt(item)"
|
104
|
105
|
src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/eidt.png">
|
105
|
106
|
<img v-if="order_data.project_list.length>1"
|
106
|
107
|
@click="deleteProject(item)"
|
|
@@ -132,7 +133,6 @@
|
132
|
133
|
<div class="on-icon">></div>
|
133
|
134
|
</div>
|
134
|
135
|
|
135
|
|
-
|
136
|
136
|
<!-- <div v-if="order_data.coupon_list&&order_data.coupon_list.length>0">
|
137
|
137
|
<div class="coupon-ps"
|
138
|
138
|
v-for="item,index in order_data.coupon_list"
|
|
@@ -147,18 +147,18 @@
|
147
|
147
|
v-for="item,index in isSelectCoup"
|
148
|
148
|
:key="index">
|
149
|
149
|
<div>{{item.coupon_name}}</div>
|
150
|
|
- <div class="cou-price" v-if="item.type==4?true:false">抵扣{{item.projectName}}</div>
|
151
|
|
- <div class="cou-price" v-if="item.type==3?true:false">抵扣全部项目(除升级包)</div>
|
152
|
|
- <div class="cou-price" v-if="item.type==2?true:false">¥{{item.price}}</div>
|
153
|
|
- <div class="cou-price" v-if="item.type==1?true:false">¥{{item.price}}</div>
|
154
|
|
- <!-- <div class="cou-price">-¥{{price}}</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>
|
|
154
|
+ <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> -->
|
155
|
159
|
</div>
|
156
|
160
|
</div>
|
157
|
161
|
|
158
|
|
-
|
159
|
|
-
|
160
|
|
-
|
161
|
|
-
|
162
|
162
|
</div>
|
163
|
163
|
<div class="over-price">
|
164
|
164
|
合计: <span class="price-num"><span class="min-size">¥</span>{{showMoney}}<span class="min-size"></span></span>
|
|
@@ -178,7 +178,7 @@
|
178
|
178
|
<li class="coupon-info"
|
179
|
179
|
v-for="item,index in couponList"
|
180
|
180
|
:key="index">
|
181
|
|
- <!-- 1: '抵扣券',
|
|
181
|
+ <!-- 1: '抵扣券',
|
182
|
182
|
2: '满减券',
|
183
|
183
|
3: '全额减免券',
|
184
|
184
|
4: '项目卡券' -->
|
|
@@ -332,11 +332,65 @@
|
332
|
332
|
</div>
|
333
|
333
|
</div>
|
334
|
334
|
</mine-pupop>
|
|
335
|
+ <!-- 支付 -->
|
|
336
|
+ <mine-pupop :show="choicePayType">
|
|
337
|
+ <div class="pay-block">
|
|
338
|
+ <div class="delete-pupop"
|
|
339
|
+ @click="choicePayType=false"><img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/delete.png"
|
|
340
|
+ alt=""></div>
|
|
341
|
+ <div class="pay-title">选择支付方式</div>
|
|
342
|
+ <div class="pay-price">¥<span>{{showMoney}}</span></div>
|
|
343
|
+ <div class="pay-list">
|
|
344
|
+ <div class="pay-info"
|
|
345
|
+ v-for="item,index in payList"
|
|
346
|
+ @click="changeType(index)"
|
|
347
|
+ :style="item.isSelect?'border: 1px solid #FA7D22;':'border: 1px solid #D0D0D0;'"
|
|
348
|
+ :key="index">
|
|
349
|
+ <div class="pay-left">
|
|
350
|
+ <img :src="item.payImg"
|
|
351
|
+ alt="">
|
|
352
|
+ <span>{{item.title}}</span>
|
|
353
|
+ </div>
|
|
354
|
+ <div class="pay-right">
|
|
355
|
+ <img :src="item.isSelect?select:unSelect"
|
|
356
|
+ alt="">
|
|
357
|
+ </div>
|
|
358
|
+ </div>
|
|
359
|
+ </div>
|
|
360
|
+ <div class="pay-button"
|
|
361
|
+ @click="pay">确认</div>
|
|
362
|
+ </div>
|
|
363
|
+ </mine-pupop>
|
|
364
|
+ <!-- 支付状态 -->
|
|
365
|
+ <mine-pupop :show="PayStatus">
|
|
366
|
+ <div class="pay-block">
|
|
367
|
+ <div class="delete-pupop"
|
|
368
|
+ @click="PayStatus=false"><img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/delete.png"
|
|
369
|
+ alt=""></div>
|
|
370
|
+ <div v-if="isPayCode">
|
|
371
|
+ <div class="pay-title">请扫码支付</div>
|
|
372
|
+ <div class="pay-price">¥<span>{{showMoney}}</span></div>
|
|
373
|
+ <div class="banner">
|
|
374
|
+ <div id="qrCode"
|
|
375
|
+ class="qrCode"
|
|
376
|
+ ref="qrCodeDiv"></div>
|
|
377
|
+ </div>
|
|
378
|
+ </div>
|
|
379
|
+ <div v-else>
|
|
380
|
+ <div class="pay-title">支付成功</div>
|
|
381
|
+ <div class="pay-suc"><img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/paySuc.png"
|
|
382
|
+ alt=""></div>
|
|
383
|
+ <div class="pay-button"
|
|
384
|
+ @click="toHome">返回首页</div>
|
|
385
|
+ </div>
|
|
386
|
+ </div>
|
|
387
|
+ </mine-pupop>
|
335
|
388
|
</div>
|
336
|
389
|
</template>
|
337
|
390
|
|
338
|
391
|
<script>
|
339
|
392
|
import minePupop from '../../../components/minePupop/index.vue'
|
|
393
|
+import QRCode from 'qrcodejs2'
|
340
|
394
|
import api from '../../../server/home'
|
341
|
395
|
|
342
|
396
|
export default {
|
|
@@ -367,21 +421,6 @@ export default {
|
367
|
421
|
},
|
368
|
422
|
//皮肤状态列表
|
369
|
423
|
poreList: [
|
370
|
|
- {
|
371
|
|
- medium: 133,
|
372
|
|
- small: 344,
|
373
|
|
- mini: 242
|
374
|
|
- },
|
375
|
|
- {
|
376
|
|
- medium: 133,
|
377
|
|
- small: 344,
|
378
|
|
- mini: 242
|
379
|
|
- },
|
380
|
|
- {
|
381
|
|
- medium: 133,
|
382
|
|
- small: 344,
|
383
|
|
- mini: 242
|
384
|
|
- }
|
385
|
424
|
],
|
386
|
425
|
//优惠券列表
|
387
|
426
|
couponList: [],
|
|
@@ -389,6 +428,27 @@ export default {
|
389
|
428
|
selectCouponList: [],
|
390
|
429
|
//已选择优惠券的id(同一个id只能选择一张优惠券)
|
391
|
430
|
selectCouponListId: [],
|
|
431
|
+ //支付方式
|
|
432
|
+ payList: [
|
|
433
|
+ {
|
|
434
|
+ title: '储值支付',
|
|
435
|
+ pay_way: 'amount',
|
|
436
|
+ payImg: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/savingsPay.png',
|
|
437
|
+ isSelect: true
|
|
438
|
+ },
|
|
439
|
+ {
|
|
440
|
+ pay_way: 'weixin',
|
|
441
|
+ title: '微信支付',
|
|
442
|
+ payImg: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/weiXinPay.png',
|
|
443
|
+ isSelect: false
|
|
444
|
+ },
|
|
445
|
+ {
|
|
446
|
+ pay_way: 'alipay',
|
|
447
|
+ title: '支付宝支付',
|
|
448
|
+ payImg: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/zhifubaoPay.png',
|
|
449
|
+ isSelect: false
|
|
450
|
+ },
|
|
451
|
+ ],
|
392
|
452
|
timesInfo: '',
|
393
|
453
|
reservationPrice: 0,//预约费用
|
394
|
454
|
projectInfo: '',
|
|
@@ -402,22 +462,23 @@ export default {
|
402
|
462
|
isProject: false,//是否展示选择项目弹窗
|
403
|
463
|
isTs: false,//是否展示选择时间弹窗
|
404
|
464
|
isPore: false,//皮肤状态弹窗
|
|
465
|
+ choicePayType: false,//支付弹窗
|
|
466
|
+ PayStatus: false,//支付状态弹窗
|
|
467
|
+ isPayCode: true,//是否展示支付二维码
|
405
|
468
|
id: 0,//订单id
|
|
469
|
+ lastProjectPrice: '',//项目已选择的升级包
|
406
|
470
|
isChange: false,//项目是否有改变
|
407
|
471
|
isEditProject: false,//是否编辑项目
|
|
472
|
+ payStatusInterval: null,//轮循拉支付状态
|
408
|
473
|
page: 1,
|
409
|
474
|
limit: 200,
|
410
|
|
-
|
411
|
|
-
|
412
|
|
-
|
413
|
|
-
|
414
|
|
- needSelect: false,
|
415
|
|
- coupSelectType: '',
|
416
|
|
- productDiscount: '',
|
417
|
|
- isSelectCoup: [], // 选择的优惠券
|
418
|
|
- // 下面是支付的数据
|
419
|
|
- showMoney: 0, // 价值总额
|
420
|
|
- // showRuleText: 10086,
|
|
475
|
+ needSelect: false,
|
|
476
|
+ coupSelectType: '',
|
|
477
|
+ productDiscount: '',
|
|
478
|
+ isSelectCoup: [], // 选择的优惠券
|
|
479
|
+ // 下面是支付的数据
|
|
480
|
+ showMoney: 0, // 价值总额
|
|
481
|
+ // showRuleText: 10086,
|
421
|
482
|
|
422
|
483
|
};
|
423
|
484
|
},
|
|
@@ -427,6 +488,9 @@ export default {
|
427
|
488
|
watch: {},
|
428
|
489
|
|
429
|
490
|
methods: {
|
|
491
|
+ toHome () {
|
|
492
|
+ this.$router.replace('/home')
|
|
493
|
+ },
|
430
|
494
|
getOrderInfo () {
|
431
|
495
|
api.getOrderInfo({ id: this.id }).then(res => {
|
432
|
496
|
this.userInfo = res.data.user
|
|
@@ -434,7 +498,7 @@ export default {
|
434
|
498
|
this.remarks = res.data.remark
|
435
|
499
|
this.programmeList = res.data.scheme_list
|
436
|
500
|
this.order_data = res.data.order_data
|
437
|
|
- this.showMoney=res.data.order_data.price
|
|
501
|
+ this.showMoney = res.data.order_data.price
|
438
|
502
|
this.poreList = res.data.detail_list
|
439
|
503
|
this.calculationPrice()
|
440
|
504
|
})
|
|
@@ -445,13 +509,19 @@ export default {
|
445
|
509
|
})
|
446
|
510
|
},
|
447
|
511
|
getProducts (e) {
|
448
|
|
- this.productsInfo = ''
|
|
512
|
+ // this.productsInfo = ''
|
449
|
513
|
api.getProducts({ id: e }).then(res => {
|
450
|
514
|
this.productsList = res.data.list
|
|
515
|
+ this.productsList.forEach(item => {
|
|
516
|
+ if (this.productsInfo == item.id) {
|
|
517
|
+ this.lastProjectPrice = Number(item.price)
|
|
518
|
+ }
|
|
519
|
+ })
|
451
|
520
|
})
|
452
|
521
|
},
|
453
|
522
|
eidt (item) {
|
454
|
523
|
this.projectInfo = item.id
|
|
524
|
+ this.productsInfo = item.product_ids == '' ? '' : Number(item.product_ids)
|
455
|
525
|
this.getProducts(item.id)
|
456
|
526
|
this.isEditProject = true
|
457
|
527
|
this.isProject = true
|
|
@@ -469,6 +539,7 @@ export default {
|
469
|
539
|
},
|
470
|
540
|
addProject () {
|
471
|
541
|
this.projectInfo = ''
|
|
542
|
+ this.productsInfo = ''
|
472
|
543
|
this.isEditProject = false
|
473
|
544
|
this.isProject = true
|
474
|
545
|
},
|
|
@@ -477,16 +548,18 @@ export default {
|
477
|
548
|
// 编辑
|
478
|
549
|
if (this.isEditProject) {
|
479
|
550
|
if (this.productsInfo != '') {
|
|
551
|
+
|
480
|
552
|
this.order_data.project_list.forEach(e => {
|
481
|
553
|
if (this.projectInfo == e.id) {
|
482
|
554
|
this.productsList.forEach(item => {
|
483
|
|
- if (e.product_ids != '') {
|
484
|
|
- e.price = Number(e.price) - Number(item.price)
|
485
|
|
- }
|
486
|
555
|
e.product_ids = this.productsInfo
|
487
|
556
|
if (item.id == e.product_ids) {
|
|
557
|
+ if (e.product_ids != '') {
|
|
558
|
+ e.price = Number(e.price) - Number(this.lastProjectPrice)
|
|
559
|
+ }
|
488
|
560
|
this.isChange = true
|
489
|
561
|
e.product_names = item.name
|
|
562
|
+ console.log(Number(e.price), Number(item.price), 'Number(e.price) + Number(item.price)');
|
490
|
563
|
e.price = Number(e.price) + Number(item.price)
|
491
|
564
|
this.isProject = false
|
492
|
565
|
this.isEditProject = false
|
|
@@ -524,7 +597,6 @@ export default {
|
524
|
597
|
}
|
525
|
598
|
})
|
526
|
599
|
}
|
527
|
|
- console.log(nowProjectInfo, 'nowProjectInfo', productsInfo);
|
528
|
600
|
projectInfo['name'] = nowProjectInfo.name
|
529
|
601
|
projectInfo['id'] = nowProjectInfo.id
|
530
|
602
|
projectInfo['cover_url'] = nowProjectInfo.cover_url
|
|
@@ -560,14 +632,12 @@ export default {
|
560
|
632
|
let year = myDate.getFullYear();
|
561
|
633
|
let month = myDate.getMonth() + 1;
|
562
|
634
|
let date = myDate.getDate();
|
563
|
|
- console.log(year + "-" + month + "-" + date)
|
564
|
635
|
let str = "周" + "日一二三四五六".charAt(myDate.getDay());
|
565
|
636
|
let tsTableInfo = {}
|
566
|
637
|
tsTableInfo['text'] = i == 0 ? '今天' : i == 1 ? '明天' : str
|
567
|
638
|
tsTableInfo['ts'] = month + "-" + date
|
568
|
639
|
tsTableInfo['order_day'] = year + "-" + month + "-" + date
|
569
|
640
|
tsTableList.push(tsTableInfo)
|
570
|
|
- console.log(str)
|
571
|
641
|
}
|
572
|
642
|
this.tsTableList = tsTableList
|
573
|
643
|
},
|
|
@@ -580,7 +650,7 @@ export default {
|
580
|
650
|
this.tsTableIndex = 0
|
581
|
651
|
this.isTs = true
|
582
|
652
|
} else {
|
583
|
|
- debugger
|
|
653
|
+ this.choicePayType = true
|
584
|
654
|
}
|
585
|
655
|
},
|
586
|
656
|
//确定时间选择
|
|
@@ -593,10 +663,8 @@ export default {
|
593
|
663
|
if (item.product_ids != "") {
|
594
|
664
|
order_data_info['product_id'] = item.product_ids
|
595
|
665
|
}
|
596
|
|
- console.log(order_data_info, 'order_data_info');
|
597
|
666
|
order_data.push(order_data_info)
|
598
|
667
|
})
|
599
|
|
- console.log(order_data, 'order_data');
|
600
|
668
|
let params = {
|
601
|
669
|
id: this.id,
|
602
|
670
|
order_data: JSON.stringify(order_data),
|
|
@@ -620,9 +688,9 @@ export default {
|
620
|
688
|
//获取订单优惠券
|
621
|
689
|
onCoupon () {
|
622
|
690
|
|
623
|
|
- if(this.couponList.length>0){
|
624
|
|
- this.isCoupun = true
|
625
|
|
- return
|
|
691
|
+ if (this.couponList.length > 0) {
|
|
692
|
+ this.isCoupun = true
|
|
693
|
+ return
|
626
|
694
|
}
|
627
|
695
|
|
628
|
696
|
let params = {
|
|
@@ -640,10 +708,76 @@ export default {
|
640
|
708
|
this.onCoupon()
|
641
|
709
|
}
|
642
|
710
|
})
|
643
|
|
- console.log(this.couponList)
|
644
|
711
|
this.isCoupun = true
|
645
|
712
|
},
|
|
713
|
+ //选择支付方式
|
|
714
|
+ changeType (i) {
|
|
715
|
+ this.payList.forEach((res, index) => {
|
|
716
|
+ if (index == i) {
|
|
717
|
+ res.isSelect = true
|
|
718
|
+ } else {
|
|
719
|
+ res.isSelect = false
|
|
720
|
+ }
|
|
721
|
+ })
|
|
722
|
+ },
|
|
723
|
+ pay () {
|
|
724
|
+ let that = this
|
|
725
|
+ let payWayList = this.payList.filter(res => {
|
|
726
|
+ return res.isSelect == true
|
|
727
|
+ })
|
|
728
|
+ // 卡券,项目券数据包, id:订单项目ID, coupon_id:优惠券ID, 如:[{ "id": 1220, coupon_id: 199 }]isSelectCoup
|
|
729
|
+ let params = {
|
|
730
|
+ id: this.id,
|
|
731
|
+ pay_way: payWayList[0].pay_way
|
|
732
|
+ }
|
|
733
|
+
|
|
734
|
+ let coupon_data = []
|
|
735
|
+ if (this.isSelectCoup.length > 0) {
|
|
736
|
+ this.isSelectCoup.forEach(item => {
|
|
737
|
+ if (item.type != 4) {
|
|
738
|
+ params['coupon_id'] = item.id
|
|
739
|
+ } else {
|
|
740
|
+ let couponInfo = {}
|
|
741
|
+ couponInfo['id'] = item.projectids
|
|
742
|
+ couponInfo['coupon_id'] = item.id
|
|
743
|
+ }
|
|
744
|
+ })
|
|
745
|
+ }
|
|
746
|
+ params['coupon_data'] = coupon_data.length > 0 ? JSON.stringify(coupon_data) : null
|
|
747
|
+ api.orderPay(params).then(res => {
|
|
748
|
+ if (res.code == 200) {
|
|
749
|
+ this.choicePayType = false
|
|
750
|
+ this.PayStatus = true
|
|
751
|
+ if (res.data.pay_status == 1) {
|
|
752
|
+ this.isPayCode = false
|
|
753
|
+ } else {
|
|
754
|
+ this.$nextTick(() => {
|
|
755
|
+ new QRCode(that.$refs.qrCodeDiv, {
|
|
756
|
+ text: res.data.qr_code_string,
|
|
757
|
+ width: 140,
|
|
758
|
+ height: 140,
|
|
759
|
+ colorDark: "#333333", //二维码颜色
|
|
760
|
+ colorLight: "#ffffff", //二维码背景色
|
|
761
|
+ correctLevel: QRCode.CorrectLevel.L//容错率,L/M/H
|
|
762
|
+ })
|
|
763
|
+ })
|
|
764
|
+ this.payStatusInterval = setInterval(e => {
|
|
765
|
+ this.payStatus()
|
|
766
|
+ }, 1000)
|
|
767
|
+ }
|
|
768
|
+ }
|
|
769
|
+
|
|
770
|
+ })
|
|
771
|
+ },
|
|
772
|
+ payStatus () {
|
|
773
|
+ api.payStatus({ id: this.id, }).then(res => {
|
646
|
774
|
|
|
775
|
+ if (res.data.pay_status == 1) {
|
|
776
|
+ clearInterval(this.payStatusInterval)
|
|
777
|
+ this.isPayCode = false
|
|
778
|
+ }
|
|
779
|
+ })
|
|
780
|
+ },
|
647
|
781
|
|
648
|
782
|
//数组包含关系
|
649
|
783
|
includes (arr1, arr2) {
|
|
@@ -661,191 +795,179 @@ export default {
|
661
|
795
|
// },
|
662
|
796
|
|
663
|
797
|
|
664
|
|
-// 不可以用的不显示,如果同时有项目劵、抵扣劵、满减劵,只能用一种类型,其他劵不显示
|
665
|
|
-// 1、针对单个项目,项目劵可以多选
|
666
|
|
-// 2、抵扣劵、满减劵针对的是整个订单,当用户已使用了单个项目劵时,抵扣劵、满减劵就不能使用
|
667
|
|
-// 3、优惠劵可以给多个项目抵扣,
|
668
|
|
-// 4、默认抵扣金额最高的
|
669
|
|
-// 5、优惠劵排序,到期时间倒叙
|
|
798
|
+ // 不可以用的不显示,如果同时有项目劵、抵扣劵、满减劵,只能用一种类型,其他劵不显示
|
|
799
|
+ // 1、针对单个项目,项目劵可以多选
|
|
800
|
+ // 2、抵扣劵、满减劵针对的是整个订单,当用户已使用了单个项目劵时,抵扣劵、满减劵就不能使用
|
|
801
|
+ // 3、优惠劵可以给多个项目抵扣,
|
|
802
|
+ // 4、默认抵扣金额最高的
|
|
803
|
+ // 5、优惠劵排序,到期时间倒叙
|
670
|
804
|
|
671
|
805
|
|
672
|
|
-/**
|
673
|
|
- * 点击使用按钮、勾选按钮
|
674
|
|
- */
|
675
|
|
- selectPupop: function (item, index) {
|
|
806
|
+ /**
|
|
807
|
+ * 点击使用按钮、勾选按钮
|
|
808
|
+ */
|
|
809
|
+ selectPupop: function (item, index) {
|
676
|
810
|
|
677
|
811
|
|
678
|
|
- let CouPonIndex = this.couponList
|
|
812
|
+ let CouPonIndex = this.couponList
|
679
|
813
|
|
680
|
|
- let selectIndex = index
|
681
|
|
- let curreValue = !CouPonIndex[selectIndex].isSelect
|
682
|
|
- let project_list = this.order_data.project_list //这里是项目列表
|
|
814
|
+ let selectIndex = index
|
|
815
|
+ let curreValue = !CouPonIndex[selectIndex].isSelect
|
|
816
|
+ let project_list = this.order_data.project_list //这里是项目列表
|
683
|
817
|
|
684
|
|
- // 判断是否是不相同的项目券
|
685
|
|
- if (this.couponList[selectIndex].type != 4) {
|
686
|
|
- for (let i = 0; i < CouPonIndex.length; i++) {
|
687
|
|
- CouPonIndex[i].isSelect = false
|
688
|
|
- }
|
689
|
|
- for (let i = 0; i < project_list.length; i++) {
|
690
|
|
- project_list[i].cardId = ''
|
691
|
|
- }
|
|
818
|
+ // 判断是否是不相同的项目券
|
|
819
|
+ if (this.couponList[selectIndex].type != 4) {
|
|
820
|
+ for (let i = 0; i < CouPonIndex.length; i++) {
|
|
821
|
+ CouPonIndex[i].isSelect = false
|
|
822
|
+ }
|
|
823
|
+ for (let i = 0; i < project_list.length; i++) {
|
|
824
|
+ project_list[i].cardId = ''
|
|
825
|
+ }
|
692
|
826
|
|
693
|
|
- } else if (this.coupSelectType != 4) {
|
694
|
|
- for (let i = 0; i < CouPonIndex.length; i++) {
|
695
|
|
- CouPonIndex[i].isSelect = false
|
696
|
|
- }
|
697
|
|
- for (let i = 0; i < project_list.length; i++) {
|
698
|
|
- project_list[i].cardId = ''
|
699
|
|
- }
|
700
|
|
- } else {
|
701
|
|
- let numberSelect = 0
|
702
|
|
- for (let i = 0; i < CouPonIndex.length; i++) {
|
703
|
|
- if (CouPonIndex[i].isSelect) {
|
704
|
|
- numberSelect = numberSelect + 1
|
|
827
|
+ } else if (this.coupSelectType != 4) {
|
|
828
|
+ for (let i = 0; i < CouPonIndex.length; i++) {
|
|
829
|
+ CouPonIndex[i].isSelect = false
|
|
830
|
+ }
|
|
831
|
+ for (let i = 0; i < project_list.length; i++) {
|
|
832
|
+ project_list[i].cardId = ''
|
|
833
|
+ }
|
|
834
|
+ } else {
|
|
835
|
+ let numberSelect = 0
|
|
836
|
+ for (let i = 0; i < CouPonIndex.length; i++) {
|
|
837
|
+ if (CouPonIndex[i].isSelect) {
|
|
838
|
+ numberSelect = numberSelect + 1
|
|
839
|
+ }
|
|
840
|
+ }
|
|
841
|
+ if (numberSelect == this.order_data.project_list.length && curreValue) {
|
|
842
|
+ this.$message.error('最多选择' + this.order_data.project_list.length + '项目券!');
|
|
843
|
+ return
|
705
|
844
|
}
|
706
|
845
|
}
|
707
|
|
- console.log('numberSelect')
|
708
|
|
- console.log(numberSelect)
|
709
|
|
- if (numberSelect == this.order_data.project_list.length && curreValue) {
|
710
|
|
- this.$message.error('最多选择' + this.order_data.project_list.length + '项目券!');
|
711
|
|
- return
|
712
|
|
- }
|
713
|
|
- }
|
714
|
|
- // 判断是否是取消选择项目券
|
715
|
|
- CouPonIndex[selectIndex].isSelect = curreValue
|
716
|
|
- if (!curreValue) {
|
717
|
|
- for (let j = 0; j < project_list.length; j++) {
|
718
|
|
- if (project_list[j].cardId && project_list[j].cardId == this.couponList[selectIndex].id) { // 如果是取消选择,那么也要取消绑定项目的id
|
719
|
|
- project_list[j].cardId = ''
|
|
846
|
+ // 判断是否是取消选择项目券
|
|
847
|
+ CouPonIndex[selectIndex].isSelect = curreValue
|
|
848
|
+ if (!curreValue) {
|
|
849
|
+ for (let j = 0; j < project_list.length; j++) {
|
|
850
|
+ if (project_list[j].cardId && project_list[j].cardId == this.couponList[selectIndex].id) { // 如果是取消选择,那么也要取消绑定项目的id
|
|
851
|
+ project_list[j].cardId = ''
|
|
852
|
+ }
|
720
|
853
|
}
|
|
854
|
+ CouPonIndex[selectIndex].projectids = ''
|
721
|
855
|
}
|
722
|
|
- CouPonIndex[selectIndex].projectids = ''
|
723
|
|
- }
|
724
|
|
- let orderDetails1 = this.order_data
|
725
|
|
- orderDetails1.project_list = project_list
|
|
856
|
+ let orderDetails1 = this.order_data
|
|
857
|
+ orderDetails1.project_list = project_list
|
726
|
858
|
|
727
|
859
|
|
728
|
|
- this.order_data=orderDetails1
|
729
|
|
- this.couponList=CouPonIndex
|
730
|
|
- this.coupSelectType=this.couponList[selectIndex].type
|
|
860
|
+ this.order_data = orderDetails1
|
|
861
|
+ this.couponList = CouPonIndex
|
|
862
|
+ this.coupSelectType = this.couponList[selectIndex].type
|
731
|
863
|
|
732
|
|
- console.log(this.order_data)
|
733
|
|
- console.log(this.couponList)
|
734
|
864
|
|
735
|
|
- this.selectCoup()
|
|
865
|
+ this.selectCoup()
|
736
|
866
|
|
737
|
|
- },
|
|
867
|
+ },
|
738
|
868
|
|
739
|
|
-// 选择项目进行绑定
|
740
|
|
- selectCoup() {
|
741
|
|
- let that = this
|
742
|
|
- let isSelectCoups = []
|
743
|
|
- for (let i = 0; i < this.couponList.length; i++) {
|
744
|
|
- if (this.couponList[i].isSelect) {
|
745
|
|
- let selectCoup = that.couponList[i]
|
746
|
|
- isSelectCoups.push(selectCoup)
|
|
869
|
+ // 选择项目进行绑定
|
|
870
|
+ selectCoup () {
|
|
871
|
+ let that = this
|
|
872
|
+ let isSelectCoups = []
|
|
873
|
+ for (let i = 0; i < this.couponList.length; i++) {
|
|
874
|
+ if (this.couponList[i].isSelect) {
|
|
875
|
+ let selectCoup = that.couponList[i]
|
|
876
|
+ isSelectCoups.push(selectCoup)
|
|
877
|
+ }
|
747
|
878
|
}
|
748
|
|
- }
|
749
|
|
- this.isSelectCoup=isSelectCoups
|
750
|
|
- console.log(this.isSelectCoup)
|
|
879
|
+ this.isSelectCoup = isSelectCoups
|
751
|
880
|
|
752
|
|
- // 抵扣顺序按照项目金额计算
|
753
|
|
- that.theMoneyBest()
|
754
|
|
- },
|
|
881
|
+ // 抵扣顺序按照项目金额计算
|
|
882
|
+ that.theMoneyBest()
|
|
883
|
+ },
|
755
|
884
|
|
756
|
|
- // 抵扣顺序按照项目金额计算
|
757
|
|
- // 卡券,项目券数据包,id:订单项目ID,coupon_id:优惠券ID,如:[{"id":1220,coupon_id:199}]
|
758
|
|
- theMoneyBest() {
|
759
|
|
- let that = this
|
760
|
|
- let project_list = this.order_data.project_list //这里是项目列表
|
761
|
|
- let isSelectCoup = this.isSelectCoup //这里选择了的卡券列表
|
762
|
|
- let selectProjectList = [] // 适合的卡券列表
|
763
|
|
- // let CouPonIndex = this.CouPonIndex // 卡券选择的Id
|
764
|
|
- let productDiscount = this.couponList // 卡券列表
|
765
|
|
- console.log(productDiscount)
|
766
|
|
- // debugger
|
767
|
|
- if (isSelectCoup[0].type == 4) {
|
768
|
|
- for (let i = 0; i < isSelectCoup.length; i++) { // 首先遍历卡券
|
769
|
|
- if (!isSelectCoup[i].projectids) { // 如果卡券没绑定项目
|
770
|
|
- console.log('没绑定过!')
|
|
885
|
+ // 抵扣顺序按照项目金额计算
|
|
886
|
+ // 卡券,项目券数据包,id:订单项目ID,coupon_id:优惠券ID,如:[{"id":1220,coupon_id:199}]
|
|
887
|
+ theMoneyBest () {
|
|
888
|
+ let that = this
|
|
889
|
+ let project_list = this.order_data.project_list //这里是项目列表
|
|
890
|
+ let isSelectCoup = this.isSelectCoup //这里选择了的卡券列表
|
|
891
|
+ let selectProjectList = [] // 适合的卡券列表
|
|
892
|
+ // let CouPonIndex = this.CouPonIndex // 卡券选择的Id
|
|
893
|
+ let productDiscount = this.couponList // 卡券列表
|
|
894
|
+ (productDiscount)
|
|
895
|
+ // debugger
|
|
896
|
+ if (isSelectCoup[0].type == 4) {
|
|
897
|
+ for (let i = 0; i < isSelectCoup.length; i++) { // 首先遍历卡券
|
|
898
|
+ if (!isSelectCoup[i].projectids) { // 如果卡券没绑定项目
|
771
|
899
|
|
772
|
|
- let selectIndexMoney = 0 // 初始值
|
773
|
|
- let selectIndex = 111 // 初始金额
|
774
|
|
- for (let j = 0; j < project_list.length; j++) { // 遍历项目
|
775
|
|
- if (isSelectCoup[i].project_ids.indexOf(project_list[j].id) != -1 && !project_list[j].cardId) { // 如果卡券能够使用这个项目并且这个项目没有被绑定过
|
776
|
|
- console.log('project_list[j].price')
|
777
|
|
- console.log(project_list[j].price)
|
778
|
|
- console.log(selectIndexMoney)
|
779
|
|
- console.log(project_list[j].price > selectIndexMoney)
|
780
|
|
- if (project_list[j].price * 1 > selectIndexMoney * 1) {
|
781
|
|
- selectIndex = j
|
782
|
|
- selectIndexMoney = project_list[j].price
|
783
|
|
- console.log('--' + selectIndexMoney)
|
|
900
|
+ let selectIndexMoney = 0 // 初始值
|
|
901
|
+ let selectIndex = 111 // 初始金额
|
|
902
|
+ for (let j = 0; j < project_list.length; j++) { // 遍历项目
|
|
903
|
+ if (isSelectCoup[i].project_ids.indexOf(project_list[j].id) != -1 && !project_list[j].cardId) { // 如果卡券能够使用这个项目并且这个项目没有被绑定过
|
|
904
|
+ if (project_list[j].price * 1 > selectIndexMoney * 1) {
|
|
905
|
+ selectIndex = j
|
|
906
|
+ selectIndexMoney = project_list[j].price
|
|
907
|
+ }
|
|
908
|
+ // selectProjectList.push(project_list[i])
|
784
|
909
|
}
|
785
|
|
- // selectProjectList.push(project_list[i])
|
786
|
910
|
}
|
787
|
|
- }
|
788
|
|
- if (selectIndex != 111) {
|
789
|
|
- console.log('走了这里走了这里')
|
790
|
|
- isSelectCoup[i].projectids = project_list[selectIndex].id
|
791
|
|
- isSelectCoup[i].projectName = project_list[selectIndex].name
|
792
|
|
- project_list[selectIndex].cardId = isSelectCoup[i].id
|
793
|
|
- } else {
|
794
|
|
- for (let k = 0; k < productDiscount.length; k++) {
|
795
|
|
- if (productDiscount[k].id == isSelectCoup[i].id) {
|
796
|
|
- // isSelectCoup.
|
797
|
|
- productDiscount[k].isSelect = false
|
798
|
|
- // isSelectCoup.splice(isSelectCoup.length-1,1);
|
799
|
|
- this.$message.error('没有适合的项目!');
|
|
911
|
+ if (selectIndex != 111) {
|
|
912
|
+ isSelectCoup[i].projectids = project_list[selectIndex].id
|
|
913
|
+ isSelectCoup[i].projectName = project_list[selectIndex].name
|
|
914
|
+ project_list[selectIndex].cardId = isSelectCoup[i].id
|
|
915
|
+ } else {
|
|
916
|
+ for (let k = 0; k < productDiscount.length; k++) {
|
|
917
|
+ if (productDiscount[k].id == isSelectCoup[i].id) {
|
|
918
|
+ // isSelectCoup.
|
|
919
|
+ productDiscount[k].isSelect = false
|
|
920
|
+ // isSelectCoup.splice(isSelectCoup.length-1,1);
|
|
921
|
+ this.$message.error('没有适合的项目!');
|
|
922
|
+ }
|
800
|
923
|
}
|
801
|
924
|
}
|
802
|
|
- }
|
803
|
925
|
|
|
926
|
+ }
|
804
|
927
|
}
|
|
928
|
+ let orderDetails1 = this.order_data
|
|
929
|
+ orderDetails1.project_list = project_list
|
|
930
|
+ this.couponList = productDiscount
|
|
931
|
+ this.isSelectCoup = isSelectCoup
|
|
932
|
+ this.order_data = orderDetails1
|
805
|
933
|
}
|
806
|
|
- let orderDetails1 = this.order_data
|
807
|
|
- orderDetails1.project_list = project_list
|
808
|
|
- this.couponList= productDiscount
|
809
|
|
- this.isSelectCoup= isSelectCoup
|
810
|
|
- this.order_data= orderDetails1
|
811
|
|
- }
|
812
|
934
|
|
813
|
|
- this.calculateMoney() //计算总额
|
814
|
|
- },
|
|
935
|
+ this.calculateMoney() //计算总额
|
|
936
|
+ },
|
815
|
937
|
|
816
|
|
- // 计算总额
|
817
|
|
- calculateMoney() {
|
818
|
|
- let that = this
|
819
|
|
- let money = this.order_data.price
|
820
|
|
- let isSelectCoup = this.isSelectCoup
|
821
|
|
- let project_list = this.order_data.project_list //这里是项目列表
|
|
938
|
+ // 计算总额
|
|
939
|
+ calculateMoney () {
|
|
940
|
+ let that = this
|
|
941
|
+ let money = this.order_data.price
|
|
942
|
+ let isSelectCoup = this.isSelectCoup
|
|
943
|
+ let project_list = this.order_data.project_list //这里是项目列表
|
822
|
944
|
|
823
|
|
- if (isSelectCoup.length == 0) {
|
824
|
|
- this.showMoney=money.toFixed(2)
|
825
|
|
- return
|
826
|
|
- }
|
|
945
|
+ if (isSelectCoup.length == 0) {
|
|
946
|
+ this.showMoney = money.toFixed(2)
|
|
947
|
+ return
|
|
948
|
+ }
|
827
|
949
|
|
828
|
|
- // 如果是项目
|
829
|
|
- if (isSelectCoup[0].type == 4) {
|
830
|
|
- for (let i = 0; i < project_list.length; i++) {
|
831
|
|
- if (project_list[i].cardId) {
|
|
950
|
+ // 如果是项目
|
|
951
|
+ if (isSelectCoup[0].type == 4) {
|
|
952
|
+ for (let i = 0; i < project_list.length; i++) {
|
|
953
|
+ if (project_list[i].cardId) {
|
|
954
|
+ money = money - project_list[i].price
|
|
955
|
+ }
|
|
956
|
+ }
|
|
957
|
+ this.showMoney = money.toFixed(2)
|
|
958
|
+ } else if (isSelectCoup[0].type == 3) {
|
|
959
|
+ for (let i = 0; i < project_list.length; i++) {
|
832
|
960
|
money = money - project_list[i].price
|
833
|
961
|
}
|
834
|
|
- }
|
835
|
|
- this.showMoney=money.toFixed(2)
|
836
|
|
- } else if (isSelectCoup[0].type == 3) {
|
837
|
|
- for (let i = 0; i < project_list.length; i++) {
|
838
|
|
- money = money - project_list[i].price
|
839
|
|
- }
|
840
|
962
|
|
841
|
|
- } else {
|
842
|
|
- money = money - isSelectCoup[0].price
|
843
|
|
- }
|
|
963
|
+ } else {
|
|
964
|
+ money = money - isSelectCoup[0].price
|
|
965
|
+ }
|
844
|
966
|
|
845
|
|
- this.showMoney=money.toFixed(2)
|
|
967
|
+ this.showMoney = money.toFixed(2)
|
846
|
968
|
|
847
|
969
|
|
848
|
|
- },
|
|
970
|
+ },
|
849
|
971
|
|
850
|
972
|
|
851
|
973
|
changeActive (e) {
|
|
@@ -899,6 +1021,11 @@ export default {
|
899
|
1021
|
mounted () {
|
900
|
1022
|
|
901
|
1023
|
},
|
|
1024
|
+ destroyed () {
|
|
1025
|
+ if (this.payStatusInterval) { //如果定时器在运行则关闭
|
|
1026
|
+ clearInterval(this.payStatusInterval)
|
|
1027
|
+ }
|
|
1028
|
+ }
|
902
|
1029
|
}
|
903
|
1030
|
|
904
|
1031
|
</script>
|
|
@@ -1666,5 +1793,112 @@ export default {
|
1666
|
1793
|
}
|
1667
|
1794
|
}
|
1668
|
1795
|
}
|
|
1796
|
+ .pay-block {
|
|
1797
|
+ width: 540px;
|
|
1798
|
+ height: 400px;
|
|
1799
|
+ background: #ffffff;
|
|
1800
|
+ border-radius: 8px;
|
|
1801
|
+ position: relative;
|
|
1802
|
+ padding: 42px;
|
|
1803
|
+ .delete-pupop {
|
|
1804
|
+ width: 32px;
|
|
1805
|
+ position: absolute;
|
|
1806
|
+ right: 5px;
|
|
1807
|
+ top: 5px;
|
|
1808
|
+ img {
|
|
1809
|
+ width: 100%;
|
|
1810
|
+ }
|
|
1811
|
+ }
|
|
1812
|
+ .pay-title {
|
|
1813
|
+ font-size: 14px;
|
|
1814
|
+ font-family: PingFangSC-Medium, PingFang SC;
|
|
1815
|
+ font-weight: 500;
|
|
1816
|
+ color: #333333;
|
|
1817
|
+ line-height: 20px;
|
|
1818
|
+ text-align: center;
|
|
1819
|
+ }
|
|
1820
|
+ .pay-suc {
|
|
1821
|
+ margin-top: 40px;
|
|
1822
|
+ margin-bottom: 80px;
|
|
1823
|
+ text-align: center;
|
|
1824
|
+ img {
|
|
1825
|
+ width: 140px;
|
|
1826
|
+ }
|
|
1827
|
+ }
|
|
1828
|
+ .pay-price {
|
|
1829
|
+ margin-top: 10px;
|
|
1830
|
+ font-size: 14px;
|
|
1831
|
+ font-family: OPPOSans-B, OPPOSans;
|
|
1832
|
+ font-weight: normal;
|
|
1833
|
+ color: #fa4622;
|
|
1834
|
+ text-align: center;
|
|
1835
|
+ line-height: 31px;
|
|
1836
|
+ span {
|
|
1837
|
+ font-size: 20px;
|
|
1838
|
+ }
|
|
1839
|
+ }
|
|
1840
|
+ .banner {
|
|
1841
|
+ margin-top: 24px;
|
|
1842
|
+ .qrCode {
|
|
1843
|
+ text-align: center;
|
|
1844
|
+ }
|
|
1845
|
+ }
|
|
1846
|
+ .pay-list {
|
|
1847
|
+ width: 338px;
|
|
1848
|
+ margin-top: 8px;
|
|
1849
|
+ position: relative;
|
|
1850
|
+ left: 50%;
|
|
1851
|
+ transform: translateX(-50%);
|
|
1852
|
+ .pay-info {
|
|
1853
|
+ margin-top: 16px;
|
|
1854
|
+ display: flex;
|
|
1855
|
+ justify-content: space-between;
|
|
1856
|
+ align-items: center;
|
|
1857
|
+
|
|
1858
|
+ height: 44px;
|
|
1859
|
+ border-radius: 35px;
|
|
1860
|
+ border: 1px solid #d0d0d0;
|
|
1861
|
+
|
|
1862
|
+ padding: 0 20px;
|
|
1863
|
+ .pay-left {
|
|
1864
|
+ margin-left: 8px;
|
|
1865
|
+ font-size: 16px;
|
|
1866
|
+ font-family: PingFangSC-Regular, PingFang SC;
|
|
1867
|
+ font-weight: 400;
|
|
1868
|
+ color: #333333;
|
|
1869
|
+ line-height: 22px;
|
|
1870
|
+ display: flex;
|
|
1871
|
+ align-items: center;
|
|
1872
|
+ img {
|
|
1873
|
+ width: 24px;
|
|
1874
|
+ }
|
|
1875
|
+ span {
|
|
1876
|
+ margin-left: 20px;
|
|
1877
|
+ }
|
|
1878
|
+ }
|
|
1879
|
+ .pay-right {
|
|
1880
|
+ img {
|
|
1881
|
+ width: 24px;
|
|
1882
|
+ }
|
|
1883
|
+ }
|
|
1884
|
+ }
|
|
1885
|
+ }
|
|
1886
|
+ .pay-button {
|
|
1887
|
+ margin-top: 28px;
|
|
1888
|
+ width: 176px;
|
|
1889
|
+ height: 28px;
|
|
1890
|
+ background: #fa7d22;
|
|
1891
|
+ border-radius: 14px;
|
|
1892
|
+ font-size: 14px;
|
|
1893
|
+ font-family: PingFangSC-Medium, PingFang SC;
|
|
1894
|
+ font-weight: 500;
|
|
1895
|
+ color: #ffffff;
|
|
1896
|
+ line-height: 28px;
|
|
1897
|
+ text-align: center;
|
|
1898
|
+ position: relative;
|
|
1899
|
+ left: 50%;
|
|
1900
|
+ transform: translateX(-50%);
|
|
1901
|
+ }
|
|
1902
|
+ }
|
1669
|
1903
|
}
|
1670
|
1904
|
</style>
|