From 6a659ca7185826ba1505b024b7b46b2d183fa99b Mon Sep 17 00:00:00 2001 From: hailin Date: Sat, 28 Feb 2026 20:37:12 -0800 Subject: [PATCH] =?UTF-8?q?feat(admin-web):=20=E7=9C=81/=E5=B8=82=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E8=B4=A6=E6=88=B7=E6=B7=BB=E5=8A=A0=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E6=98=8E=E7=BB=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RegionAccountsSection 新增: - 每行添加"查看明细"按钮,点击展开该账户分类账流水 - 明细表包含 时间/类型/金额/余额/来源账户/来源备注/备注 7列 - 复用 getAllLedger API 的 provinceAccountsLedger/cityAccountsLedger 数据 - 行点击和按钮点击均可展开/收起 - 新增 clickableRow/selectedRow CSS 样式 Co-Authored-By: Claude Opus 4.6 --- .../SystemAccountsTab.module.scss | 16 +++ .../SystemAccountsTab.tsx | 123 +++++++++++++++++- 2 files changed, 138 insertions(+), 1 deletion(-) diff --git a/frontend/admin-web/src/components/features/system-account-report/SystemAccountsTab.module.scss b/frontend/admin-web/src/components/features/system-account-report/SystemAccountsTab.module.scss index c5f032f0..b4654fc4 100644 --- a/frontend/admin-web/src/components/features/system-account-report/SystemAccountsTab.module.scss +++ b/frontend/admin-web/src/components/features/system-account-report/SystemAccountsTab.module.scss @@ -683,6 +683,22 @@ } } +/* [2026-02-28] 新增:区域账户表格行可点击样式 */ +.clickableRow { + cursor: pointer; + transition: background-color 0.15s ease; + + &:hover { + background-color: #eff6ff !important; + } +} + +.selectedRow { + cursor: pointer; + background-color: #eff6ff !important; + border-left: 3px solid #3b82f6; +} + .accountLedgerSection { margin-top: 12px; padding-top: 12px; diff --git a/frontend/admin-web/src/components/features/system-account-report/SystemAccountsTab.tsx b/frontend/admin-web/src/components/features/system-account-report/SystemAccountsTab.tsx index c8067fdf..ae2d138d 100644 --- a/frontend/admin-web/src/components/features/system-account-report/SystemAccountsTab.tsx +++ b/frontend/admin-web/src/components/features/system-account-report/SystemAccountsTab.tsx @@ -482,10 +482,57 @@ function FixedAccountsSection({ data }: { data: SystemAccountReportResponse['fix * 区域账户汇总区域 * [2026-01-05] 更新:USDT改为绿积分 * [2026-01-07] 更新:增加累计转出显示 + * [2026-02-28] 更新:添加点击账户行展开分类账明细,显示来源账户和来源备注 */ function RegionAccountsSection({ data, type }: { data: RegionAccountsSummary; type: 'province' | 'city' }) { const typeLabel = type === 'province' ? '省' : '市'; + // [2026-02-28] 新增:账户明细展开相关状态 + const [selectedAccount, setSelectedAccount] = useState(null); + const [allLedgerData, setAllLedgerData] = useState(null); + const [ledgerLoading, setLedgerLoading] = useState(false); + + // 加载所有系统账户分类账数据 + const loadAllLedger = useCallback(async () => { + if (allLedgerData) return; + setLedgerLoading(true); + try { + const response = await systemAccountReportService.getAllLedger({ pageSize: 100 }); + if (response.data) { + setAllLedgerData(response.data); + } + } catch (err) { + console.error('Failed to load ledger data:', err); + } finally { + setLedgerLoading(false); + } + }, [allLedgerData]); + + // 获取指定区域账户的分类账数据 + const getAccountLedger = useCallback((accountSequence: string): LedgerEntryDTO[] => { + const ledgerKey = type === 'province' ? 'provinceAccountsLedger' : 'cityAccountsLedger'; + const regionLedgers = allLedgerData?.[ledgerKey]; + if (!regionLedgers) return []; + const accountLedger = regionLedgers.find( + (item) => item.accountSequence === accountSequence + ); + return accountLedger?.ledger || []; + }, [allLedgerData, type]); + + // 点击账户行展开/收起明细 + const handleSelectAccount = async (accountSequence: string) => { + if (selectedAccount === accountSequence) { + setSelectedAccount(null); + return; + } + if (!allLedgerData) { + await loadAllLedger(); + } + setSelectedAccount(accountSequence); + }; + + const currentLedger = selectedAccount ? getAccountLedger(selectedAccount) : []; + return (

{typeLabel}区域账户汇总

@@ -522,11 +569,16 @@ function RegionAccountsSection({ data, type }: { data: RegionAccountsSummary; ty 累计收入 (绿积分) 累计转出 (绿积分) 状态 + 操作 {data.accounts.map((account) => ( - + handleSelectAccount(account.accountSequence)} + > {/* [2026-01-07] 更新:使用 getAccountDisplayName 解析区域代码为省市名称 */} {account.regionCode ? getAccountDisplayName(account.regionCode) : '-'} {formatAmount(account.usdtBalance)} @@ -537,6 +589,15 @@ function RegionAccountsSection({ data, type }: { data: RegionAccountsSummary; ty {account.status === 'ACTIVE' ? '正常' : account.status} + + + ))} @@ -545,6 +606,66 @@ function RegionAccountsSection({ data, type }: { data: RegionAccountsSummary; ty ) : (
暂无{typeLabel}区域账户数据
)} + + {/* [2026-02-28] 新增:选中账户的分类账明细展开区域 */} + {selectedAccount && ( +
+
+

+ {getAccountDisplayName(selectedAccount)} - 分类账明细 +

+ +
+ {ledgerLoading ? ( +
+
+ 加载明细中... +
+ ) : currentLedger.length > 0 ? ( +
+ + + + + + + + + + + + + + {currentLedger.map((entry) => ( + + + + + + + + + + ))} + +
时间类型金额余额来源账户来源备注备注
{new Date(entry.createdAt).toLocaleString('zh-CN')} + + {ENTRY_TYPE_LABELS[entry.entryType] || entry.entryType} + + = 0 ? styles.amountPositive : styles.amountNegative}> + {entry.amount >= 0 ? '+' : ''}{formatAmount(entry.amount)} {getAssetTypeLabel(entry.assetType)} + {entry.balanceAfter !== null ? formatAmount(entry.balanceAfter) : '-'}{entry.sourceAccountSequence || '-'}{entry.sourceMemo || '-'}{entry.memo || entry.allocationType || '-'}
+
+ ) : ( +
暂无流水记录
+ )} +
+ )}
); }