diff --git a/src/components/layout/Sidebar.vue b/src/components/layout/Sidebar.vue index ca427d4..7f31b5c 100644 --- a/src/components/layout/Sidebar.vue +++ b/src/components/layout/Sidebar.vue @@ -109,7 +109,7 @@ const staticMenuList = ref( { id: 32, label: '代理管理', - path: '3-2', // index="3-2" + path: '/account/agent', // index="3-2" icon: '' }, { diff --git a/src/router/index.ts b/src/router/index.ts index 596cac7..6924704 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -103,6 +103,14 @@ const routes = [ title: '客户管理', // 左侧菜单显示的标题 } }, + { + path: 'agent', + name: 'Agent', + component: () => import('@/views/account/agent/index.vue'), + meta: { + title: '代理管理', // 左侧菜单显示的标题 + } + } ] }, ] diff --git a/src/views/account/agent/index.vue b/src/views/account/agent/index.vue index 2a3908d..89fa338 100644 --- a/src/views/account/agent/index.vue +++ b/src/views/account/agent/index.vue @@ -1,5 +1,67 @@ \ No newline at end of file + + + + diff --git a/src/views/account/agent/options.ts b/src/views/account/agent/options.ts new file mode 100644 index 0000000..881afec --- /dev/null +++ b/src/views/account/agent/options.ts @@ -0,0 +1,48 @@ +// 获取当前年份 +const currentYear = new Date().getFullYear() + +// 定义禁用日期函数:只能选择今年及以后的日期 +const disabledDate = (time: Date) => { + // 时间早于今年1月1日则禁用 + return time.getTime() < new Date(currentYear, 0, 1).getTime() +} +//定义客户搜索表单配置 +export const agentSearch = [ + { prop: 'username', label: '用户名', type: 'input' as const, placeholder: '用户名', width: '120px' }, + { + prop: "startDateTime", label: '注册开始时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器 + valueFormat: 'YYYY-MM-DD', + width: '180px', + disabledDate + }, + { + prop: "endDateTime", label: '注册结束时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器 + valueFormat: 'YYYY-MM-DD', + width: '180px', + disabledDate + }, +] + +// 定义表格列配置 +export const agentTableColumns = [ + { prop: 'id', label: 'ID', align: 'center' as const }, + { prop: 'username', label: '代理名称', align: 'center' as const }, + { prop: 'registerTime', label: '注册时间', align: 'center' as const }, + { prop: 'status', label: '状态', align: 'center' as const }, + { prop: 'pointDifference', label: '点差', align: 'center' as const }, + { prop: 'feeRate', label: '手续费', align: 'center' as const }, + { prop: 'rebateRate', label: '手续费返佣', align: 'center' as const }, + { prop: 'pointDifference2', label: '点差', align: 'center' as const }, + { prop: 'rebateTotalAmount', label: '返佣总金额', align: 'center' as const }, + { prop: 'clientCount', label: '客户数量', align: 'center' as const }, + { prop: 'level', label: '级别', align: 'center' as const }, + +] + +// 定义点差表格列配置 +export const agentPointTableColumns = [ + { prop: 'varietyName', label: '品种名称', align: 'center' as const }, + { prop: 'varietyCode', label: '品种编号', align: 'center' as const }, + { prop: 'pointDifference', label: '可用点差', align: 'center' as const }, + { prop: 'assignedPointDifference', label: '已分配点差', align: 'center' as const }, +] diff --git a/src/views/account/client/index.vue b/src/views/account/client/index.vue index 229d6b5..3b95222 100644 --- a/src/views/account/client/index.vue +++ b/src/views/account/client/index.vue @@ -204,16 +204,25 @@ const handleDialogType = (type: string) => { //统一获取表单选项 const getOptions = async () => { - //获取代理列表 - const agentOptions = await getAgentOptionsApi() - //获取手续费模板列表 - const feeTemplateOptions = await getFeeTemplateOptionsApi() - //获取风控模板列表 - const riskTemplateOptions = await getRiskTemplateOptionsApi() + try { + // 并行请求,提升性能 + const [agentRes, feeTemplateRes, riskTemplateRes] = await Promise.all([ + getAgentOptionsApi(), + getFeeTemplateOptionsApi(), + getRiskTemplateOptionsApi() + ]); - clientFormOptionsMap.value.feeTemplate = mapObjectToOptions(feeTemplateOptions as Record) - clientFormOptionsMap.value.riskTemplate = mapObjectToOptions(riskTemplateOptions as Record) - clientFormOptionsMap.value.agentUsername = mapObjectToOptions(agentOptions as Record) + const agentOptions = mapObjectToOptions(agentRes as Record); + const feeTemplateOptions = mapObjectToOptions(feeTemplateRes as Record); + const riskTemplateOptions = mapObjectToOptions(riskTemplateRes as Record); + + // 更新表单选项 + clientFormOptionsMap.value.agentUsername = agentOptions; + clientFormOptionsMap.value.feeTemplate = feeTemplateOptions; + clientFormOptionsMap.value.riskTemplate = riskTemplateOptions; + } catch (error) { + console.error('获取表单选项失败:', error); + } } /** @@ -305,10 +314,7 @@ const handleSubmit = async () => { } } -// 弹窗取消 -const handleCancel = () => { - dialogVisible.value = false - dialogType.value = 'add' +const resetForm = () => { clientForm.value = { //手续费模板 feeTemplate: '', @@ -319,25 +325,28 @@ const handleCancel = () => { email: '', phone: '', countryCode: '+86', + //是否升级 + isUpgrade: 1, + //是否变更客户名 + userName: '', + status: 1, + id: '', } } +// 弹窗取消 +const handleCancel = () => { + dialogVisible.value = false + dialogType.value = 'add' + resetForm() +} + // 弹窗关闭 const handleClose = () => { dialogVisible.value = false dialogType.value = 'add' - clientForm.value = { - //手续费模板 - feeTemplate: '', - //风控模板 - riskTemplate: '', - //所属上级 - agentUsername: '', - email: '', - phone: '', - countryCode: '+86', - } + resetForm() } diff --git a/src/views/account/client/types.ts b/src/views/account/client/types.ts deleted file mode 100644 index 31521ff..0000000 --- a/src/views/account/client/types.ts +++ /dev/null @@ -1,47 +0,0 @@ -// 建议单独创建 types.ts 文件管理所有类型 -// types.ts -export interface ClientSearchForm { - page: number; - pageSize: number; - username: string; - status: '正常' | '禁用'; - startDateTime: string; - endDateTime: string; -} - -export interface ClientItem { - id: string | number; - username: string; - status: 1 | 2; - email?: string; - phone?: string; - countryCode?: string; - feeTemplate?: string | number; - riskTemplate?: string | number; - agentUsername?: string; - isUpgrade?: 1 | 2; - par_uid?: string | number; - parent?: { - id: string | number; - username: string; - }; -} - -export interface ClientForm { - id: string; - feeTemplate: string | number; - riskTemplate: string | number; - agentUsername: string | number; - email: string; - phone: string; - countryCode: string; - isUpgrade: 1 | 2; - userName: string; - status: 1 | 2; -} - -export interface ClientListResponse { - data: ClientItem[]; - total: number; - per_page: number | string; -} \ No newline at end of file diff --git a/src/views/account/client/备份.vue b/src/views/account/client/备份.vue deleted file mode 100644 index 3ce2a94..0000000 --- a/src/views/account/client/备份.vue +++ /dev/null @@ -1,130 +0,0 @@ - - -