shish 3 лет назад
Родитель
Сommit
7b795cfc61

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

@@ -283,6 +283,20 @@ class RefundOrderService extends BaseService
                     'mainId' => $mainId,
                 ];
                 ShopMoneyClass::ghsRefundHdOutAmount($moneyData, $main);
+
+                $order->refundPrice = $refundPrice;
+                $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();
+
             } else {
                 //其它线下退款直接完成
                 $order->refundPrice = $refundPrice;

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

@@ -275,6 +275,20 @@ class CgRefundService extends BaseService
 
                 //门店余额增加
                 ShopClass::cgRefundAddBalance($main, $shop, $refundPrice, $cgRefund, $ghs);
+
+            } elseif ($payWay == dict::getDict('payWay', 'cash')) {
+                $cg->refundPrice = $refundPrice;
+                $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();
             } else {
                 //其它线下退款直接完成
                 $cg->refundPrice = $refundPrice;