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 9250d34f..91bbf9cd 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 @@ -592,3 +592,49 @@ font-size: 13px; color: #6b7280; } + +/* [2026-01-07] 新增:固定账户卡片底部样式 */ +.cardFooter { + margin-top: 12px; + padding-top: 12px; + border-top: 1px solid #e5e7eb; +} + +.viewLedgerButton { + width: 100%; + padding: 8px 12px; + background-color: #f3f4f6; + color: #374151; + border: 1px solid #d1d5db; + border-radius: 6px; + cursor: pointer; + font-size: 13px; + transition: all 0.2s ease; + + &:hover:not(:disabled) { + background-color: #e5e7eb; + border-color: #9ca3af; + } + + &:disabled { + opacity: 0.6; + cursor: not-allowed; + } +} + +.accountLedgerSection { + margin-top: 12px; + padding-top: 12px; + border-top: 1px solid #e5e7eb; + max-height: 400px; + overflow-y: auto; + + .table { + font-size: 12px; + + th, + td { + padding: 8px 10px; + } + } +} 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 b9e8e916..a4463e24 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 @@ -296,6 +296,7 @@ export default function SystemAccountsTab() { /** * 固定系统账户区域 * [2026-01-05] 更新:根据业务需求调整显示名称,USDT改为绿积分 + * [2026-01-07] 更新:添加查看分类账明细按钮 */ function FixedAccountsSection({ data }: { data: SystemAccountReportResponse['fixedAccounts'] }) { // [2026-01-07] 更新:使用 SYSTEM_ACCOUNT_NAMES 映射获取正式名称 @@ -307,37 +308,136 @@ function FixedAccountsSection({ data }: { data: SystemAccountReportResponse['fix { key: 'platformFee', sequence: 'S0000000005', data: data.platformFee }, ]; + // [2026-01-07] 新增:展开状态管理和分类账数据 + const [expandedAccount, setExpandedAccount] = 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: 50 }); + if (response.data) { + setAllLedgerData(response.data); + } + } catch (err) { + console.error('Failed to load ledger data:', err); + } finally { + setLedgerLoading(false); + } + }, [allLedgerData]); + + // 切换显示某个账户的明细 + const handleToggleLedger = async (accountSequence: string) => { + if (expandedAccount === accountSequence) { + setExpandedAccount(null); + return; + } + + // 如果还没有加载数据,先加载 + if (!allLedgerData) { + await loadAllLedger(); + } + setExpandedAccount(accountSequence); + }; + + // 获取指定账户的分类账数据 + const getAccountLedger = (accountSequence: string): LedgerEntryDTO[] => { + if (!allLedgerData?.fixedAccountsLedger) return []; + const accountLedger = allLedgerData.fixedAccountsLedger.find( + (item) => item.accountSequence === accountSequence + ); + return accountLedger?.ledger || []; + }; + return (

固定系统账户

- {accounts.map(({ key, sequence, data: accountData }) => ( -
-
- {getAccountDisplayName(sequence)} + {accounts.map(({ key, sequence, data: accountData }) => { + const isExpanded = expandedAccount === sequence; + const ledger = isExpanded ? getAccountLedger(sequence) : []; + + return ( +
+
+ {getAccountDisplayName(sequence)} +
+
+
+ 账户余额 + + {accountData ? formatAmount(accountData.usdtBalance) : '0.00'} 绿积分 + +
+
+ 累计收入 + + {accountData ? formatAmount(accountData.totalReceived) : '0.00'} 绿积分 + +
+
+ 累计转出 + + {accountData ? formatAmount(accountData.totalTransferred) : '0.00'} 绿积分 + +
+
+ {/* [2026-01-07] 新增:查看明细按钮 */} +
+ +
+ {/* [2026-01-07] 新增:展开的分类账明细 */} + {isExpanded && ( +
+ {ledger.length > 0 ? ( +
+ + + + + + + + + + + + {ledger.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.memo || entry.allocationType || '-'}
+
+ ) : ( +
暂无流水记录
+ )} +
+ )}
-
-
- 账户余额 - - {accountData ? formatAmount(accountData.usdtBalance) : '0.00'} 绿积分 - -
-
- 累计收入 - - {accountData ? formatAmount(accountData.totalReceived) : '0.00'} 绿积分 - -
-
- 累计转出 - - {accountData ? formatAmount(accountData.totalTransferred) : '0.00'} 绿积分 - -
-
-
- ))} + ); + })}
);