diff --git a/f/web-kboss/src/api/HistoricalOrders.js b/f/web-kboss/src/api/HistoricalOrders.js new file mode 100644 index 0000000..bc44cca --- /dev/null +++ b/f/web-kboss/src/api/HistoricalOrders.js @@ -0,0 +1,20 @@ +import request from '@/utils/request' +export function getListAPI(id) { + return request({ + url: `/product/get_zhipu_0112_product.dspy`, + method: 'get', + params: { + userid: id + } + }) +} +// 详情 +export function getDetailAPI(keyword) { + return request({ + url: `/product/get_zhipu_0112_product_detail.dspy`, + method: 'get', + params: { + keyword + } + }) +} diff --git a/f/web-kboss/src/router/index.js b/f/web-kboss/src/router/index.js index aa1d3e5..032ce69 100644 --- a/f/web-kboss/src/router/index.js +++ b/f/web-kboss/src/router/index.js @@ -467,10 +467,20 @@ export const asyncRoutes = [ meta: { title: "百度订单", fullPath: "/customer/orderManagement", noCache: true, }, }, { - path: "orderManagement", + path: "HistoricalOrders", component: () => import("@/views/customer/orderManagement/HistoricalOrders/index.vue"), - name: "OrderManagement", - meta: { title: "阿里云订单", fullPath: "/customer/orderManagement", noCache: true, }, + name: "HistoricalOrders", + meta: { title: "历史订单", fullPath: "/customer/orderManagement", noCache: true, requireUser: 'ZhipuHZ' }, + requireUser: 'ZhipuHZ' + }, + // 订单详情 + { + path: "orderDetails", + component: () => import("@/views/customer/orderManagement/orderDetails/index.vue"), + name: "orderDetails", + meta: { title: "订单详情", fullPath: "/customer/orderManagement", noCache: true, requireUser: 'ZhipuHZ' }, + hidden: true, + requireUser: 'ZhipuHZ' } ] @@ -901,10 +911,6 @@ export const asyncRoutes = [ }, - { - - }, - // 退订管理 - 变为一级菜单(包含子菜单) { path: "/unsubscribeManagement", diff --git a/f/web-kboss/src/store/modules/permission.js b/f/web-kboss/src/store/modules/permission.js index 7f338ab..d302399 100644 --- a/f/web-kboss/src/store/modules/permission.js +++ b/f/web-kboss/src/store/modules/permission.js @@ -1,3 +1,4 @@ +// permission.js - 修改后的完整代码 import { asyncRoutes, constantRoutes } from "@/router"; // 获取用户代理字符串 @@ -235,6 +236,10 @@ const actions = { const userRoles = rootState.user.roles || JSON.parse(sessionStorage.getItem('roles') || '[]'); console.log("用户角色:", userRoles); + // 获取用户名 + const username = params.user || rootState.user.user || ''; + console.log("当前用户名:", username, "检查是否是ZhipuHZ:", username === 'ZhipuHZ'); + console.log("用户类型:", userType, "orgType:", orgType); // 确定设备类型 @@ -296,7 +301,55 @@ const actions = { console.log("添加用户特定路由后的accessedRoutes:", accessedRoutes); } - console.log("ACTION generateRoutes - calculated accessedRoutes:", accessedRoutes); + // ========== 暴力过滤:直接修改 accessedRoutes ========== + // 遍历所有路由,找到 /orderManagement 路由,然后过滤它的子路由 + accessedRoutes = accessedRoutes.map(route => { + if (route.path === "/orderManagement") { + console.log("找到订单管理路由,准备过滤子路由,用户名:", username); + + // 创建路由副本 + const newRoute = { ...route }; + + if (newRoute.children) { + // 如果不是 ZhipuHZ 用户,过滤掉 HistoricalOrders 和 orderDetails 路由 + if (username !== 'ZhipuHZ') { + console.log(`用户 ${username} 不是 ZhipuHZ,过滤订单管理子路由`); + newRoute.children = newRoute.children.filter(child => + child.path !== 'HistoricalOrders' && child.path !== 'orderDetails' + ); + console.log(`过滤后子路由:`, newRoute.children.map(c => c.path)); + } else { + console.log(`用户 ${username} 是 ZhipuHZ,保留所有子路由`); + } + } + + return newRoute; + } + + // 对于其他路由,保持原样 + return route; + }); + + // 再次检查,确保没有遗漏的任何 orderManagement 路由 + accessedRoutes.forEach(route => { + if (route.children) { + route.children = route.children.filter(child => { + // 如果子路由是 orderManagement,也需要处理 + if (child.path === "/orderManagement") { + console.log("在子路由中找到订单管理路由,准备过滤,用户名:", username); + + if (child.children && username !== 'ZhipuHZ') { + child.children = child.children.filter(grandChild => + grandChild.path !== 'HistoricalOrders' && grandChild.path !== 'orderDetails' + ); + } + } + return true; + }); + } + }); + + console.log("ACTION generateRoutes - 最终 calculated accessedRoutes:", accessedRoutes); commit("SET_ROUTES", accessedRoutes); resolve(accessedRoutes); diff --git a/f/web-kboss/src/views/customer/orderManagement/HistoricalOrders/index.vue b/f/web-kboss/src/views/customer/orderManagement/HistoricalOrders/index.vue index 9755d40..3286312 100644 --- a/f/web-kboss/src/views/customer/orderManagement/HistoricalOrders/index.vue +++ b/f/web-kboss/src/views/customer/orderManagement/HistoricalOrders/index.vue @@ -1,15 +1,116 @@ diff --git a/f/web-kboss/src/views/customer/orderManagement/orderDetails/index.vue b/f/web-kboss/src/views/customer/orderManagement/orderDetails/index.vue new file mode 100644 index 0000000..580c029 --- /dev/null +++ b/f/web-kboss/src/views/customer/orderManagement/orderDetails/index.vue @@ -0,0 +1,331 @@ + + + + +