diff --git a/app/Service/Api/Order/ConfirmationOrderService.php b/app/Service/Api/Order/ConfirmationOrderService.php index f6670b7..e68e245 100644 --- a/app/Service/Api/Order/ConfirmationOrderService.php +++ b/app/Service/Api/Order/ConfirmationOrderService.php @@ -72,7 +72,20 @@ class ConfirmationOrderService extends BaseOrderService foreach ($filtered as &$value) { $value['amount'] = match ($value['coupon_type']) { CouponCode::COUPON_TYPE_INSTANT_REDUCTION => $value['amount'], - CouponCode::COUPON_TYPE_DISCOUNT => bcmul(bcsub("1", (string)$value['ratio'],2),(string)$orderMaxPrice,2), +// CouponCode::COUPON_TYPE_DISCOUNT => bcmul(bcsub("100", (string)$value['ratio'],2),(string)$orderMaxPrice,2), + CouponCode::COUPON_TYPE_DISCOUNT => bcmul( + bcdiv( + bcsub( + "100", + (string)$value['ratio'], + 2 + ), + "100", + 2 + ), + bcadd((string)max(array_column($this->orderRes['good'],'price')),(string)$this->orderRes['sundry_price'],2), + 2 + ), default => 0 };