feat : config
This commit is contained in:
@@ -353,16 +353,16 @@ trait OrderTrait
|
|||||||
{
|
{
|
||||||
if ($this->couponId <= 0 || empty($this->orderRes['coupon']) || $this->orderRes['coupon_id'] <= 0) return;
|
if ($this->couponId <= 0 || empty($this->orderRes['coupon']) || $this->orderRes['coupon_id'] <= 0) return;
|
||||||
|
|
||||||
if ($this->orderRes['coupon_info']['amount'] <= 0 && $this->orderRes['coupon_info']['coupon_type'] != CouponCode::COUPON_TYPE_INSTANT_REDUCTION) {
|
if ($this->orderRes['coupon']['amount'] <= 0 && $this->orderRes['coupon']['coupon_type'] != CouponCode::COUPON_TYPE_INSTANT_REDUCTION) {
|
||||||
$orderMaxPrice = max(array_column($this->orderRes['good'],'price'));
|
$orderMaxPrice = max(array_column($this->orderRes['good'],'price'));
|
||||||
$this->orderRes['coupon_info']['amount'] = match ($this->orderRes['coupon_info']['coupon_type']) {
|
$this->orderRes['coupon']['amount'] = match ($this->orderRes['coupon']['coupon_type']) {
|
||||||
CouponCode::COUPON_TYPE_INSTANT_REDUCTION => $this->orderRes['coupon_info']['amount'],
|
CouponCode::COUPON_TYPE_INSTANT_REDUCTION => $this->orderRes['coupon']['amount'],
|
||||||
CouponCode::COUPON_TYPE_DISCOUNT => bcmul(bcdiv("100", bcsub("100",$this->orderRes['coupon_info']['ratio'],2),2),$orderMaxPrice,2),
|
CouponCode::COUPON_TYPE_DISCOUNT => bcmul(bcdiv("100", bcsub("100",$this->orderRes['coupon']['ratio'],2),2),$orderMaxPrice,2),
|
||||||
default => 0
|
default => 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->orderRes['favorable_good_price'] = $this->orderRes['coupon_info']['amount'];
|
$this->orderRes['favorable_good_price'] = $this->orderRes['coupon']['amount'];
|
||||||
$this->orderRes['good_after_discount_price'] = bcsub($this->orderRes['good_after_discount_price'],$this->orderRes['favorable_good_price'],2);
|
$this->orderRes['good_after_discount_price'] = bcsub($this->orderRes['good_after_discount_price'],$this->orderRes['favorable_good_price'],2);
|
||||||
$this->orderRes['actual_price'] = bcsub($this->orderRes['actual_price'],$this->orderRes['favorable_good_price'],2);
|
$this->orderRes['actual_price'] = bcsub($this->orderRes['actual_price'],$this->orderRes['favorable_good_price'],2);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user