feat : coupon

This commit is contained in:
2025-03-21 09:22:13 +08:00
parent 69f9f19262
commit 99a22b26d1
2 changed files with 2 additions and 2 deletions

View File

@@ -362,7 +362,7 @@ trait OrderTrait
$orderMaxPrice = max(array_column($this->orderRes['good'],'price'));
$this->orderRes['coupon']['amount'] = match ($this->orderRes['coupon']['coupon_type']) {
CouponCode::COUPON_TYPE_INSTANT_REDUCTION => $this->orderRes['coupon']['amount'],
CouponCode::COUPON_TYPE_DISCOUNT => bcmul(bcdiv((string)$this->orderRes['coupon']['ratio'],"100",2),(string)$orderMaxPrice,2),
CouponCode::COUPON_TYPE_DISCOUNT => bcmul(bcdiv(bcsub("100",(string)$this->orderRes['coupon']['ratio'],2),"100",2),$orderMaxPrice,2),
default => 0
};
}