增加处理无门槛优惠卷金额问题

This commit is contained in:
wucongxing8150 2024-04-18 15:03:35 +08:00
parent 03784663ba
commit 5d61a9113c

View File

@ -162,8 +162,8 @@ class UserCouponService extends BaseService
}
}
// 处理满减金额优惠卷
if ($coupon['coupon_type'] == 2){
// 处理满减金额/无门槛优惠卷
if ($coupon['coupon_type'] == 2 || $coupon['coupon_type'] == 1){
// 可共用一个优惠卷的商品金额问题
$product_price = 0;
@ -185,9 +185,20 @@ class UserCouponService extends BaseService
);
}
if ($coupon['with_amount'] > $product_price){
// 此优惠卷因商品金额不足,无法使用
$coupons[$key]['is_can_use'] = 0;
// 满减金额优惠卷
if ($coupon['coupon_type'] == 2){
if ($coupon['with_amount'] > $product_price){
// 此优惠卷因商品金额不足,无法使用
$coupons[$key]['is_can_use'] = 0;
}
}
// 无门槛优惠卷
if ($coupon['coupon_type'] == 1){
if ($product_price <= 0){
// 商品总金额已经为0不使用优惠卷
$coupons[$key]['is_can_use'] = 0;
}
}
}