Browse Source

权限重做

zhangyong/milestone-20250913-现金管理二期
lihuilin 4 weeks ago
parent
commit
2ff9e5c9a1
  1. 99
      src/router/index.js
  2. 301
      src/utils/menuTreePermission.js
  3. 468
      src/views/managerecharge/rate.vue

99
src/router/index.js

@ -25,7 +25,7 @@ const routes = [
path: 'workbench',
name: "workbench",
component: () => import("../views/workspace/index.vue"),
meta: { permissionId: 13 } //
meta: { permissionId: 2 }
},
//金币管理
{
@ -38,36 +38,35 @@ const routes = [
path: '/audit',
name: "audit",
component: () => import("../views/audit/gold/audit.vue"),
meta: { permissionId: 14 },
// redirect: '/index',
meta: { permissionId: 4 },
children: [
// 充值审核
{
path: 'rechargeAudit',
name: "rechargeAudit",
component: () => import("../views/audit/gold/rechargeAudit.vue"),
meta: { permissionId: [28, 30, 31, 32, 33, 34, 35] } // 对应"查看充值审核"id=11、"充值审批"id=12
meta: { permissionId: [6,7,8,9,10,11,12] }
},
// 退款审核
{
path: 'refundAudit',
name: "refundAudit",
component: () => import("../views/audit/gold/refundAudit.vue"),
meta: { permissionId: [29, 36, 37, 38, 39, 40, 41] } // 对应"查看退款审核"id=13、"退款审批"id=14
meta: { permissionId: [13,14,15,16,17,18,19] }
},
]
}, {
path: '/beanAudit',
name: "beanAudit",
component: () => import("../views/audit/bean/beanAudit.vue"),
meta: { permissionId: 15 },
meta: { permissionId: 20 },
children: [
// 充值审核
{
path: 'addbeanAudit',
name: "addbeanAudit",
component: () => import("../views/audit/bean/beanAudit.vue"),
meta: { permissionId: [42, 43, 44, 45, 46, 47] } // 对应"查看充值审核"id=11、"充值审批"id=12
meta: { permissionId: [21,22,23,24,25,26] }
},
]
},
@ -78,22 +77,21 @@ const routes = [
path: '/coinConsume',
name: "coinConsume",
component: () => import("../views/consume/gold/coinConsume.vue"),
// redirect: '/coinConsume/add',
meta: { permissionId: 19 },
meta: { permissionId: 39 },
children: [
// 金币新增消耗
{
path: 'add',
name: "addCoinConsume",
component: () => import("../views/consume/gold/addCoinConsume.vue"),
meta: { permissionId: 55 } // 对应"提交金币消耗"id=19
meta: { permissionId: 41 }
},
// 金币消耗明细详情
{
path: 'detail',
name: "coinConsumeDetail",
component: () => import("../views/consume/gold/coinConsumeDetail.vue"),
meta: { permissionId: 56 } // 对应"查看金币消耗明细"id=20
meta: { permissionId: 40 }
}
]
},
@ -102,35 +100,35 @@ const routes = [
path: '/beanConsume',
name: "beanConsume",
component: () => import("../views/consume/bean/beanConsume.vue"),
meta: { permissionId: 20 },
meta: { permissionId: 42 },
children: [
// 金豆新增消耗
{
path: 'add',
name: "addBeanConsume",
component: () => import("../views/consume/bean/addBeanConsume.vue"),
meta: { permissionId: 57 } // 对应"提交金豆消耗"id=49
meta: { permissionId: 46 }
},
// 直播
{
path: 'live',
name: "liveStream",
component: () => import("../views/consume/bean/liveStream.vue"),
meta: { permissionId: 58 } // 对应"直播"id=50
meta: { permissionId: 43 }
},
// 铁粉
{
path: 'fan',
name: "dieHardFan",
component: () => import("../views/consume/bean/dieHardFan.vue"),
meta: { permissionId: 59 } // 对应"铁粉"id=51
meta: { permissionId: 44 }
},
// 文章视频
{
path: 'article',
name: "articleVideo",
component: () => import("../views/consume/bean/articleVideo.vue"),
meta: { permissionId: 60 } // 对应"文章视频"id=52
meta: { permissionId: 45 }
}
]
@ -141,29 +139,28 @@ const routes = [
path: '/rate',
name: "rate",
component: () => import("../views/managerecharge/rate.vue"),
meta: { permissionId: [16, 48, 49] } // 对应"汇率查看"id=15、"汇率修改"id=16
meta: { permissionId: [27,28,29] }
},
// 金币充值
{
path: '/coinRecharge',
name: "coinRecharge",
component: () => import("../views/recharge/gold/coinRecharge.vue"),
meta: { permissionId: 17 },
// redirect: '/coinRecharge/add',
meta: { permissionId: 31 },
children: [
// 金币新增充值
{
path: 'add',
name: "addCoinRecharge",
component: () => import("../views/recharge/gold/addCoinRecharge.vue"),
meta: { permissionId: 50 } // 对应"提交金币充值"id=17
meta: { permissionId: 33 }
},
// 金币充值明细详情
// 金币充值明细
{
path: 'detail',
name: "coinRechargeDetail",
component: () => import("../views/recharge/gold/coinRechargeDetail.vue"),
meta: { permissionId: 51 } // 对应"查看金币充值明细"id=18
meta: { permissionId: 32 }
}
]
},
@ -173,29 +170,28 @@ const routes = [
path: '/beanRecharge',
name: "beanRecharge",
component: () => import("../views/recharge/bean/beanRecharge.vue"),
// redirect: '/coinRecharge/add',
meta: { permissionId: 18 },
meta: { permissionId: 34 },
children: [
// 金豆新增充值
{
path: 'add',
name: "addBeanRecharge",
component: () => import("../views/recharge/bean/addBeanRecharge.vue"),
meta: { permissionId: 52 } // 对应"提交金豆充值"id=46
meta: { permissionId: 37 }
},
// 金豆系统充值
{
path: 'system',
name: "beanSystemRecharge",
component: () => import("../views/recharge/bean/beanSystemRecharge.vue"),
meta: { permissionId: 53 } // 对应"查看金豆系统充值明细"id=47
meta: { permissionId: 35 }
},
// 金豆线上充值
{
path: 'online',
name: "beanOnlineRecharge",
component: () => import("../views/recharge/bean/beanOnlineRecharge.vue"),
meta: { permissionId: 54 } // 对应"查看金豆线上充值明细"id=48
meta: { permissionId: 36 }
}
]
},
@ -205,45 +201,45 @@ const routes = [
path: '/coinRefund',
name: "coinRefund",
component: () => import("../views/refund/gold/coinRefund.vue"),
meta: { permissionId: 9 },
meta: { permissionId: 47 },
children: [
// 金币新增退款
{
path: 'add',
name: "addCoinRefund",
component: () => import("../views/refund/gold/addCoinRefund.vue"),
meta: { permissionId: 61 }
meta: { permissionId: 48 }
},
// 金币退款明细详情
{
path: 'detail',
name: "coinRefundDetail",
component: () => import("../views/refund/gold/coinRefundDetail.vue"),
meta: { permissionId: 62 }
meta: { permissionId:49 }
}
]
},
// 客户账户明细
// 金币客户账户明细
{
path: '/usergold',
name: "usergold",
component: () => import("../views/usergold/gold/clientCount.vue"),
meta: { permissionId: 10 },
meta: { permissionId: 51 },
children: [
// 金币明细
{
path: 'detail',
name: "clientCountDetail",
component: () => import("../views/usergold/gold/clientCountDetail.vue"),
meta: { permissionId: 63 }
meta: { permissionId: 52 }
},
// 金币余额
{
path: 'balance',
name: "clientCountBalance",
component: () => import("../views/usergold/gold/clientCountBalance.vue"),
meta: { permissionId: 64 }
meta: { permissionId: 53 }
},
]
},
@ -251,25 +247,25 @@ const routes = [
path: '/userbean',
name: "userbean",
component: () => import("../views/usergold/bean/userbean.vue"),
meta: { permissionId: 45 }
meta: { permissionId: 54 }
},
{
path: '/history',
name: "history",
component: () => import("../views/history/history.vue"),
meta: { permissionId: 12 },
meta: { permissionId: 55 },
children: [
{
path: 'newHistory',
name: "newHistory",
component: () => import("../views/history/newHistory.vue"),
meta: { permissionId: 26 }
meta: { permissionId: 56 }
},
{
path: 'oldHistory',
name: "oldHistory",
component: () => import("../views/history/oldHistory.vue"),
meta: { permissionId: 27 }
meta: { permissionId: 57 }
}
]
},
@ -279,21 +275,21 @@ const routes = [
path: '/permissions',
name: "permissions",
component: () => import("../views/permissions/permissions.vue"),
meta: { permissionId: 11 },
meta: { permissionId: 128 },
children: [
// 用户权限
{
path: 'userPermission',
name: "userPermission",
component: () => import("../views/permissions/userPermission.vue"),
meta: { permissionId: 24 }
meta: { permissionId: 129 }
},
// 角色权限
{
path: 'rolePermission',
name: "rolePermission",
component: () => import("../views/permissions/rolePermission.vue"),
meta: { permissionId: 25 }
meta: { permissionId: 130 }
}
]
}
@ -302,13 +298,12 @@ const routes = [
{
path: '/moneyManage',
name: 'moneyManage',
meta: { permissionId: 4 },
meta: { permissionId: 58 },
children: [
// 收款明细
{
path: 'receiveDetail',
name: "receiveDetail",
// component: () => import("../views/moneyManage/receiveDetail/receiveDetail.vue"),
meta: { permissionId: 74 },
children:[
// 客服页面
@ -316,21 +311,21 @@ const routes = [
path: 'receiveService',
name: "receiveService",
component: () => import("../views/moneyManage/receiveDetail/receiveDetail.vue"),
meta: { permissionId: 77 }
meta: { permissionId: 60 }
},
// 地区财务及地区负责人页面
{
path: 'receiveArea',
name: "receiveArea",
component: () => import("../views/moneyManage/receiveDetail/receiveDetail.vue"),
meta: { permissionId: 78 }
meta: { permissionId: [67,79] }
},
//总部管理员及财务
{
path: 'receiveHead',
name: "receiveHead",
component: () => import("../views/moneyManage/receiveDetail/receiveDetail.vue"),
meta: { permissionId: 79 }
meta: { permissionId: 91 }
},
]
},
@ -339,35 +334,35 @@ const routes = [
path: 'refundDetail',
name: "refundDetail",
component: () => import("../views/moneyManage/refundDetail/refundDetail.vue"),
meta: { permissionId: 75 },
meta: { permissionId: 98 },
children: [
// 客服页面
{
path: 'refundService',
name: "refundService",
component: () => import("../views/moneyManage/refundDetail/refundService.vue"),
meta: { permissionId: 80 }
meta: { permissionId: 99 }
},
// 地区财务页面
{
path: 'refundFinance',
name: "refundFinance",
component: () => import("../views/moneyManage/refundDetail/refundFinance.vue"),
meta: { permissionId: 81 }
meta: { permissionId: 103 }
},
// 地区负责人页面
{
path: 'refundCharge',
name: "refundCharge",
component: () => import("../views/moneyManage/refundDetail/refundCharge.vue"),
meta: { permissionId: 82 }
meta: { permissionId: 107 }
},
//总部管理员及财务
{
path: 'refundHeader',
name: "refundHeader",
component: () => import("../views/moneyManage/refundDetail/refundHeader.vue"),
meta: { permissionId: 83 }
meta: { permissionId: 111 }
},
]
},
@ -376,7 +371,7 @@ const routes = [
path: 'executor',
name: "executor",
component: () => import("../views/moneyManage/executor/executor.vue"),
meta: { permissionId: 76 }
meta: { permissionId: 115 }
},
]
},

301
src/utils/menuTreePermission.js

@ -1,141 +1,172 @@
// 菜单权限映射(按 menu_type 排序)
export const permissionMapping = {
// 大系统和分系统,0级1级
system:1, // 总系统
total_system: 1, // 总系统
workbench: 2, // 工作台
goldManage:3, // 金币管理
moneyManage:4, // 现金管理
// 模块,2级
financialAudit:5, // 财务审核
rateManage:6, // 汇率管理
rechargeManage:7, // 充值管理
consumeManage:8, // 消耗管理
refundManage:9, // 退款管理
accountDetail:10, // 客户账户明细
permissionManage:11, // 权限管理
historyData:12, // 历史数据查询
receiveDetail:74, // 收款明细
refundDetail:75, // 退款明细
executor:76, // 执行明细
// 页面,3级
workbenchShow:13, // 工作台查看
coinAudit:14, // 金币审核
beanAudit:15, // 金豆审核
moneyRate:16, // 现金汇率
coinRecharge:17, // 金币充值
beanRecharge:18, // 金豆充值
coinConsume:19, // 金币消耗
beanConsume:20, // 金豆消耗
coinRefund:21, // 金币退款
coinDetail:22, // 金币客户账户明细
beanDetail:23, // 金豆客户账户明细
userManage:24, // 用户管理
roleManage:25, // 角色管理
newCoinSelect:26, // 金币查询(新)
oldCoinSelect:27, // 金币查询(旧)
receiveService:77, // 收款-地区客服
receiveArea:78, // 收款-地区财务/负责人
receiveHeader:79, // 收款-总部财务/管理员
refundService:80, // 退款-地区客服
refundFinance:81, // 退款-地区财务
refundCharge:82, // 退款-地区负责人
refundHeader:83, // 退款-总部财务/管理员
// 功能,4级
rechargeAudit:28, // 充值审核
refundAudit:29, // 退款审核
rechargeThrough:30, // 充值审核已通过
rechargeReject:31, // 充值审核已驳回
rechargeWait:32, // 充值审核待审核
rechargeWaitShow:33, // 充值审核待审核查看
rechargeWaitThough:34, // 充值审核等待通过
rechargeWaitReject:35, // 充值审核等待驳回
refundThrough:36, // 退款审核已通过
refundReject:37, // 退款审核已驳回
refundWait:38, // 退款审核待审核
refundWaitShow:39, // 退款审核待审核查看
refundWaitThough:40, // 退款审核等待通过
refundWaitReject:41, // 退款审核等待驳回
beanWait:42, // 金豆审核待审核
beanThrough:43, // 金豆审核已通过
beanReject:44, // 金豆审核已驳回
beanWaitShow:45, // 金豆审核待审核查看
beanWaitThough:46, // 金豆审核通过
beanWaitReject:47, // 金豆审核驳回
rateShow:48, // 现金汇率查看
rateEdit:49, // 现金汇率编辑
addCoinRecharge:50, // 新增金币充值
coinRechargeDetail:51, // 金币充值明细
addBeanRecharge:52, // 新增金豆充值
beanSystemRecharge:53, // 金豆系统充值
beanOnlineRecharge:54, // 金豆线上充值
addCoinConsume:55, // 新增金币消耗
coinConsumeDetail:56, // 金币消耗明细
addBeanConsume:57, // 新增金豆消耗
beanZBDetail:58, // 金豆直播消耗
beanTFDetail:59, // 金豆铁粉消耗
beanSPWZDetail:60, // 金豆视频文章消耗
addCoinRefund:61, // 新增金币退款
coinRefundDetail:62, // 金币退款明细
coinCustomerDetail:63, // 金币客户账户明细
coinCustomerMoney:64, // 金币客户账户金额
userManageShow:65, // 用户管理展示
addUserInfo:66, // 新增用户信息
editUserInfo:67, // 编辑用户信息
updateUserInfo:68, // 重置密码
deleteUserInfo:69, // 删除用户信息
changeStatus:70, // 启用禁用用户
roleManageShow:73, // 查看角色信息
addRoleInfo:71, // 新增角色信息
editRoleInfo:72, // 编辑角色信息
executeEdit:84, // 执行明细编辑
executeSubmit:85, // 执行明细提交
receiveServiceShow:86, // 收款-客服展示
receiveServiceAdd:87, // 收款-客服新增
receiveServiceReturn:88, // 收款-客服撤回
receiveServiceEdit:89, // 收款-客服编辑
receiveServiceRefund:90, // 收款-客服退款
receiveAreaWaiting:91, // 收款-地区财务/负责人待审核
receiveAreaPass:92, // 收款-地区财务/负责人已通过
receiveAreaReject:93, // 收款-地区财务/负责人已驳回
receiveAreaWaitingShow:94, // 收款-地区财务/负责人待审核查看
receiveAreaApproved:95, // 收款-地区财务/负责人通过
receiveAreaRejected:96, // 收款-地区财务/负责人驳回
receiveAreaPassShow:97, // 收款-地区财务/负责人已通过查看
receiveAreaPassEdit:98, // 收款-地区财务/负责人已通过编辑
receiveHeaderPassShow:99, // 收款-总部财务/管理员已通过
receiveHeaderPassShow:100, // 收款-总部财务/管理员已通过查看
receiveHeaderPassEdit:101, // 收款-总部财务/管理员已通过编辑
refundServiceShow:102, // 退款-客服查看
refundServiceBack:103, // 退款-客服撤回
refundServiceEdit:104, // 退款-客服编辑
refundFinanceShow:105, // 退款-地区财务查看
refundFinanceAudit:106, // 退款-地区财务审核
refundFinanceProgShow:107, // 退款-地区财务进度查看
refundChargeShow:108, // 退款-地区负责人查看
refundChargeAudit:109, // 退款-地区负责人审核
refundChargeProgShow:110, // 退款-地区负责人进度查看
refundHeaderShow:111, // 退款-总部财务/管理员查看
refundHeaderAudit:112, // 退款-总部财务/管理员审核
refundHeaderProgShow:113, // 退款-总部财务/管理员进度查看
// 特殊,5级
updateData:115, // 手动拉取数据
gold_coin_management: 3, // 金币管理
financial_audit: 4, // 财务审核
gold_coin_audit: 5, // 金币审核
gold_coin_recharge_audit: 6, // 金币充值审核
gold_coin_recharge_pending: 7, // 金币充值审核待审核
view_gold_recharge_pending: 8, // 金币充值审核待审核查看
pass_gold_recharge_audit: 9, // 金币充值审核通过
reject_gold_recharge_audit: 10, // 金币充值审核驳回
gold_coin_recharge_approved: 11, // 金币充值审核已通过
gold_coin_recharge_rejected: 12, // 金币充值审核已驳回
gold_coin_refund_audit: 13, // 金币退款审核
gold_coin_refund_pending: 14, // 金币退款审核待审核
view_gold_refund_pending: 15, // 金币退款审核待审核查看
pass_gold_refund_audit: 16, // 金币退款审核通过
reject_gold_refund_audit: 17, // 金币退款审核驳回
gold_coin_refund_approved: 18, // 金币退款审核已通过
gold_coin_refund_rejected: 19, // 金币退款审核已驳回
gold_bean_audit: 20, // 金豆审核
gold_bean_audit_pending: 21, // 金豆审核待审核
view_gold_bean_pending: 22, // 金豆审核待审核查看
pass_gold_bean_audit: 23, // 金豆审核已通过
reject_gold_bean_audit: 24, // 金豆审核已驳回
gold_bean_audit_approved: 25, // 金豆审核待审核通过
gold_bean_audit_rejected: 26, // 金豆审核待审核驳回
exchange_rate_management: 27, // 汇率管理
view_exchange_rate: 28, // 查看汇率
edit_exchange_rate: 29, // 编辑汇率
recharge_management: 30, // 充值管理
gold_coin_recharge: 31, // 金币充值
gold_coin_recharge_details: 32, // 金币充值明细
add_gold_coin_recharge: 33, // 新增金币充值
gold_bean_recharge: 34, // 金豆充值
system_gold_bean_recharge: 35, // 系统金豆充值
online_gold_bean_recharge: 36, // 线上金豆充值
add_gold_bean_recharge: 37, // 新增金豆充值
consumption_management: 38, // 消耗管理
gold_coin_consumption: 39, // 金币消耗
gold_coin_consumption_details: 40, // 金币消耗明细
add_gold_coin_consumption: 41, // 新增金币消耗
gold_bean_consumption: 42, // 金豆消耗
gold_bean_live_details: 43, // 金豆直播明细
gold_bean_fan_details: 44, // 金豆铁粉明细
gold_bean_video_details: 45, // 金豆视频/文章明细
add_gold_bean_consumption: 46, // 新增金豆消耗
refund_management: 47, // 退款管理
add_gold_coin_refund: 48, // 新增金币退款
gold_coin_refund_details: 49, // 金币退款明细
customer_account_details: 50, // 客户账户明细
gold_coin_customer_details: 51, // 金币客户账户明细
gold_coin_customer_bill: 52, // 金币明细
gold_coin_customer_balance: 53, // 金币余额
gold_bean_customer_details: 54, // 金豆客户账户明细
historical_data_query: 55, // 历史数据查询
new_version_gold_query: 56, // 新版金币查询
old_version_gold_query: 57, // 旧版金币查询
cash_management: 58, // 现金管理
collection_details: 59, // 收款明细
collection_area_customer_service: 60, // 收款 - 地区客服
view_customer_service_collection: 61, // 客服收款查看
add_customer_service_collection: 62, // 客服添加收款
withdraw_customer_service_collection: 63, // 客服收款撤回
edit_customer_service_collection: 64, // 客服收款编辑
refund_customer_service_collection: 65, // 客服收款退款
view_customer_service_refund_reason: 66, // 客服收款查看退款理由
collection_area_finance: 67, // 收款 - 地区财务
area_finance_collection_pending: 68, // 地区财务收款待审核
view_area_finance_pending: 69, // 地区财务收款待审核查看
pass_area_finance_collection: 70, // 地区财务收款通过
reject_area_finance_collection: 71, // 地区财务收款驳回
area_finance_collection_approved: 72, // 地区财务收款已通过
view_area_finance_approved: 73, // 地区财务收款已通过查看
edit_area_finance_approved: 74, // 地区财务收款已通过编辑
area_finance_collection_rejected: 75, // 地区财务收款已驳回
area_finance_collection_completed: 76, // 地区财务收款已完成
view_area_finance_completed: 77, // 地区财务收款已完成查看
refund_area_finance_completed: 78, // 地区财务收款已完成退款
collection_area_manager: 79, // 收款 - 地区负责人
area_manager_collection_pending: 80, // 地区负责人收款待审核
view_area_manager_pending: 81, // 地区负责人收款待审核查看
pass_area_manager_collection: 82, // 地区负责人收款通过
reject_area_manager_collection: 83, // 地区负责人收款驳回
area_manager_collection_approved: 84, // 地区负责人收款已通过
view_area_manager_approved: 85, // 地区负责人收款已通过查看
edit_area_manager_approved: 86, // 地区负责人收款已通过编辑
area_manager_collection_rejected: 87, // 地区负责人收款已驳回
area_manager_collection_completed: 88, // 地区负责人收款已完成
view_area_manager_completed: 89, // 地区负责人收款已完成查看
refund_area_manager_completed: 90, // 地区负责人收款已完成退款
collection_headquarters_finance: 91, // 收款 - 总部财务
headquarters_finance_approved: 92, // 总部财务收款已通过
view_headquarters_approved: 93, // 总部财务收款已通过查看
edit_headquarters_approved: 94, // 总部财务收款已通过编辑
headquarters_finance_completed: 95, // 总部财务收款已完成
view_headquarters_completed: 96, // 总部财务收款已完成查看
refund_headquarters_completed: 97, // 总部财务收款已完成退款
refund_details: 98, // 退款明细
refund_area_customer_service: 99, // 退款 - 地区客服
view_customer_service_refund_pending: 100, // 客服退款查看
withdraw_customer_service_refund: 101, // 客服退款撤回
edit_customer_service_refund: 102, // 客服退款编辑
refund_area_finance: 103, // 退款 - 地区财务
view_area_finance_refund: 104, // 地区财务退款查看
audit_area_finance_refund: 105, // 地区财务退款审核
track_area_finance_refund_progress: 106, // 地区财务退款进度
refund_area_manager: 107, // 退款 - 地区负责人
view_area_manager_refund: 108, // 地区负责人退款查看
audit_area_manager_refund: 109, // 地区负责人退款审核
track_area_manager_refund_progress: 110, // 地区负责人退款进度
refund_headquarters_finance: 111, // 退款 - 总部财务
view_headquarters_refund: 112, // 总部财务退款查看
audit_headquarters_refund: 113, // 总部财务退款审核
track_headquarters_refund_progress: 114, // 总部财务退款进度
execution_details: 115, // 执行明细
view_execution_details: 116, // 查看执行明细
edit_execution_details: 117, // 编辑执行明细
submit_execution_details: 118, // 提交执行明细
activity_management: 119, // 活动管理
view_activity: 120, // 查看活动
add_activity: 121, // 新增活动
edit_activity: 122, // 编辑活动
delete_activity: 123, // 删除活动
channel_management: 124, // 频道管理
reward_management: 125, // 打赏管理
fan_management: 126, // 铁粉管理
small_cart_management: 127, // 小黄车管理
permission_management: 128, // 权限管理
user_management: 129, // 用户管理
display_user_management: 130, // 用户管理展示
add_user_information: 131, // 新增用户信息
edit_user_information: 132, // 编辑用户信息
reset_user_password: 133, // 重置用户密码
delete_user_information: 134, // 删除用户信息
enable_disable_user: 135, // 启用禁用用户
role_management: 136, // 角色管理
add_role_information: 137, // 新增角色信息
edit_role_information: 138, // 编辑角色信息
view_role_information: 139, // 查看角色信息
settings_center: 140, // 设置中心
refresh_data: 141, // 刷新数据
view_personal_information: 142, // 查看个人信息
change_password: 143, // 修改密码
logout_system: 144, // 退出登录
message_push: 145 // 消息推送
}
// 递归查找菜单中是否存在目标id

468
src/views/managerecharge/rate.vue

@ -1,401 +1,127 @@
<script setup>
import {onMounted, reactive, ref} from 'vue'
import {ElMessage, ElMessageBox} from 'element-plus'
import request from '@/util/http'
import {useAdminStore} from "@/store/index.js";
import {storeToRefs} from "pinia";
import {permissionMapping, hasMenuPermission} from "@/utils/menuTreePermission.js"
const adminStore = useAdminStore()
const {adminData, menuTree} = storeToRefs(adminStore)
const regeEdit = ref(false)
const editFormRef = ref(null)
const tableData = ref([])
//
const getObj = ref({
pageNum: 1,
pageSize: 10
})
const total = ref(0)
const rateEdit = ref({
id: null,
rateName: '',
num: null,
adminId: null,
updateTime: Date.now(),
})
//
const rateNames = [
{
value: 'USD',
label: 'USD'
},
{
value: 'HKD',
label: 'HKD'
},
{
value: 'THB',
label: 'THB'
},
{
value: 'VND',
label: 'VND'
},
{
value: 'CAD',
label: 'CAD'
},
{
value: 'MYR',
label: 'MYR'
},
{
value: 'KRW',
label: 'KRW'
},
{
value: 'JPY',
label: 'JPY'
},
{
value: 'CNY',
label: 'CNY'
}
]
//
const checkFreeGoldRadio = function (rule, value, callback) {
if (value == '0' || value == null || value == '') {
callback(new Error('请输入汇率比'))
} else if (value < 0 || isNaN(value)) {
callback(new Error('请输入正确的格式'))
} else {
callback()
}
}
//
const rules = reactive({
num: [{validator: checkFreeGoldRadio, trigger: 'blur'}],
})
//
const formSize = ref('default')
const getAllRate = async function (val) {
try {
const result = await request({
url: '/rate/selectAll',
method: 'POST',
data: {
pageNum: getObj.value.pageNum,
pageSize: getObj.value.pageSize,
}
})
console.log('这是汇率列表 请求成功', result)
tableData.value = result.data.list
total.value = result.data.total
} catch (error) {
console.log('请求失败', error);
ElMessage.error('请求失败');
}
}
const handlePageSizeChange = function (val) {
getObj.value.pageSize = val
getAllRate()
}
const handleCurrentChange = function (val) {
getObj.value.pageNum = val
getAllRate()
}
const getEditData = async function (row) {
try {
console.log('搜索参数', getObj.value)
const result = await request({
url: '/rate/selectById',
data: {id: row.id}
})
console.log('根据id查 请求成功', result)
rateEdit.value.id = row.id
rateEdit.value.rateName = row.rateName
rateEdit.value.num = row.num
console.log('根据id获取的数据', rateEdit.value)
rateEdit.value.adminId = adminData.value.id
} catch (error) {
console.log('请求失败', error)
}
}
const hasrateShow = ref(false)
const hasrateEdit = ref(false)
//
const initPermissions = () => {
if (!menuTree.value || !menuTree.value.length) return;
hasrateShow.value = hasMenuPermission(menuTree.value, permissionMapping.rateShow);
hasrateEdit.value = hasMenuPermission(menuTree.value, permissionMapping.rateEdit);
};
//
const editRate = async function () {
if (!hasrateEdit) {
ElMessage.error('暂无权限')
return
}
//
rateEdit.value.num = parseFloat(rateEdit.value.num);
try {
console.log('搜索参数', rateEdit.value)
const result = await request({
url: '/rate/update',
data: rateEdit.value
})
console.log('请求成功', result)
await getAllRate()
} catch (error) {
console.log('请求失败', error)
}
}
//
const edit = () => {
editFormRef.value.validate(async (valid) => {
if (valid) {
try {
await ElMessageBox.confirm("确认修改?");
await editRate();
console.log("修改成功");
regeEdit.value = false;
} catch (error) {
console.log("取消修改", error);
regeEdit.value = false;
}
} else {
ElMessage({
type: "error",
message: "请检查输入内容",
})
}
})
}
const cancelEdit = () => {
regeEdit.value = false
}
const handleEditDialogClose = () => {
if (editFormRef.value) {
getAllRate()
}
}
//
function formatDate(value) {
if (!value) return ''
const date = new Date(value)
const year = date.getFullYear()
const month = (date.getMonth() + 1).toString().padStart(2, '0')
const day = date.getDate().toString().padStart(2, '0')
const hours = date.getHours().toString().padStart(2, '0')
const minutes = date.getMinutes().toString().padStart(2, '0')
const seconds = date.getSeconds().toString().padStart(2, '0')
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
}
//
function handleInput(value) {
// 使
if (value.includes('。') || /[^\d.]/g.test(value)) {
ElMessage.warning('请输入正确的符号');
// value = value.replace('', '.');
}
//
const parts = value.split('.');
if (parts.length > 2) {
value = parts[0] + '.' + parts.slice(1).join('');
ElMessage.warning('只能包含一个小数点');
}
//
if (value.startsWith('-')) {
ElMessage.warning('不允许输入负数');
value = value.substring(1);
}
//
if (value.includes('.')) {
const parts = value.split('.')
//
if (parts[0].length > 6) {
parts[0] = parts[0].slice(0, 6)
ElMessage.info('整数部分最多允许六位')
}
//
if (parts[1].length > 7) {
parts[1] = parts[1].slice(0, 7)
value = parts[0] + '.' + parts[1]
ElMessage.info('最多允许七位小数')
} else {
value = parts[0] + '.' + parts[1]
}
} else {
//
if (value.length > 6) {
value = value.slice(0, 6)
ElMessage.info('整数部分最多允许六位')
}
}
// 0
if (value.startsWith('.')) {
value = '0' + value;
//
// ElMessage.info('0');
}
//
rateEdit.value.num = value
return value
}
<template>
<el-card>
<div class="condition">
<div class="condition-item1">
<el-text size="large">活动名称</el-text>
<el-input v-model="searchForm.activity" style="width: 10vw" placeholder="请输入活动名称" clearable />
</div>
<div class="condition-item1">
<el-text size="large">业绩归属</el-text>
<el-input v-model="searchForm.achievement" style="width: 10vw" placeholder="请输入业绩归属" clearable />
</div>
<div class="condition-item2">
<el-text size="large">开始时间</el-text>
<el-date-picker v-model="searchForm.startTime" type="datetime" placeholder="请选择开始时间"
:default-time="defaultTime" />
</div>
<div class="condition-item2">
<el-text size="large">结束时间</el-text>
<el-date-picker v-model="searchForm.endTime" type="datetime" placeholder="请选择结束时间"
:default-time="defaultTime" />
</div>
<el-button type="primary" @click="search">查询</el-button>
<el-button type="success" @click="reset">重置</el-button>
</div>
</el-card>
onMounted(async function () {
initPermissions()
await getAllRate()
})
</script>
<el-button type="success" @click="showAdd = true" style="margin-top: 1vh;">新增活动</el-button>
<template>
<el-card class="card2" style="width:82vw;height:85vh" v-if="hasrateShow">
<el-table :data="tableData" v-if="(tableData.flag = 1)">
<el-card style="margin-top: 1vh;">
<el-table :data="tableData" style="width: 82vw;" :row-style="{ height: '50px' }">
<el-table-column type="index" label="序号" width="100px" fixed="left">
<template #default="scope">
<span>{{
scope.$index + 1 + (getObj.pageNum - 1) * getObj.pageSize
}}</span>
<span>{{ scope.$index + 1 + (pagination.pageNum - 1) * pagination.pageSize }}</span>
</template>
</el-table-column>
<el-table-column prop="rateName" label="货币名称" :span="2"/>
<el-table-column prop="num" label="汇率" :span="2">
<el-table-column prop="name" label="活动名称" width="150px" show-overflow-tooltip />
<el-table-column prop="jwcode" label="业绩归属地" width="150px" />
<el-table-column prop="market" label="归属地" width="150px" />
<el-table-column prop="payTime" label="开始时间" width="200px">
<template #default="scope">
<p>
{{ scope.row.num }} 1
</p>
{{ moment(scope.row.payTime).format('YYYY-MM-DD HH:mm:ss') }}
</template>
</el-table-column>
<el-table-column prop="updateTime" label="更新时间" :span="3">
<el-table-column prop="createTime" label="结束时间" width="200px">
<template #default="scope">
<span>{{ formatDate(scope.row.updateTime) }}</span>
{{
activeName === 'wait'
? moment(scope.row.auditTime).format('YYYY-MM-DD HH:mm:ss')
: moment(scope.row.createTime).format('YYYY-MM-DD HH:mm:ss')
}}
</template>
</el-table-column>
<el-table-column v-if="hasrateEdit" label="操作" :span="3">
<template #default="scope">
<el-link :underline="false" class="edit-btn" @click="() => {
regeEdit = true
getEditData(scope.row)
}">编辑
</el-link>
</template>
<el-table-column prop="market" label="状态" width="150px" />
<el-table-column prop="operation" label="操作" width="150px">
</el-table-column>
</el-table>
<!-- 分页 -->
<div class="pagination">
<el-pagination background :page-size="getObj.pageSize" :page-sizes="[5, 10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handlePageSizeChange"
@current-change="handleCurrentChange"></el-pagination>
</div>
</el-card>
<!-- 这是编辑弹窗 -->
<el-dialog align-center v-model="regeEdit" title="修改汇率" width="30vw" :close-on-click-modal="false"
@close="handleEditDialogClose">
<el-form ref="editFormRef" :model="rateEdit" :rules="rules" label-width="auto" class="edit-form" :size="formSize"
status-icon>
<el-form-item prop="rateName" label="货币名称:">
<el-input v-model="rateEdit.rateName" disabled style="width: 10vw"/>
</el-form-item>
<el-form-item prop="num" label="汇率:">
<el-input v-model="rateEdit.num" @update:modelValue="handleInput" style="width: 120px"/>
<span class="unit">:1</span>
<span class="rate-tip">
(提示当前规则每
<span>{{ rateEdit.num }}</span>
<span>{{ rateEdit.rateName }}</span>可兑换 1 新币)
</span>
</el-form-item>
</el-form>
<div class="dialog-footer">
<el-button type="primary" @click="edit">修改</el-button>
<el-button @click="cancelEdit">取消</el-button>
<el-dialog v-model="showAdd" width="20vw" draggable align-center style="background-color: rgb(243,250,254);">
<div class="add-item">
<el-text size="large">活动名称</el-text>
<el-input v-model="addForm.activity" style="width: 12vw" placeholder="请输入活动名称" clearable />
</div>
<div class="add-item">
<el-text size="large">业绩归属</el-text>
<el-input v-model="addForm.achievement" style="width: 12vw" placeholder="请输入业绩归属" clearable />
</div>
<div class="add-item">
<el-text size="large">开始时间</el-text>
<el-date-picker v-model="addForm.startTime" type="datetime" placeholder="请选择付款时间" :default-time="defaultTime" style="width: 12vw" />
</div>
<div class="add-item">
<el-text size="large">结束时间</el-text>
<el-date-picker v-model="addForm.endTime" type="datetime" placeholder="请选择付款时间" :default-time="defaultTime" style="width: 12vw" />
</div>
<div style="display: flex; justify-content: center; margin-top: 5vh;">
<el-button type="primary" @click="">取消</el-button>
<el-button type="primary" @click="">确定</el-button>
</div>
</el-dialog>
</template>
<script setup>
import { ElPagination } from 'element-plus';
import { ref } from 'vue'
<style scoped>
.card1 {
background: #F3FAFE;
}
:deep(.el-table__header-wrapper),
:deep(.el-table__body-wrapper),
:deep(.el-table__cell),
/* 表格 */
:deep(.el-table__body td) {
background-color: #F3FAFE !important;
}
/* 表头 */
:deep(.el-table__header th) {
background-color: #F3FAFE !important;
}
/* 鼠标悬停 */
:deep(.el-table__row:hover > .el-table__cell) {
background-color: #E5EBFE !important;
}
.pagination {
margin-top: 20px;
const tableData = ref([])
const pagination = ref({
pageNum: 1,
pageSize: 10,
total: 0
})
const searchForm = ref({
activity: ''
})
const showAdd = ref(false)
const addForm = ref({
activity: '',
achievement: '',
startTime: '',
endTime: ''
})
</script>
<style>
.condition {
display: flex;
align-items: center;
}
.edit-form {
width: 35vw;
height: 13vh;
}
.dialog-footer {
.condition-item1 {
display: flex;
margin-left: 5vw;
align-items: center;
width: 15vw;
}
.unit {
margin-left: 0.5vw;
}
.rate-tip {
hyphens: auto;
}
/**表单的卡片样式**/
.card2 {
background: #E7F4FD;
}
/**表头背景等**/
:deep(.el-table__header-wrapper),
:deep(.el-table__body-wrapper),
:deep(.el-table__cell),
/* 表格 */
:deep(.el-table__body td) {
background-color: #F3FAFE !important;
}
/* 表头 */
:deep(.el-table__header th) {
background-color: #F3FAFE !important;
.condition-item2 {
display: flex;
align-items: center;
width: 17vw;
}
/* 鼠标悬停 */
:deep(.el-table__row:hover > .el-table__cell) {
background-color: #E5EBFE !important;
.add-item{
display: flex;
align-items: center;
width: 17vw;
margin-bottom: 1vh;
}
</style>
Loading…
Cancel
Save