From 46587f6b88c17a7523d0c0cfc1ef1c6a3422aca1 Mon Sep 17 00:00:00 2001 From: linkeyu <798648091@qq.com> Date: Fri, 24 Jul 2026 11:04:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E6=98=8E=E7=A1=AE?= =?UTF-8?q?=E6=8F=90=E7=8E=B0=E5=AE=A1=E6=A0=B8=E7=8A=B6=E6=80=81=E4=B8=8E?= =?UTF-8?q?=E8=B6=85=E6=97=B6=E8=AE=A2=E5=8D=95=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重新梳理微信提现配置和现金账本提示层级,增加检测反馈与校验时间,并将批量对账改为更明确的超时订单处理说明。移除自动查单关闭提示,避免把非阻断运维状态展示为业务异常。 --- src/app/(main)/withdraws/page.tsx | 130 +++++++++++++++++++++++------- 1 file changed, 102 insertions(+), 28 deletions(-) diff --git a/src/app/(main)/withdraws/page.tsx b/src/app/(main)/withdraws/page.tsx index 666e757..fd248e4 100644 --- a/src/app/(main)/withdraws/page.tsx +++ b/src/app/(main)/withdraws/page.tsx @@ -142,7 +142,7 @@ function actionLabel(action: string) { 'withdraw.approve': '审核通过', 'withdraw.reject': '审核拒绝', 'withdraw.refresh': '查单刷新', - 'withdraw.reconcile': '批量对账', + 'withdraw.reconcile': '处理超时订单', }; return labels[action] || action; } @@ -182,8 +182,11 @@ export default function WithdrawsPage() { const [activeStatus, setActiveStatus] = useState('reviewing'); const [summary, setSummary] = useState(null); const [health, setHealth] = useState(null); + const [healthLoading, setHealthLoading] = useState(false); + const [healthCheckedAt, setHealthCheckedAt] = useState(null); const [ledger, setLedger] = useState(null); const [ledgerLoading, setLedgerLoading] = useState(false); + const [ledgerCheckedAt, setLedgerCheckedAt] = useState(null); const [drawerOpen, setDrawerOpen] = useState(false); const [detail, setDetail] = useState(null); const [detailLoading, setDetailLoading] = useState(false); @@ -255,21 +258,36 @@ export default function WithdrawsPage() { } }, []); - const loadHealth = useCallback(async () => { + const loadHealth = useCallback(async (showFeedback = false) => { + setHealthLoading(true); try { const { data } = await api.get('/admin/api/withdraws/health-check'); setHealth(data); + setHealthCheckedAt(Date.now()); + if (showFeedback) { + message.success(data.ok ? '检测完成,微信提现配置正常' : '检测完成,仍有配置项需要处理'); + } } catch (e) { message.error(errMsg(e)); + } finally { + setHealthLoading(false); } }, []); // 账本校验是全表对账、相对重,故只在进页时拉一次 + 提供手动按钮,不随每次写操作重算。 - const loadLedger = useCallback(async () => { + const loadLedger = useCallback(async (showFeedback = false) => { setLedgerLoading(true); try { const { data } = await api.get('/admin/api/withdraws/ledger-check'); setLedger(data); + setLedgerCheckedAt(Date.now()); + if (showFeedback) { + if (data.ok) { + message.success('校验完成,现金账本正常'); + } else { + message.warning('校验完成,发现现金账本异常'); + } + } } catch (e) { message.error(errMsg(e)); } finally { @@ -465,15 +483,16 @@ export default function WithdrawsPage() { const reconcile = () => { modal.confirm({ - title: '批量对账?', - content: '扫描超过 15 分钟仍处于打款中的提现单,逐单向微信查实并归一化。', - okText: '开始对账', + title: '处理超时打款订单?', + content: + '将检查超过 15 分钟仍处于“打款中”的订单:微信已成功则更新为“已到账”;失败则退款;仍待用户确认的老单将撤销并退款;仍在处理中则保持不变。', + okText: '开始处理', onOk: async () => { try { const { data } = await api.post<{ checked: number; resolved: number }>( '/admin/api/withdraws/reconcile', ); - message.success(`对账完成: 检查 ${data.checked} 单,解决 ${data.resolved} 单`); + message.success(`处理完成:检查 ${data.checked} 单,更新 ${data.resolved} 单`); await refreshAfterChange(); } catch (e) { message.error(errMsg(e)); @@ -652,6 +671,10 @@ export default function WithdrawsPage() { : '', ].filter(Boolean) : []; + const payoutReady = Boolean( + health?.wxpay_configured && health.private_key_loadable && health.public_key_loadable, + ); + const hasBlockingPayoutIssue = Boolean(health && !payoutReady); return (
@@ -662,41 +685,62 @@ export default function WithdrawsPage() {
{canManage && ( )} - {(health || ledger) && ( + {(hasBlockingPayoutIssue || (ledger && !ledger.ok)) && ( - {health && ( + {health && hasBlockingPayoutIssue && ( - )} - {ledger && ( - + 微信支付配置不完整,点击“通过并打款”将失败。请联系部署管理员处理。 + {healthCheckedAt && ( + + 最近检测:{dayjs(healthCheckedAt).format('HH:mm:ss')} + + )} +
+ 查看技术详情 +
    + {health.issues.map((issue) => ( +
  • + {issue} +
  • + ))} +
+
+
} + action={ + + } + /> + )} + {ledger && !ledger.ok && ( + } loading={ledgerLoading} - onClick={() => void loadLedger()} + onClick={() => void loadLedger(true)} > 重新校验 @@ -706,6 +750,36 @@ export default function WithdrawsPage() { )} + {(health || ledger) && ( + + {health && payoutReady && 微信打款可用} + {ledger?.ok && ( + + + 账本正常 + {ledgerCheckedAt && ( + + · {dayjs(ledgerCheckedAt).format('HH:mm:ss')} 校验 + + )} + + + )} + + )} +