diff --git a/app/Services/UserCouponService.php b/app/Services/UserCouponService.php index dfb77a0..658ee85 100644 --- a/app/Services/UserCouponService.php +++ b/app/Services/UserCouponService.php @@ -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; + } } }