feat : coupon
This commit is contained in:
@@ -35,10 +35,14 @@ class ConfirmationOrderService extends BaseOrderService
|
||||
|
||||
$this->check();
|
||||
|
||||
$this->getCouponInfo();
|
||||
|
||||
$this->compute();
|
||||
|
||||
$this->autoSelectCoupon();
|
||||
|
||||
$this->reloadCompute();
|
||||
|
||||
return $this->return->success('success',$this->orderRes);
|
||||
}
|
||||
|
||||
@@ -67,7 +71,7 @@ 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 => $value['ratio'] * $orderMaxPrice,
|
||||
CouponCode::COUPON_TYPE_DISCOUNT => bcmul(bcsub("1", $value['ratio'],2),$orderMaxPrice,2),
|
||||
default => 0
|
||||
};
|
||||
|
||||
@@ -80,12 +84,7 @@ class ConfirmationOrderService extends BaseOrderService
|
||||
$this->couponId = $selectCouponInfo['id'];
|
||||
$this->orderRes['coupon'] = $selectCouponInfo;
|
||||
$this->orderRes['coupon_id'] = $selectCouponInfo['id'];
|
||||
|
||||
$this->reloadCompute();
|
||||
}
|
||||
|
||||
private function reloadCompute(): void
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user