diff --git a/src/router/index.js b/src/router/index.js index 9f80aa1..63f6ee5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -25,19 +25,20 @@ const routes = [ path: 'workbench', name: "workbench", component: () => import("../views/workspace/index.vue"), - meta: { permissionId: 10 } // 对应"工作台展示"id=10 + meta: { permissionId: 13 } // }, - + //金币管理 { path: '/goldManage', name: 'goldManage', + meta:{permissionId:3}, children: [ // 审核 { path: '/audit', name: "audit", component: () => import("../views/audit/gold/audit.vue"), - meta: { permissionId: 40 }, + meta: { permissionId: 14 }, // redirect: '/index', children: [ // 充值审核 @@ -45,21 +46,30 @@ const routes = [ path: 'rechargeAudit', name: "rechargeAudit", component: () => import("../views/audit/gold/rechargeAudit.vue"), - meta: { permissionId: [11, 12] } // 对应"查看充值审核"id=11、"充值审批"id=12 + meta: { permissionId: [28,30,31,32,33,34,35] } // 对应"查看充值审核"id=11、"充值审批"id=12 }, // 退款审核 { path: 'refundAudit', name: "refundAudit", component: () => import("../views/audit/gold/refundAudit.vue"), - meta: { permissionId: [13, 14] } // 对应"查看退款审核"id=13、"退款审批"id=14 + meta: { permissionId: [29,36,37,38,39,40,41] } // 对应"查看退款审核"id=13、"退款审批"id=14 }, ] }, { - path: 'beanAudit', + path: '/beanAudit', name: "beanAudit", component: () => import("../views/audit/bean/beanAudit.vue"), - meta: { permissionId: [54, 55] } + meta: { permissionId: 15 }, + children: [ + // 充值审核 + { + path: 'addbeanAudit', + name: "addbeanAudit", + component: () => import("../views/audit/bean/beanAudit.vue"), + meta: { permissionId: [42,43,44,45,46,47] } // 对应"查看充值审核"id=11、"充值审批"id=12 + }, + ] }, @@ -69,21 +79,21 @@ const routes = [ name: "coinConsume", component: () => import("../views/consume/gold/coinConsume.vue"), // redirect: '/coinConsume/add', - meta: { permissionId: 6 }, + meta: { permissionId: 19 }, children: [ // 金币新增消耗 { path: 'add', name: "addCoinConsume", component: () => import("../views/consume/gold/addCoinConsume.vue"), - meta: { permissionId: 19 } // 对应"提交金币消耗"id=19 + meta: { permissionId: 55 } // 对应"提交金币消耗"id=19 }, // 金币消耗明细详情 { path: 'detail', name: "coinConsumeDetail", component: () => import("../views/consume/gold/coinConsumeDetail.vue"), - meta: { permissionId: 20 } // 对应"查看金币消耗明细"id=20 + meta: { permissionId: 56 } // 对应"查看金币消耗明细"id=20 } ] }, @@ -92,35 +102,35 @@ const routes = [ path: '/beanConsume', name: "beanConsume", component: () => import("../views/consume/bean/beanConsume.vue"), - meta: { permissionId: 42 }, + meta: { permissionId: 20 }, children: [ // 金豆新增消耗 { path: 'add', name: "addBeanConsume", component: () => import("../views/consume/bean/addBeanConsume.vue"), - meta: { permissionId: 49 } // 对应"提交金豆消耗"id=49 + meta: { permissionId: 57 } // 对应"提交金豆消耗"id=49 }, // 直播 { path: 'live', name: "liveStream", component: () => import("../views/consume/bean/liveStream.vue"), - meta: { permissionId: 50 } // 对应"直播"id=50 + meta: { permissionId: 58 } // 对应"直播"id=50 }, // 铁粉 { path: 'fan', name: "dieHardFan", component: () => import("../views/consume/bean/dieHardFan.vue"), - meta: { permissionId: 51 } // 对应"铁粉"id=51 + meta: { permissionId: 59 } // 对应"铁粉"id=51 }, // 文章视频 { path: 'article', name: "articleVideo", component: () => import("../views/consume/bean/articleVideo.vue"), - meta: { permissionId: 52 } // 对应"文章视频"id=52 + meta: { permissionId: 60 } // 对应"文章视频"id=52 } ] @@ -131,13 +141,14 @@ const routes = [ path: '/rate', name: "rate", component: () => import("../views/managerecharge/rate.vue"), - meta: { permissionId: [15, 16] } // 对应"汇率查看"id=15、"汇率修改"id=16 + meta: { permissionId: [16,48,49] } // 对应"汇率查看"id=15、"汇率修改"id=16 }, // 金币充值 { path: '/coinRecharge', name: "coinRecharge", component: () => import("../views/recharge/gold/coinRecharge.vue"), + meta: { permissionId: 17 }, // redirect: '/coinRecharge/add', children: [ // 金币新增充值 @@ -145,14 +156,14 @@ const routes = [ path: 'add', name: "addCoinRecharge", component: () => import("../views/recharge/gold/addCoinRecharge.vue"), - meta: { permissionId: 17 } // 对应"提交金币充值"id=17 + meta: { permissionId: 50 } // 对应"提交金币充值"id=17 }, // 金币充值明细详情 { path: 'detail', name: "coinRechargeDetail", component: () => import("../views/recharge/gold/coinRechargeDetail.vue"), - meta: { permissionId: 18 } // 对应"查看金币充值明细"id=18 + meta: { permissionId: 51 } // 对应"查看金币充值明细"id=18 } ] }, @@ -163,58 +174,52 @@ const routes = [ name: "beanRecharge", component: () => import("../views/recharge/bean/beanRecharge.vue"), // redirect: '/coinRecharge/add', + meta: { permissionId: 18 }, children: [ // 金豆新增充值 { path: 'add', name: "addBeanRecharge", component: () => import("../views/recharge/bean/addBeanRecharge.vue"), - meta: { permissionId: 46 } // 对应"提交金豆充值"id=46 + meta: { permissionId: 52 } // 对应"提交金豆充值"id=46 }, // 金豆系统充值 { path: 'system', name: "beanSystemRecharge", component: () => import("../views/recharge/bean/beanSystemRecharge.vue"), - meta: { permissionId: 47 } // 对应"查看金豆系统充值明细"id=47 + meta: { permissionId: 53 } // 对应"查看金豆系统充值明细"id=47 }, // 金豆线上充值 { path: 'online', name: "beanOnlineRecharge", component: () => import("../views/recharge/bean/beanOnlineRecharge.vue"), - meta: { permissionId: 48 } // 对应"查看金豆线上充值明细"id=48 + meta: { permissionId: 54 } // 对应"查看金豆线上充值明细"id=48 } ] }, - // 金币退款 + // 金币退款 { path: '/coinRefund', name: "coinRefund", component: () => import("../views/refund/gold/coinRefund.vue"), - // redirect: '/coinRefund/add', - meta: { permissionId: 7 }, + meta: { permissionId: 9 }, children: [ // 金币新增退款 { path: 'add', name: "addCoinRefund", component: () => import("../views/refund/gold/addCoinRefund.vue"), - meta: { permissionId: 21 } // 对应"提交金币退款"id=21 + meta: { permissionId: 61 } }, // 金币退款明细详情 { path: 'detail', name: "coinRefundDetail", component: () => import("../views/refund/gold/coinRefundDetail.vue"), - meta: { permissionId: 22 } // 对应"查看金币退款明细"id=22 - }, - { - path: 'addRefund', - name: "addNewCoinRefund", - component: () => import("../views/refund/gold/addNewCoinRefund.vue"), - meta: { permissionId: 58 } + meta: { permissionId: 62 } } ] }, @@ -224,27 +229,26 @@ const routes = [ path: '/usergold', name: "usergold", component: () => import("../views/usergold/gold/clientCount.vue"), - // redirect: '/usergold/detail', - meta: { permissionId: 8 }, + meta: { permissionId: 10 }, children: [ // 金币明细 { path: 'detail', name: "clientCountDetail", component: () => import("../views/usergold/gold/clientCountDetail.vue"), - meta: { permissionId: 23 } // 对应"查看金币明细"id=23 + meta: { permissionId: 63 } }, // 金币余额 { path: 'balance', name: "clientCountBalance", component: () => import("../views/usergold/gold/clientCountBalance.vue"), - meta: { permissionId: 24 } // 对应"查看金币余额"id=24 + meta: { permissionId: 64 } }, ] }, { - path: 'userbean', + path: '/userbean', name: "userbean", component: () => import("../views/usergold/bean/userbean.vue"), meta: { permissionId: 45 } @@ -253,7 +257,21 @@ const routes = [ path: '/history', name: "history", component: () => import("../views/history/history.vue"), - meta: { permissionId: [56, 57] } + meta: { permissionId: 12 }, + children: [ + { + path: 'newHistory', + name: "newHistory", + component: () => import("../views/history/newHistory.vue"), + meta: { permissionId: 26 } + }, + { + path: 'oldHistory', + name: "oldHistory", + component: () => import("../views/history/oldHistory.vue"), + meta: { permissionId: 27 } + } + ] }, // 权限管理 @@ -261,24 +279,24 @@ const routes = [ path: '/permissions', name: "permissions", component: () => import("../views/permissions/permissions.vue"), - meta: { permissionId: 9 }, + meta: { permissionId: 11 }, children: [ // 用户权限 { path: 'userPermission', name: "userPermission", component: () => import("../views/permissions/userPermission.vue"), - meta: { permissionId: 25 } + meta: { permissionId: 24 } }, // 角色权限 { path: 'rolePermission', name: "rolePermission", component: () => import("../views/permissions/rolePermission.vue"), - meta: { permissionId: 30 } - }, + meta: { permissionId: 25 } + } ] - }, + } ] }, { diff --git a/src/utils/menuTreePermission.js b/src/utils/menuTreePermission.js index 5cf92e6..da6a2ba 100644 --- a/src/utils/menuTreePermission.js +++ b/src/utils/menuTreePermission.js @@ -4,7 +4,7 @@ export const permissionMapping = { system:1, // 总系统 workbench: 2, // 工作台 goldManage:3, // 金币管理 - monerManage:4, // 现金管理 + moneyManage:4, // 现金管理 // 模块,2级 financialAudit:5, // 财务审核 @@ -49,8 +49,8 @@ export const permissionMapping = { refundWaitThough:40, // 退款审核通过 refundWaitReject:41, // 退款审核驳回 - beanWait:42, // 金豆审核待审核 - beanWaitThough:43, // 金豆审核已通过 + beanWait:42, // 金豆审核待审核 + beanThough:43, // 金豆审核已通过 beanReject:44, // 金豆审核已驳回 beanWaitShow:45, // 金豆审核待审核查看 beanWaitThough:46, // 金豆审核通过 @@ -83,8 +83,9 @@ export const permissionMapping = { editUserInfo:67, // 编辑用户信息 updateUserInfo:68, // 重置密码 deleteUserInfo:69, // 删除用户信息 + changeStatus:70, // 启用禁用用户 - roleManageShow:70, // 查看角色信息 + roleManageShow:73, // 查看角色信息 addRoleInfo:71, // 新增角色信息 editRoleInfo:72, // 编辑角色信息 } diff --git a/src/utils/menuUtils.js b/src/utils/menuUtils.js index ac7a2b3..6e903b7 100644 --- a/src/utils/menuUtils.js +++ b/src/utils/menuUtils.js @@ -42,10 +42,7 @@ export function findFirstThirdLevelMenu(menuList) { export const getRoutePath = (menu) => { // 路由映射表:key为接口menuName,value为对应路由路径 const routeMap = { - - '工作台展示': '/workbench', - '金币管理': '/goldManage', - '现金管理': '/moneyManage', + '工作台展示': '/workspace', '金币审核': '/audit', '金豆审核': '/beanAudit', @@ -64,9 +61,13 @@ export const getRoutePath = (menu) => { // '金豆退款': '/beanRefund', '历史数据查询': '/history', + '金币查询(新)': '/history/newHistory', + '金币查询(旧)': '/history/oldHistory', '权限管理': '/permissions', + '用户管理': '/permissions/userPermission', + '角色管理': '/permissions/rolePermission', '金币客户账户明细': '/usergold', diff --git a/src/views/history/history.vue b/src/views/history/history.vue index cf69498..291f562 100644 --- a/src/views/history/history.vue +++ b/src/views/history/history.vue @@ -1,179 +1,71 @@ - - - - - - 姓名: - - - 精网号: - - - 更新时间: - - - 重置 - 查询 - 查询 - - - - - - - {{ scope.$index + 1 + (pagination.pageNum - 1) * pagination.pageSize }} - - - - - - - - - - - - - - - - - - - \ No newline at end of file + }); + + \ No newline at end of file diff --git a/src/views/history/newHistory.vue b/src/views/history/newHistory.vue new file mode 100644 index 0000000..ab8c583 --- /dev/null +++ b/src/views/history/newHistory.vue @@ -0,0 +1,119 @@ + + + 姓名: + + + 精网号: + + + 更新时间: + + + 重置 + 查询 + + + + + + + {{ scope.$index + 1 + (pagination.pageNum - 1) * pagination.pageSize }} + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/views/history/oldHistory.vue b/src/views/history/oldHistory.vue new file mode 100644 index 0000000..a4aed9e --- /dev/null +++ b/src/views/history/oldHistory.vue @@ -0,0 +1,117 @@ + + + 姓名: + + + 精网号: + + + 更新时间: + + + 重置 + 查询 + + + + + + + {{ scope.$index + 1 + (pagination.pageNum - 1) * pagination.pageSize }} + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/views/permissions/permissions.vue b/src/views/permissions/permissions.vue index c01f241..779e5c8 100644 --- a/src/views/permissions/permissions.vue +++ b/src/views/permissions/permissions.vue @@ -1,19 +1,5 @@ - - - - 用户管理 - - - 角色管理 - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/src/views/permissions/rolePermission.vue b/src/views/permissions/rolePermission.vue index 7b8d80d..b7d25bc 100644 --- a/src/views/permissions/rolePermission.vue +++ b/src/views/permissions/rolePermission.vue @@ -39,18 +39,12 @@ const addRole = ref({ market: '' }) const addRoleMarket = ref([]) -const viewRole = ref([]) -const getRolePermission = async function () { - const result = await request({ - url: '/menu/tree', - data: { - "id": adminData.value.roleId - } - }) - viewRole.value = collectIds(result.data) - console.log('result111', viewRole.value); -} + const getRoleList = async function (val) { + if(!findMenuById(menuTree.value, permissionMapping.roleManageShow)){ + ElMessage.error('无此权限') + return + } try { if (typeof val === 'number') { getObj.value.pageNum = val @@ -178,6 +172,10 @@ function processTreeData(data) { } const handleAddRole = async function () { + if(!findMenuById(menuTree.value, permissionMapping.addRoleInfo)){ + ElMessage.error('无此权限') + return + } try { await new Promise((resolve, reject) => { Ref.value.validate((valid) => { @@ -467,6 +465,10 @@ const permissionEditRoleInit = async function (row) { // 编辑角色提交 const permissionEditRole = async function () { + if(!findMenuById(menuTree.value, permissionMapping.editRoleInfo)){ + ElMessage.error('无此权限') + return + } try { await new Promise((resolve, reject) => { Ref.value.validate((valid) => { @@ -573,7 +575,6 @@ const throttledHandleAddRole = _.throttle(handleAddRole, 5000, { // 挂载 onMounted(async function () { await getRoleList() - await getRolePermission() await getRoleArea() }) diff --git a/src/views/permissions/userPermission.vue b/src/views/permissions/userPermission.vue index 68a9368..8a0caa7 100644 --- a/src/views/permissions/userPermission.vue +++ b/src/views/permissions/userPermission.vue @@ -5,6 +5,12 @@ import { InfoFilled } from '@element-plus/icons-vue' import _ from 'lodash' import request from '@/util/http' import API from '@/util/http' +import { useAdminStore } from "@/store/index.js" +import { storeToRefs } from "pinia" +import { findMenuById, permissionMapping } from "@/utils/menuTreePermission.js" +const adminStore = useAdminStore() +const { adminData, menuTree } = storeToRefs(adminStore) + // 表格数据 const tableData = ref([]) const total = ref(100) @@ -97,20 +103,6 @@ const addAdmin = ref({ machineId: '', remark: '' }) - -//这是获取用户信息的接口 -const adminData = ref({}) -// todo 之后优化掉 -const getAdminData = async function () { - try { - const result = await API({ url: '/admin/userinfo', data: {} }) - adminData.value = result - // console.log('请求成功', result) - console.log('管理员用户信息', adminData.value) - } catch (error) { - console.log('请求失败', error) - } -} // 编辑用户权限对象 const permissionEditObj = ref({ checkedKeys: [], @@ -204,7 +196,6 @@ const getRoleArea = async function () { console.log('请求失败', error) } } - // 获取地区树 const marketsTree = ref([]) const getArea = async function () { @@ -275,6 +266,10 @@ const userAddInit = function () { //新增用户 const permissionAdd = async function () { + if (!findMenuById(menuTree.value, permissionMapping.addUserInfo)) { + ElMessage.error('无此权限') + return + } try { await new Promise((resolve, reject) => { Ref.value.validate((valid) => { @@ -327,7 +322,6 @@ const Ref = ref(null) // 权限类别 const permissionList = ref([]) - const getRoles = async function () { try { const res = await API({ url: '/role/selectAll' }) @@ -341,8 +335,6 @@ const getRoles = async function () { console.error('获取权限列表失败:', error) } } - - // 打开编辑用户权限弹窗 const openUserEditVisible = function () { userEditVisible.value = true @@ -504,6 +496,10 @@ const editAdminRules = { }; // 编辑用户权限提交 const permissionEdit = async function () { + if (!findMenuById(menuTree.value, permissionMapping.editUserInfo)) { + ElMessage.error('无此权限') + return + } let { adminName: userName, roleName: oldRole, roleId: newRoleId } = permissionEditObj.value; if (oldRole == null) { oldRole = '暂未分配角色' @@ -576,6 +572,10 @@ const del = function (row) { } // 删除权限 const delConfirm = async function () { + if (!findMenuById(menuTree.value, permissionMapping.deleteUserInfo)) { + ElMessage.error('无此权限') + return + } try { const result = await request({ url: '/permission/deleteAdmin', @@ -594,6 +594,10 @@ const delConfirm = async function () { } // 禁用启用用户权限 const editStatus = async function (row) { + if (!findMenuById(menuTree.value, permissionMapping.changeStatus)) { + ElMessage.error('无此权限') + return + } const { id, account, targetStatus, ...restRow } = currentStatusRow.value try { @@ -783,6 +787,10 @@ const resetPassword = function (row) { // 确认重置密码 const confirmResetPassword = async function () { + if (!findMenuById(menuTree.value, permissionMapping.updateUserInfo)) { + ElMessage.error('无此权限') + return + } console.log('adminData', adminData.value) // 处理markets数据 if (typeof adminData.value.markets === 'string' && adminData.value.markets) { @@ -883,16 +891,20 @@ const throttledPermissionEdit = _.throttle(permissionEdit, 5000, { const throttledPermissionAdd = _.throttle(permissionAdd, 5000, { trailing: false }) - +const canAdd = findMenuById(menuTree.value, permissionMapping.addUserInfo) +const canEdit = findMenuById(menuTree.value, permissionMapping.editUserInfo) +const canReset = findMenuById(menuTree.value, permissionMapping.updateUserInfo) +const canDel = findMenuById(menuTree.value, permissionMapping.deleteUserInfo) +const change = findMenuById(menuTree.value, permissionMapping.changeStatus) // 挂载 onMounted(async function () { - await getAdminData() await getPermission() await getArea() await getStore() await getRoles() await getRoleArea() -}) + console.log('看看权限', canAdd, canEdit, canReset, canDel, change) + }) @@ -925,7 +937,7 @@ onMounted(async function () { - 新增用户 + 新增用户 @@ -947,17 +959,17 @@ onMounted(async function () { - + 重置密码 + :disabled="!canEdit || scope.row.adminStatus === 0 || scope.row.account === adminData.account"> 修改权限 + :disabled="!canDel ||scope.row.adminStatus === 0 || scope.row.account === adminData.account"> 删除 @@ -973,7 +985,7 @@ onMounted(async function () { showStatusConfirm(scope.row, targetStatus)" style=" --el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949; diff --git a/src/views/refund/gold/addCoinRefund.vue b/src/views/refund/gold/addCoinRefund.vue index 4b11d95..6b7ed1b 100644 --- a/src/views/refund/gold/addCoinRefund.vue +++ b/src/views/refund/gold/addCoinRefund.vue @@ -111,6 +111,11 @@ const getRefund = async function () { } // 这是添加退款信息的接口 const add = async function () { + // 检查是否有添加权限 + if (!findMenuById(menuTree.value, permissionMapping.addCoinRefund)) { + ElMessage.error('无此权限') + return + } try { if (addRefund.value.refundType === '商品退款') { addRefund.value.type = 1 diff --git a/src/views/refund/gold/addNewCoinRefund.vue b/src/views/refund/gold/addNewCoinRefund.vue deleted file mode 100644 index 25908ac..0000000 --- a/src/views/refund/gold/addNewCoinRefund.vue +++ /dev/null @@ -1,726 +0,0 @@ - - - - - - - - - 查询 - - - - - - - - - - - 个 - - - - - 个 - - - - - 个 - - - - - - - - - - - 重置 - 提交 - - - - - - - - 客户信息 - - - - - - {{ user.name }} - - - - - {{ - user.nowSumGold - }} - - - - (永久金币:{{ - user.nowPermanentGold - }}; - 免费金币:{{ user.nowFreeGold }}; - 任务金币:{{ user.nowTaskGold }}) - - - - - - - - - {{ user.jwcode }} - - - - - {{ user.consumeNum }} - - - (仅统计2025-01-01后的数据) - - - - - - - - - - - - {{ user.market }} - - - - - - - - - - - - - 用户信息 - - - - - 商品名称 - - - - - 金币总数 - - - - - - - 永久金币 - - - - - - 免费金币 - - - - - - 任务金币 - - - - - - - - 备注 - - - - - - - - - - - - - - - - - 用户信息 - - - - - 商品名称 - - - - - 金币总数 - - - - - - - 永久金币 - - - - - - 免费金币 - - - - - - 任务金币 - - - - - - - - - - - 重复购买风险提示 - - - - - 检测到该用户近期有相似退款记录: - · {{ ReadCookiesTime }} 退款 【{{ addConsume.goodsName }}】(操作人: {{ adminData.adminName }}) - - - 是否继续操作? - - - - - - - - - - - - - - - - diff --git a/src/views/refund/gold/coinRefund.vue b/src/views/refund/gold/coinRefund.vue index 5823b87..f268889 100644 --- a/src/views/refund/gold/coinRefund.vue +++ b/src/views/refund/gold/coinRefund.vue @@ -45,8 +45,8 @@ const navigateTo = (name) => { const initPermissions = () => { if (!menuTree.value || !menuTree.value.length) return; - hasAdd.value = hasMenuPermission(menuTree.value, permissionMapping.Submit_Gold_Coin_Refund); - hasDetail.value = hasMenuPermission(menuTree.value, permissionMapping.View_Gold_Coin_Refund_Details); + hasAdd.value = hasMenuPermission(menuTree.value, permissionMapping.addCoinRefund); + hasDetail.value = hasMenuPermission(menuTree.value, permissionMapping.coinRefundDetail); }; // 默认跳转逻辑 @@ -54,7 +54,7 @@ const getDefaultAuditRoute = () => { initPermissions(); if (hasDetail.value) return 'coinRefundDetail'; if (hasAdd.value) return 'addCoinRefund'; - return 'addCoinRefund'; + return 'coinRefundDetail'; }; // 监听路由变化更新标签状态 @@ -77,7 +77,7 @@ onMounted(() => { navigateTo(defaultRoute); } else { // 非父路由初始化当前标签状态 - if (route.name === 'addCoinRefund' || route.name === 'coinRefundDetail') { + if (route.name === 'coinRefundDetail' || route.name === 'addCoinRefund') { activeTab.value = route.name; } } diff --git a/src/views/refund/gold/coinRefundDetail.vue b/src/views/refund/gold/coinRefundDetail.vue index 1dd91da..83d0f20 100644 --- a/src/views/refund/gold/coinRefundDetail.vue +++ b/src/views/refund/gold/coinRefundDetail.vue @@ -6,8 +6,13 @@ import moment from 'moment' import API from '@/util/http.js' import request from '@/util/http.js' import { reverseMarketMapping } from "@/utils/marketMap.js"; +import { useAdminStore } from "@/store/index.js"; +import { storeToRefs } from "pinia"; +import { findMenuById, permissionMapping } from "@/utils/menuTreePermission.js" import dayjs from "dayjs"; +const adminStore = useAdminStore(); +const { adminData, menuTree } = storeToRefs(adminStore); const showEmployeeData = ref(false) @@ -48,18 +53,6 @@ const activeTimeRange = ref('') const handleDatePickerChange = () => { activeTimeRange.value = '' } -const adminData = ref({}) -const getAdminData = async function () { - try { - const result = await API({ url: '/admin/userinfo', data: {} }) - - adminData.value = result - console.log('请求成功', result) - console.log('用户信息', adminData.value) - } catch (error) { - console.log('请求失败', error) - } -} // 充值明细表格 const tableData = ref([]) // 搜索====================================== @@ -121,6 +114,10 @@ const getRefundTypes = async function () { // 搜索============================================================== // 搜索方法 const getSelectBy = async function (val) { + if (!findMenuById(menuTree.value, permissionMapping.coinRefundDetail)) { + ElMessage.error('无此权限') + return + } try { // 搜索参数页码赋值 if (typeof val === 'number') { @@ -312,7 +309,7 @@ const getGoods = async function () { // 挂载 onMounted(async function () { - await getAdminData() + console.log('=======',adminData.value) await getSelectBy() await getMarket() await getRefundTypes() diff --git a/src/views/usergold/bean/userbean.vue b/src/views/usergold/bean/userbean.vue index 55c4289..50ef4f0 100644 --- a/src/views/usergold/bean/userbean.vue +++ b/src/views/usergold/bean/userbean.vue @@ -74,7 +74,6 @@ const pagination = ref({ total: 0 }) const get = async function () { - if(findMenuById(menuTree.value, permissionMapping.View_Golden_Bean_Balance)){ try { trim() if(searchObj.value.jwcode){ @@ -105,12 +104,9 @@ const get = async function () { } catch (error) { console.log(error) } -}else{ - ElMessage.error('无此权限') -} } + const getStats = async () => { - if (findMenuById(menuTree.value, permissionMapping.View_Golden_Bean_Balance)) { try { const params = { beanUser:{ @@ -131,10 +127,7 @@ const getStats = async () => { } catch (error) { console.log('请求失败', error) } - }else{ - ElMessage.error('无此权限') } -} const handleSortChange = (column) => { if (column.prop === 'beanNum') { searchObj.value.sortField = 'jinbi' diff --git a/src/views/usergold/gold/clientCount.vue b/src/views/usergold/gold/clientCount.vue index 848cc6b..91e03f4 100644 --- a/src/views/usergold/gold/clientCount.vue +++ b/src/views/usergold/gold/clientCount.vue @@ -51,8 +51,8 @@ const navigateTo = (name) => { const initPermissions = () => { if (!menuTree.value || !menuTree.value.length) return; - hasDetail.value = hasMenuPermission(menuTree.value, permissionMapping.View_Gold_Coin_Details); - hasBalance.value = hasMenuPermission(menuTree.value, permissionMapping.View_Gold_Coin_Balance); + hasDetail.value = hasMenuPermission(menuTree.value, permissionMapping.coinCustomerDetail); + hasBalance.value = hasMenuPermission(menuTree.value, permissionMapping.coinCustomerMoney); }; // 默认跳转逻辑 diff --git a/src/views/usergold/gold/clientCountBalance.vue b/src/views/usergold/gold/clientCountBalance.vue index a96c6be..491941e 100644 --- a/src/views/usergold/gold/clientCountBalance.vue +++ b/src/views/usergold/gold/clientCountBalance.vue @@ -1,5 +1,10 @@
个
{{ user.name }}
{{ user.jwcode }}
{{ user.consumeNum }}
(仅统计2025-01-01后的数据)
{{ user.market }}
重复购买风险提示
检测到该用户近期有相似退款记录:
是否继续操作?