|
@@ -87,13 +87,11 @@ export default defineComponent({
|
|
|
// 已使用的优惠券
|
|
|
const useList = this.list.filter((list: any) => list.checked)
|
|
|
if(this.usedLength === 'SINGLE') {
|
|
|
- let usedMap: any = new Map()
|
|
|
+ let usedMap: any = {}
|
|
|
useList.forEach((item: any) => {
|
|
|
- const price = usedMap.get(item.couponCategory)
|
|
|
- usedMap.set(item.couponCategory, (price || 0) + item.useLimit)
|
|
|
+ const price = usedMap[item.couponCategory]
|
|
|
+ usedMap[item.couponCategory] = (price || 0) + item.useLimit
|
|
|
})
|
|
|
-
|
|
|
- usedMap.values()
|
|
|
// 判断使用优惠券之后还有没有其它优惠券可用
|
|
|
this.list.forEach((item: any) => {
|
|
|
let disabled = true
|
|
@@ -105,17 +103,16 @@ export default defineComponent({
|
|
|
})
|
|
|
// 已使用优惠券总金额
|
|
|
let useCouponMoney = 0
|
|
|
- if(usedMap.size > 0) {
|
|
|
- useCouponMoney = usedMap.values().reduce((a: any, b: any) => {
|
|
|
- return a + b
|
|
|
- })
|
|
|
+ for(let i in usedMap) {
|
|
|
+ useCouponMoney = useCouponMoney + usedMap[i]
|
|
|
}
|
|
|
disabled = item.useLimit > allAmount - useCouponMoney
|
|
|
} else {
|
|
|
const disItem: any = this.orderGoodsType.find((goods: any) => couponEnum[goods.orderType] === item.couponCategory)
|
|
|
- const useLastAmount = disItem ? disItem.price - (usedMap.get(item.couponCategory) || 0) : 0
|
|
|
+ const useLastAmount = disItem ? disItem.price - (usedMap[item.couponCategory] || 0) : 0
|
|
|
disabled = Number(item.useLimit) > useLastAmount
|
|
|
}
|
|
|
+
|
|
|
if (!item.checked && (useList.length > 0 || disabled)) {
|
|
|
item.disabled = true
|
|
|
} else {
|