From 1b1adc3c260a08cc0a74e9aced6d6df78ca1e30a Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Sat, 3 Feb 2024 10:15:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95=E4=BE=9B=E5=BA=94=E9=93=BE?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=80=80=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/order/StoreRefundOrderRepository.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/common/repositories/store/order/StoreRefundOrderRepository.php b/app/common/repositories/store/order/StoreRefundOrderRepository.php index c67023af..0512d5dc 100755 --- a/app/common/repositories/store/order/StoreRefundOrderRepository.php +++ b/app/common/repositories/store/order/StoreRefundOrderRepository.php @@ -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);