fix : coupon
This commit is contained in:
@@ -151,6 +151,7 @@ abstract class BaseOrderService extends BaseService
|
||||
'sundry_num' => 0, //服务费数量
|
||||
'favorable_sundry_price' => '0.00', //服务费优惠价格
|
||||
'sundry_after_discount_price' => '0.00', //服务费优惠后价格
|
||||
'discount_price' => '0.00', // 优惠金额
|
||||
'actual_price' => '0.00', //实际支付价格
|
||||
'coupon_id' => 0,
|
||||
'coupon' => [],
|
||||
|
||||
@@ -408,18 +408,19 @@ trait OrderTrait
|
||||
"100",
|
||||
2
|
||||
),
|
||||
max(array_column($this->orderRes['good'],'price')),
|
||||
bcadd((string)max(array_column($this->orderRes['good'],'price')),(string)$this->orderRes['sundry_price'],2),
|
||||
2
|
||||
),
|
||||
default => 0
|
||||
};
|
||||
}
|
||||
|
||||
$this->orderRes['favorable_good_price'] = $this->orderRes['coupon']['coupon_type'] == CouponCode::COUPON_TYPE_INSTANT_REDUCTION ?
|
||||
min($this->orderRes['coupon']['amount'], $this->orderRes['good_after_discount_price']) :
|
||||
$this->orderRes['coupon']['amount'];
|
||||
$this->orderRes['good_after_discount_price'] = bcsub((string)$this->orderRes['good_after_discount_price'],(string)$this->orderRes['favorable_good_price'],2);
|
||||
$this->orderRes['actual_price'] = bcsub((string)$this->orderRes['actual_price'],(string)$this->orderRes['favorable_good_price'],2);
|
||||
// $this->orderRes['favorable_good_price'] = $this->orderRes['coupon']['coupon_type'] == CouponCode::COUPON_TYPE_INSTANT_REDUCTION ?
|
||||
// min($this->orderRes['coupon']['amount'], $this->orderRes['good_after_discount_price']) :
|
||||
// $this->orderRes['coupon']['amount'];
|
||||
// $this->orderRes['good_after_discount_price'] = bcsub((string)$this->orderRes['good_after_discount_price'],(string)$this->orderRes['favorable_good_price'],2);
|
||||
$this->orderRes['discount_price'] = min($this->orderRes['coupon']['amount'],$this->orderRes['coupon']['actual_price']);
|
||||
$this->orderRes['actual_price'] = bcsub((string)$this->orderRes['actual_price'],(string)$this->orderRes['discount_price'],2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user