From d3ef2fa0bfb5ba94de3d3f095aa4642ab6a16513 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Sat, 3 Feb 2024 10:33:29 +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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/common/repositories/store/order/StoreRefundOrderRepository.php b/app/common/repositories/store/order/StoreRefundOrderRepository.php index 0512d5dc..d459aab6 100755 --- a/app/common/repositories/store/order/StoreRefundOrderRepository.php +++ b/app/common/repositories/store/order/StoreRefundOrderRepository.php @@ -484,10 +484,16 @@ class StoreRefundOrderRepository extends BaseRepository $storeConsumptionUserDao->orderProductPrice = $product['product_price']; $storeConsumptionUserDao->realPriceTotal = 0; [$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) { $refundPrice = bcsub($realPrice, bcsub($productRefundPrice['refund_price'] ?? 0, $productRefundPrice['refund_postage'] ?? 0, 2), 2); + $consumptionPrice = bcmul(bcsub($originPrice, $payPrice, 2), $num, 2); } 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); @@ -538,6 +544,7 @@ class StoreRefundOrderRepository extends BaseRepository $data['refund_num'] = $num; $data['extension_one'] = $total_extension_one; $data['extension_two'] = $total_extension_two; + $data['refund_consumption'] = $consumptionPrice ?? 0; if ($order['pay_type'] == StoreGroupOrder::PAY_TYPE_CREDIT_BUY) { $data['refund_price'] = 0; }