更新代理选择
This commit is contained in:
@@ -176,7 +176,7 @@ const api = {
|
||||
getUserStats: () => request.get('/users/stats'),
|
||||
getUserGrowthTrend: (params) => request.get('/users/growth-trend', { params }),
|
||||
getDailyRevenue: (params) => request.get('/users/daily-revenue', { params }),
|
||||
getAgentOptions: (params) => request.get('/agent', { params })
|
||||
getAgentOptions: (params) => request.get('/admin/agents', { params })
|
||||
},
|
||||
|
||||
// 积分管理
|
||||
|
||||
@@ -307,16 +307,13 @@
|
||||
v-model="userForm.inviter"
|
||||
placeholder="请选择代理"
|
||||
style="width: 100%"
|
||||
filterable
|
||||
remote
|
||||
:remote-method="searchAgents"
|
||||
:loading="agentLoading"
|
||||
>
|
||||
<el-option
|
||||
v-for="agent in agentOptions"
|
||||
:key="agent.id"
|
||||
:label="`${agent.username} (${agent.real_name || '未设置姓名'})`"
|
||||
:value="agent.id"
|
||||
:label="`${agent.real_name} (${agent.agent_code})`"
|
||||
:value="agent.user_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -1159,8 +1156,15 @@ const getAccountTypeColor = (row) => {
|
||||
const fetchAgents = async () => {
|
||||
try {
|
||||
agentLoading.value = true
|
||||
const response = await api.users.getAgentOptions()
|
||||
agentOptions.value = response.data?.data || []
|
||||
const params = {
|
||||
page: 1,
|
||||
limit: 100,
|
||||
status: '',
|
||||
city: '',
|
||||
search: ''
|
||||
}
|
||||
const response = await api.users.getAgentOptions(params)
|
||||
agentOptions.value = response.data?.data?.agents || []
|
||||
} catch (error) {
|
||||
console.error('获取代理列表失败:', error)
|
||||
ElMessage.error('获取代理列表失败')
|
||||
@@ -1169,24 +1173,6 @@ const fetchAgents = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索代理
|
||||
const searchAgents = async (query) => {
|
||||
if (!query) {
|
||||
await fetchAgents()
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
agentLoading.value = true
|
||||
const response = await api.users.getAgentOptions({ search: query })
|
||||
agentOptions.value = response.data?.data || []
|
||||
} catch (error) {
|
||||
console.error('搜索代理失败:', error)
|
||||
} finally {
|
||||
agentLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 组件挂载时获取数据
|
||||
onMounted(() => {
|
||||
fetchUsers()
|
||||
|
||||
Reference in New Issue
Block a user