feat(admin): 管理端列表分页、控制台图表与赛事导入
- 玩家/代理/赛事/注单/审计列表分页,默认每页 10 条,无页面滚动条布局 - ECharts 控制台概览、注单管理中文化与列宽优化 - zhibo 赛事字段迁移与导入,玩家编辑可改所属代理 - 管理端 API 分页与 dashboard 统计接口 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
96
apps/admin/src/views/agent-form.ts
Normal file
96
apps/admin/src/views/agent-form.ts
Normal file
@@ -0,0 +1,96 @@
|
||||
export interface AgentCreateForm {
|
||||
username: string;
|
||||
password: string;
|
||||
confirmPassword: string;
|
||||
creditLimit: number;
|
||||
cashbackRate: number;
|
||||
phone: string;
|
||||
email: string;
|
||||
}
|
||||
|
||||
export interface AgentEditForm {
|
||||
status: string;
|
||||
phone: string;
|
||||
email: string;
|
||||
cashbackRate: number;
|
||||
}
|
||||
|
||||
export interface AgentRow {
|
||||
userId: string;
|
||||
username: string;
|
||||
userStatus: string;
|
||||
level: number;
|
||||
status: string;
|
||||
creditLimit: string;
|
||||
usedCredit: string;
|
||||
availableCredit: string;
|
||||
directPlayerCount: number;
|
||||
cashbackRate: string;
|
||||
phone: string | null;
|
||||
email: string | null;
|
||||
locale: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface AgentDetail extends AgentRow {
|
||||
parentAgentId: string | null;
|
||||
parentUsername: string | null;
|
||||
directPlayerLiability: string;
|
||||
childAgentExposure: string;
|
||||
lastLoginAt: string | null;
|
||||
updatedAt: string;
|
||||
recentCreditTransactions: {
|
||||
id: string;
|
||||
transactionType: string;
|
||||
amount: string;
|
||||
creditBefore: string;
|
||||
creditAfter: string;
|
||||
remark: string | null;
|
||||
createdAt: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export function emptyAgentCreateForm(): AgentCreateForm {
|
||||
return {
|
||||
username: '',
|
||||
password: 'Agent@123',
|
||||
confirmPassword: 'Agent@123',
|
||||
creditLimit: 50000,
|
||||
cashbackRate: 0,
|
||||
phone: '',
|
||||
email: '',
|
||||
};
|
||||
}
|
||||
|
||||
export function emptyAgentEditForm(): AgentEditForm {
|
||||
return {
|
||||
status: 'ACTIVE',
|
||||
phone: '',
|
||||
email: '',
|
||||
cashbackRate: 0,
|
||||
};
|
||||
}
|
||||
|
||||
export function editFormFromAgentDetail(d: AgentDetail): AgentEditForm {
|
||||
return {
|
||||
status: d.status,
|
||||
phone: d.phone ?? '',
|
||||
email: d.email ?? '',
|
||||
cashbackRate: Number(d.cashbackRate),
|
||||
};
|
||||
}
|
||||
|
||||
export function buildCreateAgentPayload(form: AgentCreateForm) {
|
||||
if (!form.username.trim()) throw new Error('请填写用户名');
|
||||
if (form.password.length < 8) throw new Error('密码至少 8 位');
|
||||
if (form.password !== form.confirmPassword) throw new Error('两次密码不一致');
|
||||
if (form.creditLimit < 0) throw new Error('授信额度不能为负');
|
||||
return {
|
||||
username: form.username.trim(),
|
||||
password: form.password,
|
||||
creditLimit: form.creditLimit,
|
||||
cashbackRate: form.cashbackRate,
|
||||
phone: form.phone.trim() || undefined,
|
||||
email: form.email.trim() || undefined,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user