问题修复,下单修复

This commit is contained in:
2025-09-29 16:54:35 +08:00
parent 719a513371
commit afa769579a
16 changed files with 417 additions and 167 deletions

45
utils/coupon.js Normal file
View File

@@ -0,0 +1,45 @@
import {
findCoupon
} from '@/common/api/market/coupon.js';
import * as UTILS from '@/utils/goods-utils.js'
export async function returnHasCouponCanUse(args) {
const {
goodsOrderPrice,
dinnerType,
shopId,
shopInfo,
shopUserId,
allGoods,
user
} = args
const res = await findCoupon({
shopUserId,
});
if(!res||res.length<=0){
return false
}
const canDikouGoodsArr = UTILS.returnCanDikouGoods(allGoods, [], user);
for (let i = 0; i < res.length; i++) {
const coupon = res[i]
const canuseResult = UTILS.returnCouponCanUse({
canDikouGoodsArr,
coupon,
goodsOrderPrice,
user,
selCoupon: [],
shopInfo
})
const {
canUse,
reason
} = canuseResult
if (canUse) {
return true
}
}
return false
}