diff --git a/src/api/agentCardKeys.js b/src/api/agentCardKeys.js index b3c8c15..ce23db4 100644 --- a/src/api/agentCardKeys.js +++ b/src/api/agentCardKeys.js @@ -21,13 +21,11 @@ function agentRequest(token, path, options = {}) { * pageSize?: number, * status?: string, * username?: string, - * oemId?: number | null, - * agentId?: number | null, * }} [params] */ export function listAgentCardKeysApi( token, - { page = 1, pageSize = 20, status = "all", username, oemId, agentId } = {}, + { page = 1, pageSize = 20, status = "all", username } = {}, ) { const query = new URLSearchParams({ page: String(page), @@ -36,26 +34,13 @@ export function listAgentCardKeysApi( }); const trimmed = username?.trim(); if (trimmed) query.set("username", trimmed); - if (oemId != null) query.set("oem_id", String(oemId)); - if (agentId != null) query.set("agent_id", String(agentId)); return agentRequest(token, `/agent/card-keys?${query}`); } -/** - * @param {string} token - * @param {object} payload - */ -export function createAgentCardKeysApi(token, payload) { - return agentRequest(token, "/agent/card-keys", { - method: "POST", - body: JSON.stringify(payload), - }); -} - /** * @param {string} token * @param {number} cardId - * @param {object} payload + * @param {{ agent_remark?: string | null }} payload */ export function updateAgentCardKeyApi(token, cardId, payload) { return agentRequest(token, `/agent/card-keys/${cardId}`, { @@ -63,10 +48,3 @@ export function updateAgentCardKeyApi(token, cardId, payload) { body: JSON.stringify(payload), }); } - -/** @param {string} token @param {number} cardId */ -export function deleteAgentCardKeyApi(token, cardId) { - return agentRequest(token, `/agent/card-keys/${cardId}`, { - method: "DELETE", - }); -} diff --git a/src/api/agentUsers.js b/src/api/agentUsers.js index cca1f9d..b9c318f 100644 --- a/src/api/agentUsers.js +++ b/src/api/agentUsers.js @@ -20,14 +20,12 @@ function agentRequest(token, path, options = {}) { * page?: number, * pageSize?: number, * username?: string, - * oemId?: number | null, - * agentId?: number | null, * roleId?: number | null, * }} [params] */ export function listAgentUsersApi( token, - { page = 1, pageSize = 20, username, oemId, agentId, roleId } = {}, + { page = 1, pageSize = 20, username, roleId } = {}, ) { const query = new URLSearchParams({ page: String(page), @@ -35,38 +33,6 @@ export function listAgentUsersApi( }); const trimmed = username?.trim(); if (trimmed) query.set("username", trimmed); - if (oemId != null) query.set("oem_id", String(oemId)); - if (agentId != null) query.set("agent_id", String(agentId)); if (roleId != null) query.set("role_id", String(roleId)); return agentRequest(token, `/agent/users?${query}`); } - -/** - * @param {string} token - * @param {object} payload - */ -export function createAgentUserApi(token, payload) { - return agentRequest(token, "/agent/users", { - method: "POST", - body: JSON.stringify(payload), - }); -} - -/** - * @param {string} token - * @param {number} userId - * @param {object} payload - */ -export function updateAgentUserApi(token, userId, payload) { - return agentRequest(token, `/agent/users/${userId}`, { - method: "PATCH", - body: JSON.stringify(payload), - }); -} - -/** @param {string} token @param {number} userId */ -export function deleteAgentUserApi(token, userId) { - return agentRequest(token, `/agent/users/${userId}`, { - method: "DELETE", - }); -} diff --git a/src/api/oemCardKeys.js b/src/api/oemCardKeys.js index 9a4a930..9861295 100644 --- a/src/api/oemCardKeys.js +++ b/src/api/oemCardKeys.js @@ -21,13 +21,12 @@ function oemRequest(token, path, options = {}) { * pageSize?: number, * status?: string, * username?: string, - * oemId?: number | null, * agentId?: number | null, * }} [params] */ -export function listAdminCardKeysApi( +export function listOemCardKeysApi( token, - { page = 1, pageSize = 20, status = "all", username, oemId, agentId } = {}, + { page = 1, pageSize = 20, status = "all", username, agentId } = {}, ) { const query = new URLSearchParams({ page: String(page), @@ -36,37 +35,29 @@ export function listAdminCardKeysApi( }); const trimmed = username?.trim(); if (trimmed) query.set("username", trimmed); - if (oemId != null) query.set("oem_id", String(oemId)); if (agentId != null) query.set("agent_id", String(agentId)); return oemRequest(token, `/oem/card-keys?${query}`); } -/** - * @param {string} token - * @param {object} payload - */ -export function createAdminCardKeysApi(token, payload) { - return oemRequest(token, "/oem/card-keys", { - method: "POST", - body: JSON.stringify(payload), - }); -} - /** * @param {string} token * @param {number} cardId - * @param {object} payload + * @param {{ oem_remark?: string | null }} payload */ -export function updateAdminCardKeyApi(token, cardId, payload) { +export function updateOemCardKeyApi(token, cardId, payload) { return oemRequest(token, `/oem/card-keys/${cardId}`, { method: "PATCH", body: JSON.stringify(payload), }); } -/** @param {string} token @param {number} cardId */ -export function deleteAdminCardKeyApi(token, cardId) { - return oemRequest(token, `/oem/card-keys/${cardId}`, { - method: "DELETE", +/** + * @param {string} token + * @param {{ card_ids: number[], agent_id: number }} payload + */ +export function assignOemCardKeysToAgentApi(token, payload) { + return oemRequest(token, "/oem/card-keys/assign-agent", { + method: "POST", + body: JSON.stringify(payload), }); } diff --git a/src/views/agent/AgentCardKeysView.vue b/src/views/agent/AgentCardKeysView.vue index c6b3ac1..dfce988 100644 --- a/src/views/agent/AgentCardKeysView.vue +++ b/src/views/agent/AgentCardKeysView.vue @@ -1,13 +1,7 @@ - - 卡密管理 - - + 卡密管理 { class="admin-users__search" @keyup.enter="applyFilters" /> - - 状态 { - - - {{ ownerLabel(data.oem_id) }} - - - - - {{ ownerLabel(data.agent_id) }} - - {{ formatDateTime(data.created_at) }} @@ -382,97 +210,46 @@ onMounted(async () => { {{ data.username || "—" }} - + - {{ data.remark || "—" }} + {{ data.agent_remark || "—" }} + + + + + - 暂无卡密 - - - 时长(天) - - - - 生成数量 - - - - 自定义序列号(可选,仅 1 张) - - - - 预分配 - - - - - {{ form.assign_type === "oem" ? "选择 OEM" : "选择代理" }} - - - - - - - 序列号 - - - - 时长(天) - - - - - 备注 - + 序列号 + + + + 代理备注 + - - - + + diff --git a/src/views/agent/AgentUsersView.vue b/src/views/agent/AgentUsersView.vue index 46fbe00..eb7cc18 100644 --- a/src/views/agent/AgentUsersView.vue +++ b/src/views/agent/AgentUsersView.vue @@ -1,22 +1,10 @@ - - 用户管理 - - - - - - - - - - + 用户管理 { {{ feedback.message }} + + + + + + { - - - {{ ownerLabel(data.oem_id) }} - - - - - {{ ownerLabel(data.agent_id) }} - - {{ formatDateTime(data.vip_end_time) }} @@ -362,94 +150,9 @@ onMounted(async () => { {{ formatDateTime(data.created_at) }} - - - - - - - - 暂无用户 - - - - - 用户名 - - - - - - {{ dialogMode === "create" ? "密码" : "新密码(留空不修改)" }} - - - - - - 手机号(可选) - - - - - 角色 - - - - - VIP 到期时间 - - - - 清除 VIP 到期时间 - - - - - - - - - diff --git a/src/views/oem/OemCardKeysView.vue b/src/views/oem/OemCardKeysView.vue index 04a31fe..38dbf21 100644 --- a/src/views/oem/OemCardKeysView.vue +++ b/src/views/oem/OemCardKeysView.vue @@ -1,11 +1,10 @@
暂无卡密
暂无用户