Просмотр исходного кода

Merge branch 'redesign‌-260706' into dev

shish 1 день назад
Родитель
Сommit
d4b95bc9ce

+ 1 - 4
app-ghs/controllers/RefundController.php

@@ -773,10 +773,7 @@ class RefundController extends BaseController
                         'customBalance' => bcadd((string)($custom->balance ?? '0'), '0', 2),
                         'customBalance' => bcadd((string)($custom->balance ?? '0'), '0', 2),
                         'orderId' => intval($id),
                         'orderId' => intval($id),
                         'nextDayTkPrice' => $order->nextDayTkPrice ?? '0.00',
                         'nextDayTkPrice' => $order->nextDayTkPrice ?? '0.00',
-                        'needFundAction' => (
-                            intval($refundInfo->hasReturn ?? 0) === 0
-                            && intval($refundInfo->returnBalance ?? 0) === 0
-                        ) ? 1 : 0,
+                        'needFundAction' => NextDayRefundService::needFundAction($refundInfo),
                     ];
                     ];
                 } catch (\Exception $exception) {
                 } catch (\Exception $exception) {
                     if ($transaction->isActive) {
                     if ($transaction->isActive) {

+ 9 - 4
biz-ghs/order/classes/RefundOrderClass.php

@@ -323,6 +323,9 @@ class RefundOrderClass extends BaseClass
 
 
                 $currentRemainDebt = bcsub($order->remainDebtPrice, $refundPrice, 2);
                 $currentRemainDebt = bcsub($order->remainDebtPrice, $refundPrice, 2);
                 if ($currentRemainDebt < 0) {
                 if ($currentRemainDebt < 0) {
+                    if ($order->remainDebtPrice > 0) {
+                        util::fail('剩余欠款不够退,请先结清欠款');
+                    }
                     util::fail('退款金额有问题');
                     util::fail('退款金额有问题');
                 }
                 }
                 if ($currentRemainDebt == 0) {
                 if ($currentRemainDebt == 0) {
@@ -392,10 +395,12 @@ class RefundOrderClass extends BaseClass
             }
             }
         }
         }
 
 
-        // 当天售后:账务/通道原路已在上方完成,标记 hasReturn=1
-        \bizGhs\order\services\NextDayRefundService::syncRefundFundFlags($refund, [
-            'hasReturn' => \bizGhs\order\services\NextDayRefundService::FLAG_YES,
-        ]);
+        // 当天售后:线上/余额/挂账原路已完成 → hasReturn=1;线下留待成功页人工确认
+        if (!\bizGhs\order\services\NextDayRefundService::needsManualReturnConfirm($refund)) {
+            \bizGhs\order\services\NextDayRefundService::syncRefundFundFlags($refund, [
+                'hasReturn' => \bizGhs\order\services\NextDayRefundService::FLAG_YES,
+            ]);
+        }
     }
     }
 
 
     public static function rejectRefund($refund, $rejectReason)
     public static function rejectRefund($refund, $rejectReason)

+ 39 - 0
biz-ghs/order/services/NextDayRefundService.php

@@ -141,6 +141,45 @@ class NextDayRefundService
             || $payWay === intval(dict::getDict('payWay', 'debtPay'));
             || $payWay === intval(dict::getDict('payWay', 'debtPay'));
     }
     }
 
 
+    /**
+     * 是否需人工确认原路(现金/银行卡/线下微信支付宝等)
+     * 线上通道成功、余额/挂账账务完成可自动 hasReturn;线下钱是否退还要人确认。
+     */
+    public static function needsManualReturnConfirm($orderOrRefund)
+    {
+        if (empty($orderOrRefund)) {
+            return false;
+        }
+        if (self::isOnlinePayOrder($orderOrRefund)) {
+            return false;
+        }
+        $payWay = intval($orderOrRefund->payWay ?? 0);
+        if (self::isBalanceOrDebtPayWay($payWay)) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 是否待选手选资金落地(成功页二选一)
+     */
+    public static function needFundAction($refund)
+    {
+        if (empty($refund)) {
+            return 0;
+        }
+        if (intval($refund->hasReturn ?? 0) === self::FLAG_YES) {
+            return 0;
+        }
+        if (intval($refund->returnBalance ?? 0) === self::FLAG_YES) {
+            return 0;
+        }
+        if (intval($refund->couldReturn ?? 0) !== self::FLAG_YES) {
+            return 0;
+        }
+        return 1;
+    }
+
     /**
     /**
      * 生成售后资金快照(落 xhRefund/xhCgRefund)
      * 生成售后资金快照(落 xhRefund/xhCgRefund)
      * - 有原单:onlinePay/payWay 与订单一致;余额/挂账 couldReturn=0,其它=1
      * - 有原单:onlinePay/payWay 与订单一致;余额/挂账 couldReturn=0,其它=1