调整红包使用逻辑
This commit is contained in:
parent
0ba2a41731
commit
1617d0ede6
@ -648,7 +648,11 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
if ($consumptionTotal) {
|
||||
// 按当前店铺的商品金额计算使用的红包金额
|
||||
$rate = bcdiv($merchantCart['order']['total_price'], $order_total_price, 6);
|
||||
$useAmount = $isLast ? bcsub($consumptionTotal, $this->consumption_money, 2) : bcmul($consumptionTotal, $rate, 2);
|
||||
if ($consumptionTotal >= $order_total_price) {
|
||||
$useAmount = $merchantCart['order']['total_price'];
|
||||
} else {
|
||||
$useAmount = $isLast ? bcsub($consumptionTotal, $this->consumption_money, 2) : bcmul($consumptionTotal, $rate, 2);
|
||||
}
|
||||
$merchantProductPrice = bcsub($merchantCart['order']['total_price'], $useAmount, 2);
|
||||
$merchantPrice = bcadd($merchantPrice, $merchantProductPrice, 2);
|
||||
$this->consumption_money = bcadd($this->consumption_money, $useAmount, 2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user