修复当支付金额为0时,抵扣券选中后会变不可用

This commit is contained in:
2024-11-20 10:12:49 +08:00
parent 0069b7c6fd
commit 61938a6947
4 changed files with 74 additions and 33 deletions

View File

@@ -230,4 +230,20 @@ export function returnCanUseFullReductionCoupon(coupArr, payPrice, selCoup) {
use: v.use && isfullAmount
}
})
}
//根据商品数量还有商品券数量返回优惠券可以使用的数量数组
export function returnCanUseNumProductCoup(coupArr,){
let productCoup = coupArr.filter(v => v.type == 2)
//商品券分组
let coupMap={}
for(let i in productCoup){
const coup=productCoup[i]
if(coupMap.hasOwnProperty(coup.proId)){
coupMap[coup.proId].push(coup)
}else{
coupMap[coup.proId]=[coup]
}
}
return arr
}