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);