OfflineOrderItem.coupon_discount_amount
parent
c4c098c385
commit
1a1f88cbdf
|
|
@ -176,6 +176,7 @@ class UserCoupon extends Model
|
|||
public function getDiscountAmount(int $total)
|
||||
{
|
||||
$couponDiscount = 0;
|
||||
if ($this->coupon_amount > 0) {
|
||||
// 优惠券: 直接抵扣
|
||||
if ($this->coupon_type == Coupon::TYPE_AMOUNT) {
|
||||
$couponDiscount = $this->coupon_amount;
|
||||
|
|
@ -184,6 +185,7 @@ class UserCoupon extends Model
|
|||
else if ($this->coupon_type == Coupon::TYPE_DISCOUNT) {
|
||||
$couponDiscount = (int) bcmul($total, bcdiv(100 - $this->coupon_amount, 100, 2));
|
||||
}
|
||||
}
|
||||
|
||||
return $couponDiscount;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue