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