shish 3 лет назад
Родитель
Сommit
5612e87efb

+ 13 - 0
biz-ghs/order/services/RefundOrderService.php

@@ -279,6 +279,19 @@ class RefundOrderService extends BaseService
                 ShopClass::saleRefundReduceBalance($main, $shop, $refund, $refundPrice);
             } else {
                 //其它线下退款直接完成
+                $currentRefund = bcadd($order->refundPrice, $refundPrice, 2);
+                $order->refundPrice = $currentRefund;
+                $currentActPrice = bcsub($order->actPrice, $refundPrice, 2);
+                if ($currentActPrice < 0) {
+                    util::fail('退款金额有问题!');
+                }
+                $order->actPrice = $currentActPrice;
+                $currentRealPrice = bcsub($order->realPrice, $refundPrice, 2);
+                if ($currentRealPrice < 0) {
+                    util::fail('退款金额有问题');
+                }
+                $order->realPrice = $currentRealPrice;
+                $order->save();
             }
         }
         return $refund;

+ 14 - 0
biz-hd/cg/services/CgRefundService.php

@@ -282,6 +282,20 @@ class CgRefundService extends BaseService
                 ShopClass::cgRefundAddBalance($main, $shop, $refundPrice, $cgRefund, $ghs);
             } else {
                 //其它线下退款直接完成
+                //采购单总金额还要减去退款
+                $currentRefund = bcadd($cg->refundPrice, $refundPrice, 2);
+                $cg->refundPrice = $currentRefund;
+                $currentActPrice = bcsub($cg->actPrice, $refundPrice, 2);
+                if ($currentActPrice < 0) {
+                    util::fail('退款金额有问题!');
+                }
+                $cg->actPrice = $currentActPrice;
+                $currentRealPrice = bcsub($cg->realPrice, $refundPrice, 2);
+                if ($currentRealPrice < 0) {
+                    util::fail('退款金额有问题,请排查');
+                }
+                $cg->realPrice = $currentRealPrice;
+                $cg->save();
             }
         }