Files
thebet365/apps/admin/src/utils/walletTx.ts
Mars 03e72ca9b2 feat: 开户备注、账单展示优化与后台代理管理增强
- 新增初始上分备注(日常上分/开户赠金/自定义)及前后台校验与展示

- 优化钱包流水类型与备注显示,区分管理员/代理/玩家上下分

- 修复登录后语言被后端覆盖的问题,登录时同步当前语言到服务端

- 后台代理/玩家表格操作栏重构,充值订单增加备注列

- 前台个人中心、充值、账单与验证码组件体验优化

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-11 17:23:58 +08:00

67 lines
2.3 KiB
TypeScript

export const TX_KEY_MAP: Record<string, string> = {
MANUAL_DEPOSIT: 'finance.tx.deposit',
ADMIN_DEPOSIT: 'finance.tx.admin_deposit',
AGENT_DEPOSIT: 'finance.tx.agent_deposit',
INITIAL_DEPOSIT: 'finance.tx.admin_deposit',
MANUAL_WITHDRAW: 'finance.tx.withdraw',
ADMIN_WITHDRAW: 'finance.tx.admin_withdraw',
AGENT_WITHDRAW: 'finance.tx.agent_withdraw',
MANUAL_ADJUST: 'finance.tx.adjust',
BET_FREEZE: 'finance.tx.bet_freeze',
BET_DEDUCT: 'finance.tx.bet_deduct',
BET_SETTLE_WIN: 'finance.tx.bet_win',
BET_SETTLE_LOSE: 'finance.tx.bet_lose',
BET_SETTLE_PUSH: 'finance.tx.bet_push',
BET_WIN: 'finance.tx.bet_win',
BET_REFUND: 'finance.tx.bet_refund',
BET_VOID: 'finance.tx.bet_void',
BET_VOID_REFUND: 'finance.tx.bet_void',
CASHBACK: 'finance.tx.cashback',
CASHBACK_DEPOSIT: 'finance.tx.cashback',
RESETTLE_REVERSE: 'finance.tx.resettle',
DEPOSIT: 'finance.tx.deposit',
WITHDRAW: 'finance.tx.withdraw',
PLAYER_DEPOSIT: 'finance.tx.player_deposit',
};
export function walletTxTypeKey(type: string): string {
return TX_KEY_MAP[type.toUpperCase()] ?? '';
}
export const DEPOSIT_RECHARGE_TYPES = new Set([
'MANUAL_DEPOSIT',
'ADMIN_DEPOSIT',
'AGENT_DEPOSIT',
'INITIAL_DEPOSIT',
'DEPOSIT',
'PLAYER_DEPOSIT',
]);
export const DEPOSIT_METHOD_KEY_MAP: Record<string, string> = {
MANUAL_ADMIN: 'finance.deposit_method.manual_admin',
MANUAL_AGENT: 'finance.deposit_method.manual_agent',
MANUAL: 'finance.deposit_method.manual',
};
export function walletDepositMethodLabel(
row: {
transactionType: string;
depositMethodKey?: string | null;
depositMethodName?: string | null;
},
t: (key: string) => string,
): string {
if (!DEPOSIT_RECHARGE_TYPES.has(row.transactionType.toUpperCase())) return '—';
if (row.depositMethodName?.trim()) return row.depositMethodName.trim();
if (row.depositMethodKey) {
const key = DEPOSIT_METHOD_KEY_MAP[row.depositMethodKey];
return key ? t(key) : row.depositMethodKey;
}
const type = row.transactionType.toUpperCase();
if (type === 'ADMIN_DEPOSIT') return t('finance.tx.admin_deposit');
if (type === 'AGENT_DEPOSIT') return t('finance.tx.agent_deposit');
if (type === 'INITIAL_DEPOSIT') return t('finance.tx.admin_deposit');
if (type === 'PLAYER_DEPOSIT') return t('finance.tx.player_deposit');
return '—';
}