|
@@ -104,9 +104,9 @@
|
104
|
104
|
<div class="project">
|
105
|
105
|
<div class="project-title">
|
106
|
106
|
<div>共<span>{{order_data.project_list?order_data.project_list.length:0}}个</span>项目</div>
|
107
|
|
- <div v-if="order_data.type!='one'"
|
|
107
|
+ <!-- <div v-if="order_data.type!='one'"
|
108
|
108
|
class="add-project"
|
109
|
|
- @click="addProject">添加</div>
|
|
109
|
+ @click="addProject">添加</div> -->
|
110
|
110
|
</div>
|
111
|
111
|
<div class="project-list"
|
112
|
112
|
:style="isChange?'height:250px':''">
|
|
@@ -121,15 +121,28 @@
|
121
|
121
|
</div>
|
122
|
122
|
<div class="project-tips">{{item.product_names}}</div>
|
123
|
123
|
<div class="project-zoom">
|
124
|
|
- <div> <span v-if="item.device_name">{{item.device_name}}({{item.room}}){{item.use_time}}分钟</span></div>
|
125
|
|
- <div v-if="order_data.type!='one'"><img @click="eidt(item)"
|
|
124
|
+ <el-select v-model="item.tot_name"
|
|
125
|
+ v-if="item.device_name"
|
|
126
|
+ @visible-change="openList($event,item,index)"
|
|
127
|
+ @change="changeRoom($event,item,index)"
|
|
128
|
+ size="mini"
|
|
129
|
+ style="min-width: 150px;"
|
|
130
|
+ :placeholder="item.tot_name">
|
|
131
|
+ <el-option v-for="i in roomList"
|
|
132
|
+ :key="i.id"
|
|
133
|
+ :label="i.tot_name"
|
|
134
|
+ :value="i.tot_name">
|
|
135
|
+ </el-option>
|
|
136
|
+ </el-select>
|
|
137
|
+ <!-- <div> <span v-if="item.device_name">{{item.device_name}}({{item.room}}){{item.use_time}}分钟</span></div> -->
|
|
138
|
+ <!-- <div v-if="order_data.type!='one'"><img @click="eidt(item)"
|
126
|
139
|
src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/eidt.png">
|
127
|
140
|
<img v-if="order_data.project_list.length>1"
|
128
|
141
|
@click="deleteProject(item)"
|
129
|
142
|
class="delete"
|
130
|
143
|
src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/delete.png"
|
131
|
144
|
alt="">
|
132
|
|
- </div>
|
|
145
|
+ </div> -->
|
133
|
146
|
</div>
|
134
|
147
|
</div>
|
135
|
148
|
</div>
|
|
@@ -139,7 +152,7 @@
|
139
|
152
|
v-if="!isChange">
|
140
|
153
|
<div class="cost-title">
|
141
|
154
|
<div>预约费用</div>
|
142
|
|
- <div>¥{{reservationPrice}}</div>
|
|
155
|
+ <div>¥{{order_data.original_price}}</div>
|
143
|
156
|
</div>
|
144
|
157
|
<!-- 次卡 -->
|
145
|
158
|
<div class="cost-coupon-list">
|
|
@@ -198,18 +211,10 @@
|
198
|
211
|
<!-- <div class="cou-price">-¥{{price}}</div> -->
|
199
|
212
|
</div>
|
200
|
213
|
</div>
|
201
|
|
- <div class="coupon-ps"
|
202
|
|
- v-if="discount!=0">
|
203
|
|
- <div></div>
|
204
|
|
- <div v-if="discount!=20"
|
205
|
|
- class="cou-price"> {{discount==100?'仪器免费体验':'新人5折优惠'}}</div>
|
206
|
|
- <div class="cou-price"
|
207
|
|
- v-else-if=" isSelectCoup.length&&(order_data.project_list.length - isSelectCoup.length)>=3">{{'任意三个项目8折'}}</div>
|
208
|
|
- </div>
|
209
|
214
|
</div>
|
210
|
215
|
</div>
|
211
|
216
|
<div class="over-price">
|
212
|
|
- 合计: <span class="price-num"><span class="min-size">¥</span>{{isSelectCoup.length>0?showMoney:discountPrice}}<span class="min-size"></span></span>
|
|
217
|
+ 合计: <span class="price-num"><span class="min-size">¥</span>{{showMoney}}<span class="min-size"></span></span>
|
213
|
218
|
</div>
|
214
|
219
|
</div>
|
215
|
220
|
<div class="payment"
|
|
@@ -453,7 +458,7 @@
|
453
|
458
|
@click="choicePayType=false"><img src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/delete.png"
|
454
|
459
|
alt=""></div>
|
455
|
460
|
<div class="pay-title">选择支付方式</div>
|
456
|
|
- <div class="pay-price">¥<span>{{isSelectCoup.length>0?showMoney:discountPrice}}</span></div>
|
|
461
|
+ <div class="pay-price">¥<span>{{showMoney}}</span></div>
|
457
|
462
|
<div class="pay-list">
|
458
|
463
|
<div class="pay-info"
|
459
|
464
|
v-for="item,index in payList"
|
|
@@ -483,7 +488,7 @@
|
483
|
488
|
alt=""></div>
|
484
|
489
|
<div v-if="isPayCode">
|
485
|
490
|
<div class="pay-title">请扫码支付</div>
|
486
|
|
- <div class="pay-price">¥<span>{{isSelectCoup.length>0?showMoney:discountPrice}}</span></div>
|
|
491
|
+ <div class="pay-price">¥<span>{{showMoney}}</span></div>
|
487
|
492
|
<div class="banner">
|
488
|
493
|
<div id="qrCode"
|
489
|
494
|
class="qrCode"
|
|
@@ -508,6 +513,7 @@
|
508
|
513
|
import minePupop from '../../../components/minePupop/index.vue'
|
509
|
514
|
import QRCode from 'qrcodejs2'
|
510
|
515
|
import api from '../../../server/home'
|
|
516
|
+import internal from 'assert';
|
511
|
517
|
|
512
|
518
|
export default {
|
513
|
519
|
components: { minePupop },
|
|
@@ -519,6 +525,7 @@ export default {
|
519
|
525
|
unSelect: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/coupon/unSelect.png',
|
520
|
526
|
userInfo: {
|
521
|
527
|
},
|
|
528
|
+ value: '',
|
522
|
529
|
// 问题标签
|
523
|
530
|
problem: '',
|
524
|
531
|
//面部标签
|
|
@@ -624,9 +631,10 @@ export default {
|
624
|
631
|
// 下面是支付的数据
|
625
|
632
|
showMoney: 0, // 价值总额
|
626
|
633
|
discountPrice: 0,//活动后金额
|
627
|
|
- discount: 0,//折扣类型
|
|
634
|
+ discountList: [],//折扣类型
|
628
|
635
|
device_name: '',//支付成功后的设备
|
629
|
636
|
room: '',//设备房间
|
|
637
|
+ roomList: [],//设备房间列表
|
630
|
638
|
user_id: '',
|
631
|
639
|
// showRuleText: 10086,
|
632
|
640
|
|
|
@@ -665,6 +673,7 @@ export default {
|
665
|
673
|
res.data.order_data.project_list.forEach(e => {
|
666
|
674
|
e["isCard"] = false
|
667
|
675
|
e["isCoupon"] = false
|
|
676
|
+ e["tot_name"] = `${e.device_name}(${e.room})`
|
668
|
677
|
})
|
669
|
678
|
this.order_data = res.data.order_data
|
670
|
679
|
if (this.order_data.coupon_list.length > 0) {
|
|
@@ -672,18 +681,9 @@ export default {
|
672
|
681
|
}
|
673
|
682
|
this.showMoney = res.data.order_data.price
|
674
|
683
|
this.poreList = res.data.detail_list
|
675
|
|
- this.order_data['discountPrice'] = 0
|
676
|
|
- //折扣类型,0.无折扣,20.任意三个项目8折,50.新人五折活动,100.仪器免费使用权益
|
677
|
|
- this.order_data.project_list.forEach(item => {
|
678
|
|
- if (this.discount == 20) {
|
679
|
|
- this.order_data.discountPrice += Number(item.price) * 0.8
|
680
|
|
- } else if (this.discount == 50) {
|
681
|
|
- this.order_data.discountPrice += Number(item.price) * 0.5
|
682
|
|
- } else if (this.discount == 0) {
|
683
|
|
- this.order_data.discountPrice = this.showMoney
|
684
|
|
- }
|
685
|
|
- })
|
686
|
|
- this.discountPrice = Number(this.order_data.discountPrice).toFixed(2)
|
|
684
|
+ this.order_data['discountPrice'] = this.order_data.price
|
|
685
|
+ this.discountPrice = this.order_data.price
|
|
686
|
+ this.calculateMoney()
|
687
|
687
|
this.calculationPrice()
|
688
|
688
|
})
|
689
|
689
|
},
|
|
@@ -698,18 +698,51 @@ export default {
|
698
|
698
|
}
|
699
|
699
|
})
|
700
|
700
|
},
|
701
|
|
- isSelectCard (item, index) {
|
702
|
|
- let isSelect = false
|
703
|
|
- let isRepeat = false
|
704
|
|
- this.cardList.forEach(res => {
|
705
|
|
- if (res.isSelect && item.id != res.id && item.name == res.name) {
|
706
|
|
- isRepeat = true
|
|
701
|
+ openList (e, item, index) {
|
|
702
|
+ console.log(e, item, index, 'e,item,index');
|
|
703
|
+ if (e) {
|
|
704
|
+ this.value = ''
|
|
705
|
+ this.roomList = []
|
|
706
|
+ let params = {
|
|
707
|
+ id: this.id,
|
|
708
|
+ project_id: item.id
|
|
709
|
+ }
|
|
710
|
+ api.getDevice_list(params).then(res => {
|
|
711
|
+ if (res.code == 200) {
|
|
712
|
+ res.data.list.forEach(item => {
|
|
713
|
+ item['tot_name'] = `${item.name}(${item.room})`
|
|
714
|
+ })
|
|
715
|
+ this.roomList = res.data.list
|
|
716
|
+ }
|
|
717
|
+ })
|
|
718
|
+ }
|
|
719
|
+ },
|
|
720
|
+ changeRoom (e, item, index) {
|
|
721
|
+ let _id = 0
|
|
722
|
+ this.roomList.forEach(res => {
|
|
723
|
+ if (res.tot_name == e) {
|
|
724
|
+ _id = res.id
|
707
|
725
|
}
|
708
|
726
|
})
|
709
|
|
- if (isRepeat) {
|
710
|
|
- this.$message.error("不能选择相同的次卡");
|
711
|
|
- return
|
|
727
|
+ console.log(e, item, index, 'e,item,index');
|
|
728
|
+ let params = {
|
|
729
|
+ id: this.id,
|
|
730
|
+ project_id: item.id,
|
|
731
|
+ device_id: _id
|
712
|
732
|
}
|
|
733
|
+ api.device_change(params).then(res => {
|
|
734
|
+ if (res.code == 200) {
|
|
735
|
+ this.$message({
|
|
736
|
+ message: `${res.msg}`,
|
|
737
|
+ type: "success"
|
|
738
|
+ });
|
|
739
|
+ this.getOrderInfo()
|
|
740
|
+ }
|
|
741
|
+ })
|
|
742
|
+ },
|
|
743
|
+ isSelectCard (item, index) {
|
|
744
|
+ let isSelect = false
|
|
745
|
+ let isRepeat = false
|
713
|
746
|
this.isSelectCoup.forEach(e => {
|
714
|
747
|
if (item.project_ids.indexOf(e.projectids) > -1) {
|
715
|
748
|
isSelect = true
|
|
@@ -720,15 +753,27 @@ export default {
|
720
|
753
|
return
|
721
|
754
|
}
|
722
|
755
|
console.log(item);
|
|
756
|
+ this.cardList.forEach(res => {
|
|
757
|
+ if (res.isSelect && item.id != res.id && JSON.stringify(item.project_ids) == JSON.stringify(res.project_ids)) {
|
|
758
|
+ isRepeat = true
|
|
759
|
+ return
|
|
760
|
+ }
|
|
761
|
+ })
|
|
762
|
+ if (isRepeat) {
|
|
763
|
+ this.$message.error("不能选择相同的次卡");
|
|
764
|
+ return
|
|
765
|
+ }
|
723
|
766
|
this.cardList[index].isSelect = !this.cardList[index].isSelect
|
|
767
|
+
|
724
|
768
|
},
|
725
|
769
|
//确定选择的次卡
|
726
|
770
|
isCardAdd () {
|
727
|
771
|
let isSelectCardList = []
|
728
|
772
|
let project_list = this.order_data.project_list
|
|
773
|
+ let price = this.order_data.price
|
729
|
774
|
let card_data = []
|
730
|
|
- let price =this.order_data.price
|
731
|
|
- console.log(price,'price');
|
|
775
|
+ let card_data_info = {}
|
|
776
|
+ console.log(price, 'price');
|
732
|
777
|
if (this.isSelectCoup.length > 0) {
|
733
|
778
|
this.isSelectCoup.forEach(res => {
|
734
|
779
|
this.order_data.project_list.forEach(item => {
|
|
@@ -738,42 +783,43 @@ export default {
|
738
|
783
|
})
|
739
|
784
|
})
|
740
|
785
|
}
|
741
|
|
- project_list.forEach(res => {
|
|
786
|
+ console.log(price, 'pricepriceprice3');
|
|
787
|
+
|
|
788
|
+ project_list.forEach((res,index) => {
|
742
|
789
|
this.cardList.forEach(e => {
|
743
|
790
|
if (e.isSelect && e.project_ids.indexOf(res.id) > -1) {
|
744
|
791
|
price = price - res.price
|
|
792
|
+ console.log(price);
|
745
|
793
|
price = price.toFixed(2)
|
746
|
794
|
isSelectCardList.push(res)
|
747
|
|
- }
|
748
|
|
- })
|
749
|
|
- })
|
750
|
|
- isSelectCardList.forEach(e => {
|
751
|
|
- this.cardList.forEach(res => {
|
752
|
|
- let card_data_info = {}
|
753
|
|
- if (res.isSelect, res.project_ids.indexOf(e.id) > -1) {
|
754
|
795
|
card_data_info = {
|
755
|
|
- id: e.id,
|
756
|
|
- card_id: res.id
|
|
796
|
+ id: res.id,
|
|
797
|
+ card_id: e.id
|
757
|
798
|
}
|
758
|
799
|
card_data.push(card_data_info)
|
759
|
800
|
}
|
760
|
801
|
})
|
761
|
802
|
})
|
762
|
|
- if (isSelectCardList.length==0&&this.isSelectCoup.length==0) {
|
763
|
|
- price = price- this.order_data.discountPrice
|
764
|
|
- }
|
765
|
803
|
|
766
|
|
- this.card_data = card_data
|
|
804
|
+
|
|
805
|
+ if (isSelectCardList.length == 0 && this.isSelectCoup.length == 0 && this.order_data.project_list.length > 2) {
|
|
806
|
+ price = price - this.order_data.discountPrice
|
|
807
|
+ }
|
|
808
|
+
|
|
809
|
+ console.log(price, 'pricepriceprice');
|
767
|
810
|
if (price < 0) {
|
768
|
811
|
price = 0
|
769
|
812
|
}
|
770
|
813
|
// if (this.isSelectCoup.length > 0) {
|
771
|
|
- this.showMoney = price
|
|
814
|
+ this.showMoney = price
|
|
815
|
+ this.discountPrice = price
|
|
816
|
+ this.card_data = card_data
|
772
|
817
|
// } else {
|
773
|
818
|
// this.discountPrice = price
|
774
|
819
|
// }
|
775
|
820
|
this.isSelectCardList = isSelectCardList
|
776
|
821
|
this.isCard = false
|
|
822
|
+ this.calculateMoney()
|
777
|
823
|
},
|
778
|
824
|
getProjectClassify () {
|
779
|
825
|
api.projectClassify({ user_id: this.userInfo.user_id }).then(res => {
|
|
@@ -956,12 +1002,12 @@ export default {
|
956
|
1002
|
this.getOrderInfo()
|
957
|
1003
|
this.isTs = false
|
958
|
1004
|
this.isChange = false
|
959
|
|
- if (type&&type=='delete') {
|
|
1005
|
+ if (type && type == 'delete') {
|
960
|
1006
|
this.order_data.project_list.splice(index, 1)
|
961
|
|
- this.$message({
|
962
|
|
- message: '删除成功',
|
963
|
|
- type: 'success'
|
964
|
|
- });
|
|
1007
|
+ this.$message({
|
|
1008
|
+ message: '删除成功',
|
|
1009
|
+ type: 'success'
|
|
1010
|
+ });
|
965
|
1011
|
}
|
966
|
1012
|
}
|
967
|
1013
|
})
|
|
@@ -1079,11 +1125,11 @@ export default {
|
1079
|
1125
|
return res.isSelect == true
|
1080
|
1126
|
})
|
1081
|
1127
|
// 卡券,项目券数据包, id:订单项目ID, coupon_id:优惠券ID, 如:[{ "id": 1220, coupon_id: 199 }]isSelectCoup
|
1082
|
|
- this.discount = this.card_data.length>0?0:this.discount
|
|
1128
|
+ this.discountList = this.card_data.length > 0 ? 0 : this.discountList
|
1083
|
1129
|
let params = {
|
1084
|
1130
|
id: this.id,
|
1085
|
1131
|
pay_way: payWayList[0].pay_way,
|
1086
|
|
- discount: this.discount
|
|
1132
|
+ discountList: this.discountList
|
1087
|
1133
|
}
|
1088
|
1134
|
|
1089
|
1135
|
let coupon_data = []
|
|
@@ -1174,10 +1220,12 @@ export default {
|
1174
|
1220
|
})
|
1175
|
1221
|
let isReturn = false
|
1176
|
1222
|
this.isSelectCardList.forEach(value => {
|
1177
|
|
- if (item.project_ids.indexOf(value.id) > -1) {
|
|
1223
|
+ console.log(value, 'value');
|
|
1224
|
+ if (value.id && item.project_ids.indexOf(value.id) > -1) {
|
1178
|
1225
|
isReturn = true
|
1179
|
1226
|
}
|
1180
|
1227
|
})
|
|
1228
|
+ console.log(isReturn, item.type, this.card_data.length);
|
1181
|
1229
|
if (isReturn || (item.type != 4 && this.card_data.length != 0)) {
|
1182
|
1230
|
this.$message.error('该项目已选择次卡');
|
1183
|
1231
|
return
|
|
@@ -1290,11 +1338,12 @@ export default {
|
1290
|
1338
|
// isSelectCoup.
|
1291
|
1339
|
productDiscount[k].isSelect = false
|
1292
|
1340
|
// isSelectCoup.splice(isSelectCoup.length-1,1);
|
1293
|
|
- this.isSelectCoup.forEach((items, index) => {
|
1294
|
|
- if (items.id == productDiscount[k].id) {
|
1295
|
|
- this.isSelectCoup.splice(index, 1)
|
1296
|
|
- }
|
1297
|
|
- })
|
|
1341
|
+ // this.isSelectCoup.forEach((items, index) => {
|
|
1342
|
+ // if (items.id == productDiscount[k].id) {
|
|
1343
|
+ // console.log(items.id,'items.id');
|
|
1344
|
+ // this.isSelectCoup.splice(index, 1)
|
|
1345
|
+ // }
|
|
1346
|
+ // })
|
1298
|
1347
|
this.$message.error('没有适合的项目!');
|
1299
|
1348
|
}
|
1300
|
1349
|
}
|
|
@@ -1323,45 +1372,141 @@ export default {
|
1323
|
1372
|
_price = _price + Number(res.price)
|
1324
|
1373
|
})
|
1325
|
1374
|
}
|
1326
|
|
- console.log(this.order_data.original_price,_price,'_price_price');
|
|
1375
|
+ console.log(this.order_data.original_price, _price, '_price_price');
|
1327
|
1376
|
let money = this.isSelectCardList.length > 0 ? this.order_data.original_price - _price : Number(this.order_data.original_price)
|
1328
|
|
- console.log(money,'========');
|
|
1377
|
+ console.log(money, '========');
|
1329
|
1378
|
let isSelectCoup = this.isSelectCoup
|
1330
|
1379
|
let project_list = this.order_data.project_list //这里是项目列表
|
1331
|
1380
|
|
1332
|
|
- if (isSelectCoup.length == 0) {
|
1333
|
|
- this.showMoney = money.toFixed(2)
|
1334
|
|
- return
|
1335
|
|
- }
|
1336
|
1381
|
|
1337
|
1382
|
// 如果是项目
|
1338
|
|
- if (isSelectCoup[0].type == 4) {
|
1339
|
|
- for (let i = 0; i < project_list.length; i++) {
|
1340
|
|
- if (project_list[i].cardId) {
|
|
1383
|
+ if (this.isSelectCoup.length > 0) {
|
|
1384
|
+
|
|
1385
|
+ if (isSelectCoup[0].type == 4) {
|
|
1386
|
+ for (let i = 0; i < project_list.length; i++) {
|
|
1387
|
+ if (project_list[i].cardId) {
|
|
1388
|
+ money = money - Number(project_list[i].price)
|
|
1389
|
+ }
|
|
1390
|
+ }
|
|
1391
|
+ this.showMoney = money.toFixed(2)
|
|
1392
|
+ console.log(this.showMoney, 'this.showMoney');
|
|
1393
|
+ } else if (isSelectCoup[0].type == 3) {
|
|
1394
|
+ for (let i = 0; i < project_list.length; i++) {
|
1341
|
1395
|
money = money - Number(project_list[i].price)
|
1342
|
1396
|
}
|
|
1397
|
+ } else {
|
|
1398
|
+ money = money - Number(isSelectCoup[0].price)
|
1343
|
1399
|
}
|
1344
|
|
- this.showMoney = money.toFixed(2)
|
1345
|
|
- console.log(this.showMoney, 'this.showMoney');
|
1346
|
|
- if (this.order_data.project_list.length - this.isSelectCoup.length >= 3) {
|
1347
|
|
- console.log(money, 'money');
|
1348
|
|
- money = (money * 0.8).toFixed(2)
|
1349
|
|
- console.log(money, 'money');
|
|
1400
|
+ }
|
1350
|
1401
|
|
1351
|
|
- }
|
1352
|
|
- } else if (isSelectCoup[0].type == 3) {
|
1353
|
|
- for (let i = 0; i < project_list.length; i++) {
|
1354
|
|
- money = money - Number(project_list[i].price)
|
1355
|
|
- }
|
|
1402
|
+ console.log(this.showMoney, 'showMoney', money);
|
1356
|
1403
|
|
1357
|
|
- } else {
|
1358
|
|
- money = money - Number(isSelectCoup[0].price)
|
|
1404
|
+
|
|
1405
|
+ /**
|
|
1406
|
+ * type:1项目,2设备分类,3耗材
|
|
1407
|
+ * discount_type:折扣条件,1数量/类型,2金额
|
|
1408
|
+ */
|
|
1409
|
+ let notSelectId = []
|
|
1410
|
+ this.isSelectCoup.forEach(item => {
|
|
1411
|
+ notSelectId.push(item.projectids)
|
|
1412
|
+ })
|
|
1413
|
+ let cardIdList = []
|
|
1414
|
+ this.isSelectCardList.forEach(res=>{
|
|
1415
|
+ cardIdList.push(res.id)
|
|
1416
|
+ })
|
|
1417
|
+ //去除选择优惠券或者次卡的项目
|
|
1418
|
+ let _project_list = project_list.filter(res => {
|
|
1419
|
+
|
|
1420
|
+ return notSelectId.toString().indexOf(res.id)<0 && cardIdList.toString().indexOf(res.id)<0
|
|
1421
|
+ })
|
|
1422
|
+ console.log(_project_list,'_project_list');
|
|
1423
|
+ let devicePrice = 0 //满足折扣设备的项目总金额
|
|
1424
|
+ let productPrice = 0 //耗材总金额
|
|
1425
|
+ //满足折扣设备的项目
|
|
1426
|
+ let deviceList = _project_list.filter(item => {
|
|
1427
|
+ return item.device_type_id == item.device_id
|
|
1428
|
+ })
|
|
1429
|
+ if (deviceList.length > 0) {
|
|
1430
|
+ deviceList.forEach(item => {
|
|
1431
|
+ devicePrice = devicePrice + Number(item.price)
|
|
1432
|
+ })
|
1359
|
1433
|
}
|
1360
|
|
- console.log(this.showMoney, 'showMoney', money);
|
1361
|
|
- this.showMoney = money < 0 ? 0 : money
|
1362
|
|
- },
|
|
1434
|
+ //拥有耗材的项目
|
|
1435
|
+ let productList = _project_list.filter(item => {
|
|
1436
|
+ return item.product_name != ""
|
|
1437
|
+ })
|
|
1438
|
+ if (productList.length > 0) {
|
|
1439
|
+ productList.forEach(item => {
|
|
1440
|
+ productPrice = productPrice + Number(item.product_price)
|
|
1441
|
+ })
|
|
1442
|
+ }
|
|
1443
|
+ if (this.discountList.length > 0) {
|
|
1444
|
+ let discountList = this.discountList
|
|
1445
|
+ //计算所有的折扣金额
|
|
1446
|
+ discountList.forEach(item => {
|
|
1447
|
+ let priceSet = 0,
|
|
1448
|
+ initmoney = money,
|
|
1449
|
+ _initmoney = money
|
|
1450
|
+ if (item.type == 1 && item.discount_type == 1 && _project_list.length >= item.num) {
|
|
1451
|
+ initmoney = initmoney * item.discount_rate / 10
|
|
1452
|
+ priceSet = _initmoney - initmoney
|
|
1453
|
+ item["priceSet"] = priceSet
|
|
1454
|
+ } else if (item.type == 1 && item.discount_type == 2 && money > Number(item.amount)) {
|
|
1455
|
+ initmoney = initmoney * item.discount_rate / 10
|
|
1456
|
+ priceSet = _initmoney - initmoney
|
|
1457
|
+ item["priceSet"] = priceSet
|
|
1458
|
+ } else if (item.type == 2 && item.discount_type == 2 && devicePrice > Number(item.amount)) {
|
|
1459
|
+ //满足条件的项目折扣
|
|
1460
|
+ initmoney = (initmoney - devicePrice) + devicePrice * item.discount_rate / 10
|
|
1461
|
+ priceSet = _initmoney - initmoney
|
|
1462
|
+ item["priceSet"] = priceSet
|
1363
|
1463
|
|
|
1464
|
+ } else if (item.type == 3 && item.discount_type == 1 && productList.length >= item.num) {
|
|
1465
|
+ //满足条件的项目折扣
|
|
1466
|
+ initmoney = (initmoney - productPrice) + productPrice * item.discount_rate / 10
|
|
1467
|
+ priceSet = _initmoney - initmoney
|
|
1468
|
+ item["priceSet"] = priceSet
|
1364
|
1469
|
|
|
1470
|
+ } else if (item.type == 3 && item.discount_type == 2 && productPrice >= item.amount) {
|
|
1471
|
+ //满足条件的项目折扣
|
|
1472
|
+ initmoney = (initmoney - productPrice) + productPrice * item.discount_rate / 10
|
|
1473
|
+ priceSet = _initmoney - initmoney
|
|
1474
|
+ item["priceSet"] = priceSet
|
|
1475
|
+ }
|
|
1476
|
+ })
|
|
1477
|
+ console.log(discountList, 'discountList');
|
|
1478
|
+ //排序,最优折扣放第一位
|
|
1479
|
+ discountList = discountList.sort(this.compare("priceSet"))
|
|
1480
|
+
|
|
1481
|
+ let discountInfo = discountList[0]
|
|
1482
|
+
|
|
1483
|
+ if (discountInfo.type == 1 && discountInfo.discount_type == 1 && _project_list.length >= discountInfo.num) {
|
|
1484
|
+ money = money * discountInfo.discount_rate / 10
|
|
1485
|
+ } else if (discountInfo.type == 1 && discountInfo.discount_type == 2 && money > Number(discountInfo.amount)) {
|
|
1486
|
+ money = money * discountInfo.discount_rate / 10
|
|
1487
|
+ } else if (discountInfo.type == 2 && discountInfo.discount_type == 2 && devicePrice > Number(discountInfo.amount)) {
|
|
1488
|
+ //满足条件的项目折扣
|
|
1489
|
+ money = (money - devicePrice) + devicePrice * discountInfo.discount_rate / 10
|
|
1490
|
+ } else if (discountInfo.type == 3 && discountInfo.discount_type == 1 && productList.length >= discountInfo.num) {
|
|
1491
|
+ //满足条件的项目折扣
|
|
1492
|
+ money = (money - productPrice) + productPrice * discountInfo.discount_rate / 10
|
|
1493
|
+ } else if (discountInfo.type == 3 && discountInfo.discount_type == 2 && productPrice >= discountInfo.amount) {
|
|
1494
|
+ //满足条件的项目折扣
|
|
1495
|
+ money = (money - productPrice) + productPrice * discountInfo.discount_rate / 10
|
|
1496
|
+ }
|
|
1497
|
+ }
|
|
1498
|
+
|
|
1499
|
+ this.showMoney = money.toFixed(2) < 0 ? 0.00 : money.toFixed(2)
|
|
1500
|
+ },
|
|
1501
|
+
|
|
1502
|
+ //排序
|
|
1503
|
+ compare (property) {
|
|
1504
|
+ return function (obj1, obj2) {
|
|
1505
|
+ var value1 = obj1[property];
|
|
1506
|
+ var value2 = obj2[property];
|
|
1507
|
+ return value2 - value1; // 降序
|
|
1508
|
+ }
|
|
1509
|
+ },
|
1365
|
1510
|
changeActive (e) {
|
1366
|
1511
|
this.active = e
|
1367
|
1512
|
},
|
|
@@ -1398,7 +1543,7 @@ export default {
|
1398
|
1543
|
//获取订单折扣类型
|
1399
|
1544
|
getOrderDiscount () {
|
1400
|
1545
|
api.getOrderDiscount({ id: this.id }).then(res => {
|
1401
|
|
- this.discount = res.data.discount
|
|
1546
|
+ this.discountList = res.data.list
|
1402
|
1547
|
this.getOrderInfo()
|
1403
|
1548
|
})
|
1404
|
1549
|
},
|
|
@@ -1803,6 +1948,7 @@ export default {
|
1803
|
1948
|
line-height: 18px;
|
1804
|
1949
|
}
|
1805
|
1950
|
.project-zoom {
|
|
1951
|
+ margin-top: 8px;
|
1806
|
1952
|
font-size: 14px;
|
1807
|
1953
|
font-family: PingFangSC-Regular, PingFang SC;
|
1808
|
1954
|
font-weight: 400;
|
|
@@ -1817,6 +1963,9 @@ export default {
|
1817
|
1963
|
.delete {
|
1818
|
1964
|
margin-left: 10px;
|
1819
|
1965
|
}
|
|
1966
|
+ /deep/ .el-input__inner {
|
|
1967
|
+ color: #fa7d22;
|
|
1968
|
+ }
|
1820
|
1969
|
}
|
1821
|
1970
|
}
|
1822
|
1971
|
}
|