diff --git a/frontend/src/pages/admin/agent-apps/[id]/card-types.vue b/frontend/src/pages/admin/agent-apps/[id]/card-types.vue deleted file mode 100644 index 36713e2..0000000 --- a/frontend/src/pages/admin/agent-apps/[id]/card-types.vue +++ /dev/null @@ -1,236 +0,0 @@ - - - diff --git a/frontend/src/pages/admin/agent-apps/[id]/edit.vue b/frontend/src/pages/admin/agent-apps/[id]/edit.vue index a7c74f2..b55c438 100644 --- a/frontend/src/pages/admin/agent-apps/[id]/edit.vue +++ b/frontend/src/pages/admin/agent-apps/[id]/edit.vue @@ -1,13 +1,13 @@ + + diff --git a/frontend/src/pages/admin/agent-apps/index.vue b/frontend/src/pages/admin/agent-apps/index.vue index 69d893d..86ccedf 100644 --- a/frontend/src/pages/admin/agent-apps/index.vue +++ b/frontend/src/pages/admin/agent-apps/index.vue @@ -17,17 +17,6 @@ const agentApps = ref([]) const showRemoveDialog = ref(false) const removingItem = ref(null) -const viewDialogOpen = ref(false) -const viewItem = ref(null) - -const editDialogOpen = ref(false) -const editItem = ref(null) -const editSaving = ref(false) -const editForm = ref({ - status: 'active', - card_types: [] as Array<{ card_type_id: number, can_generate: boolean, price: number, name: string }>, -}) - const activeCount = computed(() => agentApps.value.filter(app => app.status === 'active').length) const inactiveCount = computed(() => agentApps.value.filter(app => app.status === 'inactive').length) const totalBalance = computed(() => agentApps.value.reduce((sum, app) => sum + (app.balance || 0), 0)) @@ -71,52 +60,11 @@ function goToCreate() { } function handleView(item: AgentApp) { - viewItem.value = item - viewDialogOpen.value = true + router.push(`/admin/agent-apps/${item.id}/view`) } function handleEdit(item: AgentApp) { - editItem.value = item - editForm.value = { - status: item.status || 'active', - card_types: (item.card_types || []).map(ct => ({ - card_type_id: ct.card_type_id || ct.id, - can_generate: ct.can_generate, - price: ct.price || 0, - name: ct.name || '', - })), - } - editDialogOpen.value = true -} - -async function handleEditSubmit() { - if (!editItem.value) return - - editSaving.value = true - try { - await api.put(`/dev/agent-apps/${editItem.value.id}`, { - status: editForm.value.status, - }) - - await api.put(`/dev/agent-apps/${editItem.value.id}/card-types`, { - card_types: editForm.value.card_types.map(ct => ({ - card_type_id: ct.card_type_id, - can_generate: ct.can_generate, - price: ct.price, - })), - }) - - toast.success('保存成功') - editDialogOpen.value = false - fetchData() - } - catch (error: any) { - console.error('保存失败:', error) - toast.error(error.message || '保存失败') - } - finally { - editSaving.value = false - } + router.push(`/admin/agent-apps/${item.id}/edit`) } function confirmRemove(item: AgentApp) { @@ -346,157 +294,5 @@ onMounted(() => { confirm-text="确定移除" @confirm="handleRemove" /> - - - - - 查看授权 - - {{ viewItem?.agent_name }} - {{ viewItem?.app_name }} - - -
-
-
- 代理 -

{{ viewItem?.agent_name }}

-
-
- 应用 -

{{ viewItem?.app_name }}

-
-
- 状态 - - {{ viewItem?.status === 'active' ? '已启用' : '已禁用' }} - -
-
- 余额 -

¥{{ (viewItem?.balance || 0).toFixed(2) }}

-
-
- 授权时间 -

{{ viewItem?.created_at }}

-
-
- -
- 卡密权限 -
- - - - 卡类名称 - 授权价格 - 状态 - - - - - {{ ct.name }} - ¥{{ ct.price || 0 }} - - - {{ ct.can_generate ? '已授权' : '未授权' }} - - - - - -
-

暂无卡密权限

-
-
- - - 关闭 - - -
-
- - - - - 编辑授权 - - {{ editItem?.agent_name }} - {{ editItem?.app_name }} - - -
-
- 状态 - - - - - - - 已启用 - - - 已禁用 - - - -
- -
- 卡密权限 -
- - - - - 卡类名称 - 授权价格 - - - - - - - - - {{ ct.name }} - - - - - - - - - - - - - -
-

暂无卡密权限

-
-
- - - 取消 - - - - 保存 - - -
-