From 2065b062e37d8af44788b7c1b3d36a9ead1592e7 Mon Sep 17 00:00:00 2001 From: zyh Date: Thu, 28 Aug 2025 12:23:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B7=AF=E7=94=B1=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E6=A0=B9=E6=8D=AE=E7=94=A8=E6=88=B7=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=8A=A8=E6=80=81=E9=87=8D=E5=AE=9A=E5=90=91=E5=88=B0?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E7=9A=84=E9=BB=98=E8=AE=A4=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=BC=BA=E7=99=BB=E5=BD=95=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C=EF=BC=9B=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=80=80=E5=8D=95=E7=AE=A1=E7=90=86=E7=95=8C=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD=E5=92=8C?= =?UTF-8?q?=E5=93=8D=E5=BA=94=E5=BC=8F=E8=AE=BE=E8=AE=A1=EF=BC=8C=E6=8F=90?= =?UTF-8?q?=E5=8D=87=E7=A7=BB=E5=8A=A8=E7=AB=AF=E7=94=A8=E6=88=B7=E4=BD=93?= =?UTF-8?q?=E9=AA=8C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/退单功能使用说明.md | 1 + src/router/index.js | 27 +- src/views/Login.vue | 15 +- src/views/refund/RefundManagement.vue | 444 ++++++++++++++++---------- 4 files changed, 307 insertions(+), 180 deletions(-) diff --git a/docs/退单功能使用说明.md b/docs/退单功能使用说明.md index e4b7730..8bdfc3f 100644 --- a/docs/退单功能使用说明.md +++ b/docs/退单功能使用说明.md @@ -177,3 +177,4 @@ src/ --- *最后更新时间: 2024年1月* + diff --git a/src/router/index.js b/src/router/index.js index 025fdb3..aeed167 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -20,7 +20,20 @@ export const routes = [ path: '/', component: AdminLayout, children: [ - { path: '', redirect: '/users' }, + { + path: '', + redirect: (to) => { + // 根据用户类型重定向到不同的默认页面 + const { getCurrentUserType } = require('@/utils/permission') + const userType = getCurrentUserType() + + if (userType?.toLowerCase() === 'agent') { + return '/links' // 代理商跳转到链接管理 + } else { + return '/users' // 管理员跳转到用户管理 + } + } + }, { path: 'users', name: 'Users', component: UserList, meta: { title: '用户管理' } }, { path: 'settings', name: 'Settings', component: Settings, meta: { title: '系统设置' } }, { path: 'links', name: 'Links', component: LinkGenerate, meta: { title: '链接管理' } }, @@ -44,7 +57,17 @@ router.beforeEach((to, from, next) => { // 检查路由权限 if (to.name && !canAccessRoute(to.name)) { - return next({ name: 'Users' }) // 无权限时跳转到用户管理 + // 根据用户类型跳转到有权限的默认页面 + const { getCurrentUserType } = require('@/utils/permission') + const userType = getCurrentUserType() + + if (userType?.toLowerCase() === 'agent') { + // 代理商跳转到链接管理页面 + return next({ name: 'Links' }) + } else { + // 管理员或其他用户跳转到用户管理 + return next({ name: 'Users' }) + } } next() diff --git a/src/views/Login.vue b/src/views/Login.vue index f64d649..d401f67 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -127,8 +127,19 @@ async function onSubmit() { showSuccessMessage('登录成功') persistRemember() console.debug('login response:', res.data) - const redirect = route.query.redirect || '/' - router.replace(String(redirect)) + + // 如果有 redirect 参数,直接跳转 + if (route.query.redirect) { + router.replace(String(route.query.redirect)) + } else { + // 根据用户类型跳转到合适的默认页面 + const userType = data?.userType?.toLowerCase() + if (userType === 'agent') { + router.replace('/links') // 代理商跳转到链接管理 + } else { + router.replace('/users') // 管理员跳转到用户管理 + } + } } catch (e) { showErrorMessage(e, '登录失败') } finally { diff --git a/src/views/refund/RefundManagement.vue b/src/views/refund/RefundManagement.vue index 2277fab..2a4038f 100644 --- a/src/views/refund/RefundManagement.vue +++ b/src/views/refund/RefundManagement.vue @@ -5,47 +5,74 @@

管理用户的退单申请,支持按链接编号查询和执行退单操作

- +
- - - - - - - - - - - - - - - - - - - - - 查询 - - - - 重置 - - - + + + + +
+ + + + + + +
+
+ + + + + + + + + + + + + + + + +
+ + 查询 + + + 重置 + +
+
+
+
@@ -54,15 +81,30 @@ - + - {{ linkInfo.codeNo }} + + {{ linkInfo.codeNo }} + {{ getStatusText(linkInfo.status) }} @@ -70,10 +112,14 @@ {{ formatDateTime(linkInfo.createdAt) }} {{ formatDateTime(linkInfo.updatedAt) }} - {{ linkInfo.agentId || '-' }} - {{ linkInfo.machineId || '-' }} - {{ linkInfo.totalPoints || '-' }} - {{ linkInfo.currentPoints || '-' }} + + {{ linkInfo.agentId || '-' }} + + + {{ linkInfo.machineId || '-' }} + + {{ linkInfo.totalPoints ?? '-' }} + {{ linkInfo.currentPoints ?? '-' }} {{ formatDateTime(linkInfo.refundAt) }} @@ -87,24 +133,13 @@ @click="handleRefund" :loading="refunding" > - - 执行退单 + 执行退单 - - - 已退单 + + 已退单 - - - 当前状态不允许退单 + + 当前状态不允许退单 @@ -123,7 +158,7 @@ - +
    @@ -132,7 +167,7 @@
  • LOGGED_IN - 已登录状态,游戏进行中
- +
  • REFUNDED - 已退单,避免重复操作
  • @@ -140,7 +175,7 @@
  • COMPLETED - 已完成,游戏已结束
- +
  1. 系统验证用户权限和链接状态
  2. @@ -149,7 +184,7 @@
  3. 记录退单时间
- +
  • 退单操作不可逆,请谨慎操作
  • @@ -162,139 +197,189 @@ - +

    确认要对以下链接执行退单操作吗?

    - +

    退单操作不可逆,执行后链接将无法继续使用

    - +