feat(admin-web): 系统账户显示正式名称并保留编码
- 添加 SYSTEM_ACCOUNT_NAMES 映射:S0000000001-S0000000006 映射到正式名称 - 添加 PROVINCE_CODE_NAMES 映射:中国省份行政区划代码映射 - 添加 getAccountDisplayName 函数:统一显示格式 "名称 (编码)" - FixedAccountsSection: 固定账户显示为 "总部账户 (S0000000001)" 格式 - RegionAccountsSection: 区域账户合并显示名称和编码 - LedgerAccountCard: 分类账卡片显示完整账户信息 - FeeAccountSection: 手续费归集账户显示正式名称 - RewardTypeSummarySection: 收益明细显示账户正式名称 - OfflineSettlementSection: 面对面结算明细显示账户正式名称 回滚方式:恢复 imports,删除映射常量和 getAccountDisplayName 函数 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ce1d342269
commit
2d9d6ceed7
|
|
@ -26,7 +26,7 @@ import type {
|
||||||
OfflineSettlementEntriesResponse,
|
OfflineSettlementEntriesResponse,
|
||||||
OfflineSettlementEntryDTO,
|
OfflineSettlementEntryDTO,
|
||||||
} from '@/types';
|
} from '@/types';
|
||||||
import { ENTRY_TYPE_LABELS, ACCOUNT_TYPE_LABELS, FEE_TYPE_LABELS, REWARD_RIGHT_TYPE_LABELS, REWARD_STATUS_LABELS, FEE_COLLECTION_TYPE_LABELS } from '@/types';
|
import { ENTRY_TYPE_LABELS, ACCOUNT_TYPE_LABELS, FEE_TYPE_LABELS, REWARD_RIGHT_TYPE_LABELS, REWARD_STATUS_LABELS, FEE_COLLECTION_TYPE_LABELS, getAccountDisplayName, SYSTEM_ACCOUNT_NAMES, PROVINCE_CODE_NAMES } from '@/types';
|
||||||
import styles from './SystemAccountsTab.module.scss';
|
import styles from './SystemAccountsTab.module.scss';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -296,23 +296,23 @@ export default function SystemAccountsTab() {
|
||||||
* [2026-01-05] 更新:根据业务需求调整显示名称,USDT改为绿积分
|
* [2026-01-05] 更新:根据业务需求调整显示名称,USDT改为绿积分
|
||||||
*/
|
*/
|
||||||
function FixedAccountsSection({ data }: { data: SystemAccountReportResponse['fixedAccounts'] }) {
|
function FixedAccountsSection({ data }: { data: SystemAccountReportResponse['fixedAccounts'] }) {
|
||||||
|
// [2026-01-07] 更新:使用 SYSTEM_ACCOUNT_NAMES 映射获取正式名称
|
||||||
const accounts = [
|
const accounts = [
|
||||||
{ key: 'costAccount', label: '总部储备', sequence: 'S0000000001', data: data.costAccount },
|
{ key: 'costAccount', sequence: 'S0000000001', data: data.costAccount },
|
||||||
{ key: 'operationAccount', label: '运营账户1', sequence: 'S0000000002', data: data.operationAccount },
|
{ key: 'operationAccount', sequence: 'S0000000002', data: data.operationAccount },
|
||||||
{ key: 'hqCommunity', label: '运营账户2', sequence: 'S0000000003', data: data.hqCommunity },
|
{ key: 'hqCommunity', sequence: 'S0000000003', data: data.hqCommunity },
|
||||||
{ key: 'rwadPoolPending', label: '积分股池', sequence: 'S0000000004', data: data.rwadPoolPending },
|
{ key: 'rwadPoolPending', sequence: 'S0000000004', data: data.rwadPoolPending },
|
||||||
{ key: 'platformFee', label: '平台手续费', sequence: 'S0000000005', data: data.platformFee },
|
{ key: 'platformFee', sequence: 'S0000000005', data: data.platformFee },
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.section}>
|
<div className={styles.section}>
|
||||||
<h3 className={styles.sectionTitle}>固定系统账户</h3>
|
<h3 className={styles.sectionTitle}>固定系统账户</h3>
|
||||||
<div className={styles.cardGrid}>
|
<div className={styles.cardGrid}>
|
||||||
{accounts.map(({ key, label, sequence, data: accountData }) => (
|
{accounts.map(({ key, sequence, data: accountData }) => (
|
||||||
<div key={key} className={styles.accountCard}>
|
<div key={key} className={styles.accountCard}>
|
||||||
<div className={styles.cardHeader}>
|
<div className={styles.cardHeader}>
|
||||||
<span className={styles.accountLabel}>{label}</span>
|
<span className={styles.accountLabel}>{getAccountDisplayName(sequence)}</span>
|
||||||
<span className={styles.accountSequence}>{sequence}</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.cardBody}>
|
<div className={styles.cardBody}>
|
||||||
<div className={styles.statRow}>
|
<div className={styles.statRow}>
|
||||||
|
|
@ -374,8 +374,7 @@ function RegionAccountsSection({ data, type }: { data: RegionAccountsSummary; ty
|
||||||
<table className={styles.table}>
|
<table className={styles.table}>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>区域代码</th>
|
<th>区域</th>
|
||||||
<th>区域名称</th>
|
|
||||||
<th>余额 (绿积分)</th>
|
<th>余额 (绿积分)</th>
|
||||||
<th>累计收入 (绿积分)</th>
|
<th>累计收入 (绿积分)</th>
|
||||||
<th>状态</th>
|
<th>状态</th>
|
||||||
|
|
@ -384,8 +383,8 @@ function RegionAccountsSection({ data, type }: { data: RegionAccountsSummary; ty
|
||||||
<tbody>
|
<tbody>
|
||||||
{data.accounts.map((account) => (
|
{data.accounts.map((account) => (
|
||||||
<tr key={account.id}>
|
<tr key={account.id}>
|
||||||
<td>{account.regionCode || '-'}</td>
|
{/* [2026-01-07] 更新:合并显示区域名称和编码 */}
|
||||||
<td>{account.regionName || '-'}</td>
|
<td>{account.regionName ? `${account.regionName} (${account.regionCode})` : account.regionCode || '-'}</td>
|
||||||
<td>{formatAmount(account.usdtBalance)}</td>
|
<td>{formatAmount(account.usdtBalance)}</td>
|
||||||
<td>{formatAmount(account.totalReceived)}</td>
|
<td>{formatAmount(account.totalReceived)}</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
@ -519,7 +518,8 @@ function OfflineSettlementSection({ data }: { data: SystemAccountReportResponse[
|
||||||
<tbody>
|
<tbody>
|
||||||
{entriesData.entries.map((entry) => (
|
{entriesData.entries.map((entry) => (
|
||||||
<tr key={entry.id}>
|
<tr key={entry.id}>
|
||||||
<td>{entry.accountSequence}</td>
|
{/* [2026-01-07] 更新:使用 getAccountDisplayName 显示账户名称和编码 */}
|
||||||
|
<td>{getAccountDisplayName(entry.accountSequence)}</td>
|
||||||
<td>{formatAmount(entry.amount)}</td>
|
<td>{formatAmount(entry.amount)}</td>
|
||||||
<td>{entry.memo || '-'}</td>
|
<td>{entry.memo || '-'}</td>
|
||||||
<td>{new Date(entry.createdAt).toLocaleString('zh-CN')}</td>
|
<td>{new Date(entry.createdAt).toLocaleString('zh-CN')}</td>
|
||||||
|
|
@ -704,14 +704,15 @@ function LedgerSection({
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 固定系统账户分类账 */}
|
{/* 固定系统账户分类账 */}
|
||||||
|
{/* [2026-01-07] 更新:使用 getAccountDisplayName 显示账户名称和编码 */}
|
||||||
{data.fixedAccountsLedger && data.fixedAccountsLedger.length > 0 && (
|
{data.fixedAccountsLedger && data.fixedAccountsLedger.length > 0 && (
|
||||||
<div className={styles.ledgerGroup}>
|
<div className={styles.ledgerGroup}>
|
||||||
<h4 className={styles.subTitle}>固定系统账户</h4>
|
<h4 className={styles.subTitle}>固定系统账户</h4>
|
||||||
{data.fixedAccountsLedger.map((account) => (
|
{data.fixedAccountsLedger.map((account) => (
|
||||||
<LedgerAccountCard
|
<LedgerAccountCard
|
||||||
key={account.accountSequence}
|
key={account.accountSequence}
|
||||||
title={getAccountTypeLabel(account.accountType)}
|
title={getAccountDisplayName(account.accountSequence)}
|
||||||
subtitle={account.accountSequence}
|
subtitle=""
|
||||||
ledger={account.ledger}
|
ledger={account.ledger}
|
||||||
total={account.total}
|
total={account.total}
|
||||||
expanded={expandedAccounts.has(account.accountSequence)}
|
expanded={expandedAccounts.has(account.accountSequence)}
|
||||||
|
|
@ -729,8 +730,8 @@ function LedgerSection({
|
||||||
{data.provinceAccountsLedger.map((account) => (
|
{data.provinceAccountsLedger.map((account) => (
|
||||||
<LedgerAccountCard
|
<LedgerAccountCard
|
||||||
key={account.accountSequence}
|
key={account.accountSequence}
|
||||||
title={account.regionName || account.regionCode}
|
title={account.regionName ? `${account.regionName} (${account.accountSequence})` : getAccountDisplayName(account.accountSequence)}
|
||||||
subtitle={account.accountSequence}
|
subtitle=""
|
||||||
ledger={account.ledger}
|
ledger={account.ledger}
|
||||||
total={account.total}
|
total={account.total}
|
||||||
expanded={expandedAccounts.has(account.accountSequence)}
|
expanded={expandedAccounts.has(account.accountSequence)}
|
||||||
|
|
@ -748,8 +749,8 @@ function LedgerSection({
|
||||||
{data.cityAccountsLedger.map((account) => (
|
{data.cityAccountsLedger.map((account) => (
|
||||||
<LedgerAccountCard
|
<LedgerAccountCard
|
||||||
key={account.accountSequence}
|
key={account.accountSequence}
|
||||||
title={account.regionName || account.regionCode}
|
title={account.regionName ? `${account.regionName} (${account.accountSequence})` : getAccountDisplayName(account.accountSequence)}
|
||||||
subtitle={account.accountSequence}
|
subtitle=""
|
||||||
ledger={account.ledger}
|
ledger={account.ledger}
|
||||||
total={account.total}
|
total={account.total}
|
||||||
expanded={expandedAccounts.has(account.accountSequence)}
|
expanded={expandedAccounts.has(account.accountSequence)}
|
||||||
|
|
@ -807,7 +808,8 @@ function LedgerAccountCard({
|
||||||
<div className={styles.ledgerCardHeader} onClick={onToggle}>
|
<div className={styles.ledgerCardHeader} onClick={onToggle}>
|
||||||
<div className={styles.ledgerCardTitle}>
|
<div className={styles.ledgerCardTitle}>
|
||||||
<span className={styles.accountName}>{title}</span>
|
<span className={styles.accountName}>{title}</span>
|
||||||
<span className={styles.accountSequence}>{subtitle}</span>
|
{/* [2026-01-07] 更新:subtitle 为空时不显示 */}
|
||||||
|
{subtitle && <span className={styles.accountSequence}>{subtitle}</span>}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.ledgerCardInfo}>
|
<div className={styles.ledgerCardInfo}>
|
||||||
<span className={styles.ledgerCount}>{total} 条记录</span>
|
<span className={styles.ledgerCount}>{total} 条记录</span>
|
||||||
|
|
@ -957,9 +959,10 @@ function FeeAccountSection({
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 账户信息 */}
|
{/* 账户信息 */}
|
||||||
|
{/* [2026-01-07] 更新:使用 getAccountDisplayName 显示账户名称和编码 */}
|
||||||
<div className={styles.accountInfo}>
|
<div className={styles.accountInfo}>
|
||||||
<span className={styles.accountLabel}>手续费归集账户: </span>
|
<span className={styles.accountLabel}>手续费归集账户: </span>
|
||||||
<span className={styles.accountValue}>{data.accountSequence}</span>
|
<span className={styles.accountValue}>{getAccountDisplayName(data.accountSequence)}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 汇总卡片 */}
|
{/* 汇总卡片 */}
|
||||||
|
|
@ -1323,7 +1326,8 @@ function RewardTypeSummarySection({
|
||||||
{detailsData.entries.map((entry) => (
|
{detailsData.entries.map((entry) => (
|
||||||
<tr key={entry.id}>
|
<tr key={entry.id}>
|
||||||
<td>{new Date(entry.createdAt).toLocaleString('zh-CN')}</td>
|
<td>{new Date(entry.createdAt).toLocaleString('zh-CN')}</td>
|
||||||
<td>{entry.accountSequence}</td>
|
{/* [2026-01-07] 更新:使用 getAccountDisplayName 显示账户名称和编码 */}
|
||||||
|
<td>{getAccountDisplayName(entry.accountSequence)}</td>
|
||||||
<td className={styles.orderId}>{entry.sourceOrderId}</td>
|
<td className={styles.orderId}>{entry.sourceOrderId}</td>
|
||||||
<td>{formatAmount(entry.usdtAmount)}</td>
|
<td>{formatAmount(entry.usdtAmount)}</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
||||||
|
|
@ -380,3 +380,122 @@ export const FEE_COLLECTION_TYPE_LABELS: Record<string, string> = {
|
||||||
FIAT_WITHDRAWAL_FEE: '法币提现手续费',
|
FIAT_WITHDRAWAL_FEE: '法币提现手续费',
|
||||||
UNKNOWN: '未知类型',
|
UNKNOWN: '未知类型',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// [2026-01-07] 新增:系统账户名称映射
|
||||||
|
/**
|
||||||
|
* 系统账户序列号到正式名称的映射
|
||||||
|
*/
|
||||||
|
export const SYSTEM_ACCOUNT_NAMES: Record<string, string> = {
|
||||||
|
'S0000000001': '总部账户',
|
||||||
|
'S0000000002': '成本账户',
|
||||||
|
'S0000000003': '运营账户',
|
||||||
|
'S0000000004': 'RWAD底池',
|
||||||
|
'S0000000005': '分享权益池',
|
||||||
|
'S0000000006': '手续费归集',
|
||||||
|
};
|
||||||
|
|
||||||
|
// [2026-01-07] 新增:省份行政区划代码映射
|
||||||
|
/**
|
||||||
|
* 省份区域代码到名称的映射
|
||||||
|
*/
|
||||||
|
export const PROVINCE_CODE_NAMES: Record<string, string> = {
|
||||||
|
'11': '北京市',
|
||||||
|
'12': '天津市',
|
||||||
|
'13': '河北省',
|
||||||
|
'14': '山西省',
|
||||||
|
'15': '内蒙古自治区',
|
||||||
|
'21': '辽宁省',
|
||||||
|
'22': '吉林省',
|
||||||
|
'23': '黑龙江省',
|
||||||
|
'31': '上海市',
|
||||||
|
'32': '江苏省',
|
||||||
|
'33': '浙江省',
|
||||||
|
'34': '安徽省',
|
||||||
|
'35': '福建省',
|
||||||
|
'36': '江西省',
|
||||||
|
'37': '山东省',
|
||||||
|
'41': '河南省',
|
||||||
|
'42': '湖北省',
|
||||||
|
'43': '湖南省',
|
||||||
|
'44': '广东省',
|
||||||
|
'45': '广西壮族自治区',
|
||||||
|
'46': '海南省',
|
||||||
|
'50': '重庆市',
|
||||||
|
'51': '四川省',
|
||||||
|
'52': '贵州省',
|
||||||
|
'53': '云南省',
|
||||||
|
'54': '西藏自治区',
|
||||||
|
'61': '陕西省',
|
||||||
|
'62': '甘肃省',
|
||||||
|
'63': '青海省',
|
||||||
|
'64': '宁夏回族自治区',
|
||||||
|
'65': '新疆维吾尔自治区',
|
||||||
|
'71': '台湾省',
|
||||||
|
'81': '香港特别行政区',
|
||||||
|
'82': '澳门特别行政区',
|
||||||
|
// 带0000后缀的格式(某些系统可能使用)
|
||||||
|
'110000': '北京市',
|
||||||
|
'120000': '天津市',
|
||||||
|
'130000': '河北省',
|
||||||
|
'140000': '山西省',
|
||||||
|
'150000': '内蒙古自治区',
|
||||||
|
'210000': '辽宁省',
|
||||||
|
'220000': '吉林省',
|
||||||
|
'230000': '黑龙江省',
|
||||||
|
'310000': '上海市',
|
||||||
|
'320000': '江苏省',
|
||||||
|
'330000': '浙江省',
|
||||||
|
'340000': '安徽省',
|
||||||
|
'350000': '福建省',
|
||||||
|
'360000': '江西省',
|
||||||
|
'370000': '山东省',
|
||||||
|
'410000': '河南省',
|
||||||
|
'420000': '湖北省',
|
||||||
|
'430000': '湖南省',
|
||||||
|
'440000': '广东省',
|
||||||
|
'450000': '广西壮族自治区',
|
||||||
|
'460000': '海南省',
|
||||||
|
'500000': '重庆市',
|
||||||
|
'510000': '四川省',
|
||||||
|
'520000': '贵州省',
|
||||||
|
'530000': '云南省',
|
||||||
|
'540000': '西藏自治区',
|
||||||
|
'610000': '陕西省',
|
||||||
|
'620000': '甘肃省',
|
||||||
|
'630000': '青海省',
|
||||||
|
'640000': '宁夏回族自治区',
|
||||||
|
'650000': '新疆维吾尔自治区',
|
||||||
|
'710000': '台湾省',
|
||||||
|
'810000': '香港特别行政区',
|
||||||
|
'820000': '澳门特别行政区',
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取账户显示名称(同时保留编码)
|
||||||
|
* 格式:名称 (编码)
|
||||||
|
*/
|
||||||
|
export function getAccountDisplayName(accountSequence: string): string {
|
||||||
|
// 检查是否是系统账户
|
||||||
|
if (SYSTEM_ACCOUNT_NAMES[accountSequence]) {
|
||||||
|
return `${SYSTEM_ACCOUNT_NAMES[accountSequence]} (${accountSequence})`;
|
||||||
|
}
|
||||||
|
// 检查是否是7位数字的区域账户
|
||||||
|
if (/^\d{7}$/.test(accountSequence)) {
|
||||||
|
const provinceCode = accountSequence.substring(0, 2);
|
||||||
|
const cityPart = accountSequence.substring(2, 4);
|
||||||
|
const provinceName = PROVINCE_CODE_NAMES[provinceCode];
|
||||||
|
|
||||||
|
if (provinceName) {
|
||||||
|
// 判断是省级还是市级账户
|
||||||
|
if (cityPart === '00') {
|
||||||
|
// 省级账户
|
||||||
|
return `${provinceName}(省级)(${accountSequence})`;
|
||||||
|
} else {
|
||||||
|
// 市级账户 - 显示省份简称 + 市级代码
|
||||||
|
const shortProvinceName = provinceName.replace(/省|市|自治区|特别行政区|壮族|回族|维吾尔/g, '');
|
||||||
|
return `${shortProvinceName}${cityPart}市 (${accountSequence})`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return accountSequence;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue