fix : coupon

This commit is contained in:
2025-03-31 17:52:14 +08:00
parent 8d2b522345
commit e6176f6bbd
2 changed files with 8 additions and 6 deletions

View File

@@ -151,6 +151,7 @@ abstract class BaseOrderService extends BaseService
'sundry_num' => 0, //服务费数量 'sundry_num' => 0, //服务费数量
'favorable_sundry_price' => '0.00', //服务费优惠价格 'favorable_sundry_price' => '0.00', //服务费优惠价格
'sundry_after_discount_price' => '0.00', //服务费优惠后价格 'sundry_after_discount_price' => '0.00', //服务费优惠后价格
'discount_price' => '0.00', // 优惠金额
'actual_price' => '0.00', //实际支付价格 'actual_price' => '0.00', //实际支付价格
'coupon_id' => 0, 'coupon_id' => 0,
'coupon' => [], 'coupon' => [],

View File

@@ -408,18 +408,19 @@ trait OrderTrait
"100", "100",
2 2
), ),
max(array_column($this->orderRes['good'],'price')), bcadd((string)max(array_column($this->orderRes['good'],'price')),(string)$this->orderRes['sundry_price'],2),
2 2
), ),
default => 0 default => 0
}; };
} }
$this->orderRes['favorable_good_price'] = $this->orderRes['coupon']['coupon_type'] == CouponCode::COUPON_TYPE_INSTANT_REDUCTION ? // $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']) : // min($this->orderRes['coupon']['amount'], $this->orderRes['good_after_discount_price']) :
$this->orderRes['coupon']['amount']; // $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['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['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);
} }
/** /**