Explorar el Código

拆单退款问题修复

evoxwht hace 2 años
padre
commit
087cbb8c1a

+ 1 - 1
crmeb/app/services/order/StoreOrderRefundServices.php

@@ -956,7 +956,7 @@ class StoreOrderRefundServices extends BaseServices
                 //订单实际支付金额
                 //订单实际支付金额
                 $order_pay_price = bcsub((string)bcadd((string)$order['total_price'], (string)$order['pay_postage'], 2), (string)bcadd((string)$order['deduction_price'], (string)$order['coupon_price'], 2), 2);
                 $order_pay_price = bcsub((string)bcadd((string)$order['total_price'], (string)$order['pay_postage'], 2), (string)bcadd((string)$order['deduction_price'], (string)$order['coupon_price'], 2), 2);
                 if ($order_pay_price != $order['pay_price'] && $refund_pay_price != $order_pay_price) {//有改价
                 if ($order_pay_price != $order['pay_price'] && $refund_pay_price != $order_pay_price) {//有改价
-                    $refund_price = bcmul((string)bcdiv((string)$order['pay_price'], (string)$order_pay_price, 4), (string)$refund_pay_price, 2);
+                    $refund_price = bcmul((string)bcdiv((string)$refund_pay_price, (string)$order_pay_price, 4), (string)$order['pay_price'], 2);
                 } else {
                 } else {
                     $refund_price = $refund_pay_price;
                     $refund_price = $refund_pay_price;
                 }
                 }

+ 2 - 3
crmeb/app/services/order/StoreOrderSplitServices.php

@@ -168,9 +168,8 @@ class StoreOrderSplitServices extends BaseServices
                 }
                 }
                 $storeOrderCartInfoServices->saveAll($cart_data_all);
                 $storeOrderCartInfoServices->saveAll($cart_data_all);
 
 
-                $new_order = $this->dao->get($new_id);
                 $storeOrderCartInfoServices->clearOrderCartInfo($new_id);
                 $storeOrderCartInfoServices->clearOrderCartInfo($new_id);
-                $this->splitComputeOrder((int)$new_id, $cart_data_all, (float)($change_price ? $order_pay_price : 0), (float)$orderInfo['pay_price'], (float)($new_order['pay_price'] ?? 0));
+                $this->splitComputeOrder((int)$new_id, $cart_data_all, (float)($change_price ? $order_pay_price : 0), (float)$orderInfo['pay_price'], (float)($order['pay_price'] ?? 0));
                 $new_order = $this->dao->get($new_id);
                 $new_order = $this->dao->get($new_id);
                 if ($key == 'new') {
                 if ($key == 'new') {
                     $order = $new_order;
                     $order = $new_order;
@@ -310,7 +309,7 @@ class StoreOrderSplitServices extends BaseServices
             if ($pre_pay_price) {//上一个已经计算 这里减法
             if ($pre_pay_price) {//上一个已经计算 这里减法
                 $order_update['pay_price'] = bcsub((string)$pay_price, (string)$pre_pay_price, 2);
                 $order_update['pay_price'] = bcsub((string)$pay_price, (string)$pre_pay_price, 2);
             } else {//按比例计算实际支付金额
             } else {//按比例计算实际支付金额
-                $order_update['pay_price'] = bcmul((string)bcdiv((string)$pay_price, (string)$order_pay_price, 4), (string)$order_update['pay_price'], 2);
+                $order_update['pay_price'] = bcmul((string)bcdiv((string)$order_update['pay_price'], (string)$order_pay_price, 4), (string)$pay_price, 2);
             }
             }
         }
         }