shish 6 часов назад
Родитель
Сommit
a33ce89e75

+ 2 - 0
app-ghs/controllers/CustomController.php

@@ -145,10 +145,12 @@ class CustomController extends BaseController
         $envVersion = miniUtil::normalizeMiniEnvVersion($get['env_version'] ?? 'release');
         $miniCode = miniUtil::generateUnlimitedMiniCode($merchant, $page, $scene, $ptStyle, $envVersion);
         $imageUrl = imgUtil::groupImg($miniCode);
+        // 顺带回客户当前余额,供冲销凭证海报补全「最新余额」(避免前端 query 丢参)
         util::success([
             'imgUrl' => $imageUrl,
             'ghsId' => $ghsId,
             'salt' => $salt,
+            'balance' => bcadd((string)($custom->balance ?? '0'), '0', 2),
         ]);
     }
 

+ 5 - 1
biz-ghs/forward/services/ForwardService.php

@@ -262,6 +262,7 @@ class ForwardService extends BaseService
 
         // 资金分支(原单 actPrice/tkPrice 不动)
         $thirdRefundNo = '';
+        $customBalance = bcadd((string)($custom->balance ?? '0'), '0', 2);
         if ($fundType === ForwardClass::FUND_ORIGINAL) {
             if (empty($cg)) {
                 util::fail('无原采购单,无法原路退回');
@@ -270,7 +271,8 @@ class ForwardService extends BaseService
             $ghsForward->thirdRefundNo = $thirdRefundNo;
             $ghsForward->save(false, ['thirdRefundNo']);
         } elseif ($fundType === ForwardClass::FUND_BALANCE) {
-            CustomClass::forwardReturnBalance($custom, $ghsForward, $amount);
+            // 返充后最新余额,供前端退款凭证海报展示
+            $customBalance = CustomClass::forwardReturnBalance($custom, $ghsForward, $amount);
         }
         // FUND_NONE:仅记账,不动作
 
@@ -338,6 +340,8 @@ class ForwardService extends BaseService
             'fundType' => $fundType,
             'amount' => $amount,
             'customId' => $customId,
+            'customName' => $custom->name ?? '',
+            'customBalance' => $customBalance,
             'thirdRefundNo' => $thirdRefundNo,
         ];
     }