调试供应链订单退款

This commit is contained in:
luofei 2024-02-03 10:15:49 +08:00
parent 45264e85e2
commit 1b1adc3c26

View File

@ -478,10 +478,16 @@ class StoreRefundOrderRepository extends BaseRepository
$refundPrice = 0;
//计算可退金额
if ($product['product_price'] > 0) {
$storeConsumptionUserDao = new StoreConsumptionUserDao();
$storeConsumptionUserDao->orderTotalPrice = $order['total_price'];
$storeConsumptionUserDao->orderPayPrice = $order['pay_price'];
$storeConsumptionUserDao->orderProductPrice = $product['product_price'];
$storeConsumptionUserDao->realPriceTotal = 0;
[$realPrice, $realPriceTotal, $consumptionPrice] = $storeConsumptionUserDao->calculate();
if ($product['refund_num'] == $num) {
$refundPrice = bcsub($product['product_price'], 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);
} else {
$refundPrice = bcmul(bcdiv($product['product_price'], $product['product_num'], 2), $num, 2);
$refundPrice = bcmul(bcdiv($realPrice, $product['product_num'], 2), $num, 2);
}
}
$totalRefundPrice = bcadd($refundPrice, $postagePrice, 2);