From a3f5bc4281ac2ad531761ae79726d8595218da2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E5=A4=A7=E5=8F=94?= <494979559@qq.com> Date: Mon, 7 Oct 2024 18:02:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BD=E5=87=BA=E8=AE=BE=E5=A4=87=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=B8=BA=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/agentRouter.js | 216 ++++++++++++++++++ src/store/getters.js | 1 + src/store/modules/permission.js | 9 +- src/store/modules/user.js | 5 + .../system/device/components/DeviceTable.vue | 133 +++++++++++ src/views/system/device/index.vue | 169 +++----------- 6 files changed, 396 insertions(+), 137 deletions(-) create mode 100644 src/router/agentRouter.js create mode 100644 src/views/system/device/components/DeviceTable.vue diff --git a/src/router/agentRouter.js b/src/router/agentRouter.js new file mode 100644 index 0000000..e1bb87c --- /dev/null +++ b/src/router/agentRouter.js @@ -0,0 +1,216 @@ +import { mchRoutes } from '@/router/mchRouter' +import Layout from '@/layout/index.vue' + +export const agentRoutes = [ + { + path: '/business', + component: Layout, + hidden: false, + alwaysShow: true, + meta: { + title: '经营管理', + icon: 'store' + }, + children: [ + { + path: 'store', + component: () => import('../views/mch/store'), + hidden: false, + name: "MyStore", + meta: { + noCache: false, + title: '我的店铺', + icon: 'store' + } + }, + { + path: 'store/:storeId', + component: () => import('../views/mch/store/detail.vue'), + hidden: true, + name: "MyStoreDetail", + meta: { + noCache: false, + title: '店铺详情', + } + }, + { + path: 'suit', + component: () => import('@/views/mch/suit/index.vue'), + hidden: false, + name: "MchSuit", + meta: { + noCache: false, + title: '套餐管理', + icon: 'suit', + } + }, + ] + }, + { + path: '/device', + component: Layout, + hidden: false, + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'monitor', + }, + children: [ + { + path: 'my', + component: () => import('@/views/mch/device'), + hidden: false, + name: "MyDevice", + meta: { + noCache: false, + title: '我的设备', + icon: 'monitor', + } + }, + { + path: 'agent', + component: () => import('@/views/mch/device'), + hidden: false, + name: "AgentDevice", + meta: { + noCache: false, + title: '代理设备', + icon: 'monitor', + } + }, + { + path: ':deviceId', + component: () => import('@/views/mch/device/detail.vue'), + hidden: true, + name: "MyDeviceDetail", + meta: { + noCache: false, + title: '设备详情', + } + }, + ] + }, + { + path: '/bill', + component: Layout, + hidden: false, + alwaysShow: true, + meta: { + title: '订单管理', + icon: 'shopping' + }, + children: [ + { + path: 'recharge', + component: () => import('../views/mch/recharge'), + hidden: false, + name: "MchRecharge", + meta: { + noCache: false, + title: '订单列表', + icon: 'shopping' + } + }, + // { + // path: 'refund', + // component: () => import('@/views/mch/refund'), + // hidden: false, + // name: "MchRefund", + // meta: { + // noCache: false, + // title: '订单退款', + // icon: 'refund' + // } + // }, + { + path: 'recharge/:billId', + component: () => import('@/views/mch/recharge/detail.vue'), + hidden: true, + name: "MchRechargeDetail", + meta: { + noCache: false, + title: '订单详情', + } + }, + ] + }, + { + path: '/money', + component: Layout, + hidden: false, + alwaysShow: true, + meta: { + title: '财务管理', + icon: 'money' + }, + children: [ + { + path: 'withdraw', + component: () => import('@/views/mch/withdraw/index.vue'), + hidden: false, + name: "MchWithdraw", + meta: { + noCache: false, + title: '提现记录', + icon: 'withdraw' + } + }, + { + path: 'recordBalance', + component: () => import('@/views/mch/recordBalance/index.vue'), + hidden: false, + name: "MchRecordBalance", + meta: { + noCache: false, + title: '余额明细', + icon: 'money', + } + }, + { + path: 'receiveBill', + component: () => import('@/views/mch/receiveBill/index.vue'), + hidden: false, + name: "MchReceiveBill", + meta: { + noCache: false, + title: '应付账单', + icon: 'withdraw' + } + }, + ] + }, + { + path: '/dev', + component: Layout, + hidden: false, + alwaysShow: true, + meta: { + title: '开发管理', + icon: 'code' + }, + children: [ + { + path: 'access', + hidden: false, + component: () => import('@/views/mch/access/index.vue'), + name: "MchAccess", + meta: { + noCache: false, + title: '秘钥管理', + icon: 'key', + }, + }, + { + path: 'doc', + component: () => import('@/views/mch/devDoc/index.vue'), + hidden: false, + name: 'DevDoc', + meta: { + noCache: false, + title: '开发文档', + icon: 'documentation' + }, + } + ] + }, +] diff --git a/src/store/getters.js b/src/store/getters.js index d1ce040..d4dd569 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -9,6 +9,7 @@ const getters = { avatar: state => state.user.avatar, name: state => state.user.name, userType: state => state.user.userType, + smUserType: state => state.user.smUserType, userId: state => state.user.id, title: state => state.user.title, introduction: state => state.user.introduction, diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 4e511f8..84521af 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -6,7 +6,8 @@ import ParentView from '@/components/ParentView' import InnerLink from '@/layout/components/InnerLink' import { mchRoutes } from '@/router/mchRouter' import store from '@/store' -import { UserType } from '@/utils/constants' +import { SmUserType, UserType } from '@/utils/constants' +import { agentRoutes } from '@/router/agentRouter' const permission = { state: { @@ -37,7 +38,11 @@ const permission = { return new Promise(resolve => { // 商户 if (store.getters.userType === UserType.APP) { - handleRoutes(mchRoutes, mchRoutes, resolve, commit); + if (store.getters.smUserType === SmUserType.AGENT) { + handleRoutes(agentRoutes, agentRoutes, resolve, commit); + } else { + handleRoutes(mchRoutes, mchRoutes, resolve, commit); + } } // 管理员 else { diff --git a/src/store/modules/user.js b/src/store/modules/user.js index eea799f..2baa996 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -11,6 +11,7 @@ const user = { roles: [], permissions: [], userType: getUserType(), + smUserType: null, title: process.env.VUE_APP_TITLE }, @@ -38,6 +39,9 @@ const user = { }, SET_TITLE: (state, title) => { state.title = title; + }, + SET_SM_USER_TYPE: (state, smUserType) => { + state.smUserType = smUserType; } }, @@ -95,6 +99,7 @@ const user = { commit('SET_USER_TYPE', userType) if (userType === UserType.APP) { commit('SET_TITLE', "创特物联-商户中心") + commit('SET_SM_USER_TYPE', user.type) } resolve(res) }).catch(error => { diff --git a/src/views/system/device/components/DeviceTable.vue b/src/views/system/device/components/DeviceTable.vue new file mode 100644 index 0000000..c56a2d9 --- /dev/null +++ b/src/views/system/device/components/DeviceTable.vue @@ -0,0 +1,133 @@ + + diff --git a/src/views/system/device/index.vue b/src/views/system/device/index.vue index a3eddf9..ed9868d 100644 --- a/src/views/system/device/index.vue +++ b/src/views/system/device/index.vue @@ -126,137 +126,41 @@ v-hasPermi="['system:device:export']" >导出 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + { - return getWxIndexUrl({ s: device.deviceNo}); - } - }, }, created() { this.queryParams = {