调试供应链订单退款

This commit is contained in:
luofei 2024-02-03 10:33:29 +08:00
parent 1b1adc3c26
commit d3ef2fa0bf

View File

@ -484,10 +484,16 @@ class StoreRefundOrderRepository extends BaseRepository
$storeConsumptionUserDao->orderProductPrice = $product['product_price']; $storeConsumptionUserDao->orderProductPrice = $product['product_price'];
$storeConsumptionUserDao->realPriceTotal = 0; $storeConsumptionUserDao->realPriceTotal = 0;
[$realPrice, $realPriceTotal, $consumptionPrice] = $storeConsumptionUserDao->calculate(); [$realPrice, $realPriceTotal, $consumptionPrice] = $storeConsumptionUserDao->calculate();
// 商品原始单价
$originPrice = bcdiv($product['product_price'], $product['product_num'], 2);
// 商品实付单价
$payPrice = bcdiv($realPrice, $product['product_num'], 2);
if ($product['refund_num'] == $num) { if ($product['refund_num'] == $num) {
$refundPrice = bcsub($realPrice, bcsub($productRefundPrice['refund_price'] ?? 0, $productRefundPrice['refund_postage'] ?? 0, 2), 2); $refundPrice = bcsub($realPrice, bcsub($productRefundPrice['refund_price'] ?? 0, $productRefundPrice['refund_postage'] ?? 0, 2), 2);
$consumptionPrice = bcmul(bcsub($originPrice, $payPrice, 2), $num, 2);
} else { } else {
$refundPrice = bcmul(bcdiv($realPrice, $product['product_num'], 2), $num, 2); $refundPrice = bcmul($payPrice, $num, 2);
$consumptionPrice = bcmul(bcsub($originPrice, $payPrice, 2), $num, 2);
} }
} }
$totalRefundPrice = bcadd($refundPrice, $postagePrice, 2); $totalRefundPrice = bcadd($refundPrice, $postagePrice, 2);
@ -538,6 +544,7 @@ class StoreRefundOrderRepository extends BaseRepository
$data['refund_num'] = $num; $data['refund_num'] = $num;
$data['extension_one'] = $total_extension_one; $data['extension_one'] = $total_extension_one;
$data['extension_two'] = $total_extension_two; $data['extension_two'] = $total_extension_two;
$data['refund_consumption'] = $consumptionPrice ?? 0;
if ($order['pay_type'] == StoreGroupOrder::PAY_TYPE_CREDIT_BUY) { if ($order['pay_type'] == StoreGroupOrder::PAY_TYPE_CREDIT_BUY) {
$data['refund_price'] = 0; $data['refund_price'] = 0;
} }