Browse Source

拉代码

zhangyong/milestone-20250913-现金管理二期
ZhangYong 4 weeks ago
parent
commit
6b569bc77e
  1. 14
      src/store/index.js
  2. 4
      src/utils/menuUtils.js
  3. 20
      src/views/consume/bean/beanConsume.vue
  4. 13
      src/views/consume/gold/addCoinConsume.vue
  5. 4
      src/views/consume/gold/coinConsume.vue
  6. 16
      src/views/consume/gold/coinConsumeDetail.vue
  7. 4
      src/views/history/history.vue
  8. 7
      src/views/history/newHistory.vue
  9. 6
      src/views/history/oldHistory.vue
  10. 13
      src/views/home.vue
  11. 4
      src/views/managerecharge/rate.vue
  12. 30
      src/views/recharge/bean/beanRecharge.vue
  13. 4
      src/views/recharge/gold/coinRecharge.vue
  14. 4
      src/views/refund/gold/addCoinRefund.vue
  15. 5
      src/views/refund/gold/coinRefundDetail.vue
  16. 5
      src/views/usergold/bean/userbean.vue
  17. 4
      src/views/usergold/gold/clientCount.vue
  18. 2
      src/views/usergold/gold/clientCountBalance.vue
  19. 34
      src/views/usergold/gold/clientCountDetail.vue

14
src/store/index.js

@ -6,6 +6,7 @@ export const useAdminStore = defineStore('admin', {
adminData: null, // 用户信息
menuTree: [], // 菜单权限树
marketList: {}, // 市场列表
flag: 0, //员工数据开关状态,0=不包含员工数据,1=包含员工数据
}),
actions: {
// 设置用户信息并同步到localStorage
@ -24,11 +25,18 @@ export const useAdminStore = defineStore('admin', {
localStorage.setItem('marketList', JSON.stringify(list))
},
// 设置员工数据开关状态(使用数字0和1)
setFlag(flag) {
this.flag = flag
localStorage.setItem('flag', JSON.stringify(flag))
},
// 从localStorage初始化数据
initFromLocalStorage() {
const adminData = localStorage.getItem('adminData')
const menuTree = localStorage.getItem('menuTree')
const marketList = localStorage.getItem('marketList')
const flag = localStorage.getItem('flag')
if (adminData) {
this.adminData = JSON.parse(adminData)
@ -41,6 +49,10 @@ export const useAdminStore = defineStore('admin', {
if (marketList) {
this.marketList = JSON.parse(marketList)
}
if (flag) {
this.flag = JSON.parse(flag)
}
},
// 清空状态并移除localStorage数据
@ -48,9 +60,11 @@ export const useAdminStore = defineStore('admin', {
this.adminData = null
this.menuTree = []
this.marketList = {}
this.flag = 0
localStorage.removeItem('adminData')
localStorage.removeItem('menuTree')
localStorage.removeItem('marketList')
localStorage.removeItem('flag')
// localStorage.removeItem('token')
}
}

4
src/utils/menuUtils.js

@ -62,7 +62,6 @@ export const getRoutePath = (menu) => {
'退款管理': '/coinRefund',
// '金豆退款': '/beanRefund',
'历史数据查询': '/history',
'新版金币查询': '/history/newHistory',
@ -77,9 +76,6 @@ export const getRoutePath = (menu) => {
'金币客户账户明细': '/usergold',
'金豆客户账户明细': '/userbean',
// '用户管理': '/permissions/userPermission',
// '角色管理': '/permissions/rolePermission',
'收款明细': '/moneyManage/receiveDetail',
'收款-地区客服':'/moneyManage/receiveDetail/receiveService',
'收款-地区财务':'/moneyManage/receiveDetail/receiveArea',

20
src/views/consume/bean/beanConsume.vue

@ -3,8 +3,8 @@
<el-button-group class="custom-button-group">
<el-button
class="no-active-btn"
:class="{ 'active-btn': activeTab === 'addBeanConsume' }"
@click="navigateTo('addBeanConsume')"
:class="{ 'active-btn': activeTab === 'add_gold_bean_consumption' }"
@click="navigateTo('add_gold_bean_consumption')"
v-if="hasAdd"
style="width: 6.5vw;"
>
@ -72,26 +72,26 @@ const navigateTo = (name) => {
const initPermissions = () => {
if (!menuTree.value || !menuTree.value.length) return;
hasAdd.value = hasMenuPermission(menuTree.value, permissionMapping.addBeanConsume);
hasLive.value = hasMenuPermission(menuTree.value, permissionMapping.beanZBDetail);
hasFan.value = hasMenuPermission(menuTree.value, permissionMapping.beanTFDetail);
hasArticleVideo.value = hasMenuPermission(menuTree.value, permissionMapping.beanSPWZDetail);
hasAdd.value = hasMenuPermission(menuTree.value, permissionMapping.add_gold_bean_consumption);
hasLive.value = hasMenuPermission(menuTree.value, permissionMapping.gold_bean_live_details);
hasFan.value = hasMenuPermission(menuTree.value, permissionMapping.gold_bean_fan_details);
hasArticleVideo.value = hasMenuPermission(menuTree.value, permissionMapping.gold_bean_video_details);
};
//
const getDefaultAuditRoute = () => {
initPermissions();
if (hasAdd.value) return 'addBeanConsume';
if (hasAdd.value) return 'add_gold_bean_consumption';
if (hasLive.value) return 'liveStream';
if (hasFan.value) return 'dieHardFan';
if (hasArticleVideo.value) return 'articleVideo';
return 'addBeanConsume';
return 'add_gold_bean_consumption';
};
//
watch(() => route.name, (newName) => {
initPermissions()
if (newName=== 'addBeanConsume' || newName === 'liveStream' || newName === 'dieHardFan' || newName === 'articleVideo') {
if (newName=== 'add_gold_bean_consumption' || newName === 'liveStream' || newName === 'dieHardFan' || newName === 'articleVideo') {
activeTab.value = newName;
} else if (newName === 'beanConsume') {
// 访 /beanConsume
@ -108,7 +108,7 @@ onMounted(() => {
navigateTo(defaultRoute);
} else {
//
if (route.name=== 'addBeanConsume' || route.name === 'liveStream' || route.name === 'dieHardFan' || route.name === 'articleVideo') {
if (route.name=== 'add_gold_bean_consumption' || route.name === 'liveStream' || route.name === 'dieHardFan' || route.name === 'articleVideo') {
activeTab.value = route.name;
}
}

13
src/views/consume/gold/addCoinConsume.vue

@ -8,6 +8,7 @@ import { useAdminStore } from "@/store/index.js";
import { storeToRefs } from "pinia";
import { WarnTriangleFilled } from "@element-plus/icons-vue";
import dayjs from "dayjs";
import {hasMenuPermission, permissionMapping} from "@/utils/menuTreePermission.js";
const adminStore = useAdminStore();
const { adminData, menuTree } = storeToRefs(adminStore);
@ -213,8 +214,20 @@ const WriteCookiesTime = ref(null)
const ReadCookies = ref(null)
// cookie value
const ReadCookiesTime = ref(null)
const addCoinConsumePermission = ref(false) //
//
const initPermissions = async() => {
if (!menuTree.value || !menuTree.value.length) return;
addCoinConsumePermission.value = hasMenuPermission(menuTree.value, permissionMapping.add_gold_coin_consumption);
};
//
const add = async function () {
if (!addCoinConsumePermission) {
ElMessage.error('暂无权限')
return
}
try {
//
if (!validateInput()) {

4
src/views/consume/gold/coinConsume.vue

@ -52,8 +52,8 @@ const navigateTo = (name) => {
//
const initPermissions = () => {
if (!menuTree.value || !menuTree.value.length) return;
hasAdd.value = hasMenuPermission(menuTree.value, permissionMapping.addCoinConsume);
hasDetail.value = hasMenuPermission(menuTree.value, permissionMapping.coinConsumeDetail);
hasAdd.value = hasMenuPermission(menuTree.value, permissionMapping.add_gold_coin_consumption);
hasDetail.value = hasMenuPermission(menuTree.value, permissionMapping.gold_coin_consumption_details);
};
//

16
src/views/consume/gold/coinConsumeDetail.vue

@ -5,6 +5,7 @@ import request from '@/util/http.js'
import API from '@/util/http.js'
import moment from 'moment'
import { reverseMarketMapping } from "@/utils/marketMap.js";
import {hasMenuPermission, permissionMapping} from "@/utils/menuTreePermission.js";
//
/*
@ -141,6 +142,15 @@ const totalGoldSearch = ref({
goodsName: ""
})
const selectPermission = ref(false)
//
const initPermissions = async() => {
if (!menuTree.value || !menuTree.value.length) return;
selectPermission.value = hasMenuPermission(menuTree.value, permissionMapping.gold_coin_consumption_details);
};
/*
====================方法=================================
*/
@ -161,6 +171,12 @@ const getAdminData = async function () {
const ConsumeSelectBy = async function (val) {
if (!hasrechargeWaitShow) {
ElMessage.error('暂无权限')
return
}
try {
//

4
src/views/history/history.vue

@ -28,8 +28,8 @@
const initPermissions = () => {
if (!menuTree.value || !menuTree.value.length) return
hasNew.value = hasMenuPermission(menuTree.value, permissionMapping.newCoinSelect)
hasOld.value = hasMenuPermission(menuTree.value, permissionMapping.oldCoinSelect)
hasNew.value = hasMenuPermission(menuTree.value, permissionMapping.new_version_gold_query)
hasOld.value = hasMenuPermission(menuTree.value, permissionMapping.old_version_gold_query)
}
//

7
src/views/history/newHistory.vue

@ -51,11 +51,12 @@ import dayjs from 'dayjs'
const adminStore = useAdminStore()
const { adminData, menuTree } = storeToRefs(adminStore)
import { permissionMapping, findMenuById } from "@/utils/menuTreePermission.js"
const defaultTime = [
new Date(2000, 1, 1, 0, 0, 0),
new Date(2000, 2, 1, 23, 59, 59),
]
const canLook = ref(findMenuById(menuTree.value, permissionMapping.new_version_gold_query))
const tableData = ref([])
const dateRange = ref([])
const searchObj = ref({
@ -69,6 +70,10 @@ const pagination = ref({
})
//
const get = async function () {
if(!canLook.value){
ElMessage.error('无此权限')
return
}
try {
if (searchObj.value.name || searchObj.value.jwcode) {
const startTime = dateRange.value && dateRange.value[0] ? moment(dateRange.value[0]).format('YYYY-MM-DD HH:mm:ss') : ""

6
src/views/history/oldHistory.vue

@ -52,7 +52,7 @@ const defaultTime = [
new Date(2000, 1, 1, 0, 0, 0),
new Date(2000, 2, 1, 23, 59, 59),
]
const canLook = ref(findMenuById(menuTree.value, permissionMapping.old_version_gold_query))
const tableData = ref([])
const dateRange = ref([])
const searchObj = ref({
@ -67,6 +67,10 @@ const pagination = ref({
//
const getOld = async function () {
if(!canLook.value){
ElMessage.error('无此权限')
return
}
try {
if (searchObj.value.name || searchObj.value.jwcode) {
const startTime = dateRange.value && dateRange.value[0] ? moment(dateRange.value[0]).format('YYYY-MM-DD HH:mm:ss') : ""

13
src/views/home.vue

@ -79,7 +79,7 @@ const menuList = ref([])
//
const adminStore = useAdminStore()
// adminData menuTree
const { adminData, menuTree } = storeToRefs(adminStore)
const { adminData, menuTree, flag } = storeToRefs(adminStore)
// ,menuTree
menuList.value = filterMenu(menuTree.value)
@ -156,6 +156,13 @@ function logout() {
ElMessage.success('退出成功')
}
//
const toggleFlag = () => {
const newFlag = flag.value === 1 ? 0 : 1
adminStore.setFlag(newFlag)
ElMessage.success(newFlag === 1 ? '员工数据已隐藏' : '员工数据已显示')
console.log('flag',newFlag)
}
</script>
@ -243,6 +250,10 @@ function logout() {
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="refreshData()">数据刷新</el-dropdown-item>
<!-- 员工数据开关 -->
<el-dropdown-item @click="toggleFlag()">
{{ flag === 1 ? '显示员工数据' : '隐藏员工数据' }}
</el-dropdown-item>
<el-dropdown-item @click="message()">查看个人信息</el-dropdown-item>
<el-dropdown-item @click="openChangePassword">修改密码</el-dropdown-item>
<el-dropdown-item @click="logout">退出登录</el-dropdown-item>

4
src/views/managerecharge/rate.vue

@ -128,8 +128,8 @@ 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);
hasrateShow.value = hasMenuPermission(menuTree.value, permissionMapping.view_exchange_rate);
hasrateEdit.value = hasMenuPermission(menuTree.value, permissionMapping.edit_exchange_rate);
};
//

30
src/views/recharge/bean/beanRecharge.vue

@ -3,24 +3,24 @@
<el-button-group>
<el-button
class="no-active-btn"
:class="{ 'active-btn': activeTab === 'addBeanRecharge' }"
@click="navigateTo('addBeanRecharge')"
:class="{ 'active-btn': activeTab === 'add_gold_bean_recharge' }"
@click="navigateTo('add_gold_bean_recharge')"
v-if="hasAdd"
style="width: 6.5vw">
新增充值
</el-button>
<el-button
class="no-active-btn"
:class="{ 'active-btn': activeTab === 'beanSystemRecharge' }"
@click="navigateTo('beanSystemRecharge')"
:class="{ 'active-btn': activeTab === 'system_gold_bean_recharge' }"
@click="navigateTo('system_gold_bean_recharge')"
v-if="hasSystem"
style="width: 6.5vw;">
系统充值
</el-button>
<el-button
class="no-active-btn"
:class="{ 'active-btn': activeTab === 'beanOnlineRecharge' }"
@click="navigateTo('beanOnlineRecharge')"
:class="{ 'active-btn': activeTab === 'online_gold_bean_recharge' }"
@click="navigateTo('online_gold_bean_recharge')"
v-if="hasOnline"
style="width: 6.5vw;">
线上充值
@ -58,24 +58,24 @@ const navigateTo = (name) => {
const initPermissions = () => {
if (!menuTree.value || !menuTree.value.length) return;
hasAdd.value = hasMenuPermission(menuTree.value, permissionMapping.addBeanRecharge);
hasSystem.value = hasMenuPermission(menuTree.value, permissionMapping.beanSystemRecharge);
hasOnline.value = hasMenuPermission(menuTree.value, permissionMapping.beanOnlineRecharge);
hasAdd.value = hasMenuPermission(menuTree.value, permissionMapping.add_gold_bean_recharge);
hasSystem.value = hasMenuPermission(menuTree.value, permissionMapping.system_gold_bean_recharge);
hasOnline.value = hasMenuPermission(menuTree.value, permissionMapping.online_gold_bean_recharge);
};
//
const getDefaultAuditRoute = () => {
initPermissions();
if (hasAdd.value) return 'addBeanRecharge';
if (hasSystem.value) return 'beanSystemRecharge';
if (hasOnline.value) return 'beanOnlineRecharge';
return 'addBeanRecharge';
if (hasAdd.value) return 'add_gold_bean_recharge';
if (hasSystem.value) return 'system_gold_bean_recharge';
if (hasOnline.value) return 'online_gold_bean_recharge';
return 'add_gold_bean_recharge';
};
//
watch(() => route.name, (newName) => {
initPermissions()
if (newName === 'addBeanRecharge' || newName === 'beanSystemRecharge' || newName === 'beanOnlineRecharge') {
if (newName === 'add_gold_bean_recharge' || newName === 'system_gold_bean_recharge' || newName === 'online_gold_bean_recharge') {
activeTab.value = newName;
} else if (newName === 'beanRecharge') {
// 访 /beanConsume
@ -92,7 +92,7 @@ onMounted(() => {
navigateTo(defaultRoute);
} else {
//
if (route.name === 'addBeanRecharge' || route.name === 'beanSystemRecharge' || route.name === 'beanOnlineRecharge') {
if (route.name === 'add_gold_bean_recharge' || route.name === 'system_gold_bean_recharge' || route.name === 'online_gold_bean_recharge') {
activeTab.value = route.name;
}
}

4
src/views/recharge/gold/coinRecharge.vue

@ -45,8 +45,8 @@ const navigateTo = (name) => {
const initPermissions = () => {
if (!menuTree.value || !menuTree.value.length) return;
hasAdd.value = hasMenuPermission(menuTree.value, permissionMapping.addCoinRecharge);
hasDetail.value = hasMenuPermission(menuTree.value, permissionMapping.coinRechargeDetail);
hasAdd.value = hasMenuPermission(menuTree.value, permissionMapping.add_gold_coin_recharge);
hasDetail.value = hasMenuPermission(menuTree.value, permissionMapping.gold_coin_recharge_details);
};
//

4
src/views/refund/gold/addCoinRefund.vue

@ -112,7 +112,7 @@ const getRefund = async function () {
// 退
const add = async function () {
//
if (!findMenuById(menuTree.value, permissionMapping.add_gold_coin_refund)) {
if (!canAdd.value) {
ElMessage.error('无此权限')
return
}
@ -413,7 +413,7 @@ const calculatedRechargeGoods = computed(() => {
const taskGold = addRefund.value.taskGold === '' ? 0 : +addRefund.value.taskGold;
return Number((permanentGold + freeGold + taskGold).toFixed(2));
})
const canAdd = findMenuById(menuTree.value,permissionMapping.addCoinRefund)
const canAdd = ref(findMenuById(menuTree.value,permissionMapping.add_gold_coin_refund))
watch(calculatedRechargeGoods, (newVal) => {
addRefund.value.sumGold = newVal
})

5
src/views/refund/gold/coinRefundDetail.vue

@ -14,7 +14,7 @@ import dayjs from "dayjs";
const adminStore = useAdminStore();
const { adminData, menuTree } = storeToRefs(adminStore);
const showEmployeeData = ref(false)
const canLook = findMenuById(menuTree.value, permissionMapping.gold_coin_refund_details)
const canLook = ref(findMenuById(menuTree.value, permissionMapping.gold_coin_refund_details))
const defaultTime = [
new Date(2000, 1, 1, 0, 0, 0),
@ -114,7 +114,8 @@ const getRefundTypes = async function () {
// ==============================================================
//
const getSelectBy = async function (val) {
if (!findMenuById(menuTree.value, permissionMapping.gold_coin_refund_details)) {
if (!canLook.value) {
console.log('无此权限', canLook.value)
ElMessage.error('无此权限')
return
}

5
src/views/usergold/bean/userbean.vue

@ -57,6 +57,7 @@ const { adminData, menuTree } = storeToRefs(adminStore);
import { permissionMapping, findMenuById } from "@/utils/menuTreePermission.js"
import { ElMessage } from 'element-plus';
const canLook = ref(findMenuById(menuTree.value, permissionMapping.gold_bean_customer_details))
const tableData = ref([])
const marketOptions = ref([])
const searchObj = ref({
@ -78,6 +79,10 @@ const pagination = ref({
})
const get = async function () {
try {
if(!canLook.value){
ElMessage.error('无此权限')
return
}
trim()
if (searchObj.value.jwcode) {
const numRef = /^\d{1,9}$/;

4
src/views/usergold/gold/clientCount.vue

@ -54,8 +54,8 @@ const navigateTo = (name) => {
const initPermissions = () => {
if (!menuTree.value || !menuTree.value.length) return;
hasDetail.value = hasMenuPermission(menuTree.value, permissionMapping.coinCustomerDetail);
hasBalance.value = hasMenuPermission(menuTree.value, permissionMapping.coinCustomerMoney);
hasDetail.value = hasMenuPermission(menuTree.value, permissionMapping.gold_coin_customer_bill);
hasBalance.value = hasMenuPermission(menuTree.value, permissionMapping.gold_coin_customer_balance);
};
//

2
src/views/usergold/gold/clientCountBalance.vue

@ -65,7 +65,7 @@ const sortOrder = ref('')
// ===========================================================================
//
const get = async function (val) {
if (!findMenuById(menuTree.value, permissionMapping.coinCustomerMoney)) {
if (!findMenuById(menuTree.value, permissionMapping.gold_coin_customer_balance)) {
ElMessage.error('无此权限')
return
}

34
src/views/usergold/gold/clientCountDetail.vue

@ -1,5 +1,5 @@
<script setup>
import { onMounted, ref } from 'vue'
import { onMounted, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import moment from 'moment'
@ -10,9 +10,18 @@ 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 { adminData, menuTree, flag } = storeToRefs(adminStore)
//
const showEmployeeData = ref(false)
// const showEmployeeData = ref(false)
// flag
watch(flag, (newFlag, oldFlag) => {
// flag
if (newFlag !== oldFlag) {
console.log('员工数据flag状态改变,重新加载数据', newFlag)
get()
}
})
//
@ -120,7 +129,7 @@ const getObj = ref({
// ===========================================================================
//
const get = async function (val) {
if (!findMenuById(menuTree.value, permissionMapping.coinCustomerDetail)) {
if (!findMenuById(menuTree.value, permissionMapping.gold_coin_customer_bill)) {
ElMessage.error('无此权限')
return
}
@ -165,7 +174,10 @@ const get = async function (val) {
const result = await API({
url: '/goldDetail/getGoldDetail',
method: 'post',
data: { ...getObj.value, goldDetail: { ...goldDetail.value, flag: showEmployeeData.value ? 0 : 1 } }
data: { ...getObj.value, goldDetail: { ...goldDetail.value,
// flag: showEmployeeData.value ? 0 : 1
flag: flag.value
} }
})
console.log('响应数据', result)
tableData.value = result.data.list
@ -174,7 +186,10 @@ const get = async function (val) {
url: '/goldDetail/getTotal',
method: 'post',
data: {
goldDetail: { ...goldDetail.value, flag: showEmployeeData.value ? 0 : 1 },
goldDetail: { ...goldDetail.value,
// flag: showEmployeeData.value ? 0 : 1
flag: flag.value
},
/* jwcode: goldDetail.value.jwcode || '',
payPlatform: goldDetail.value.payPlatform || '',
type: goldDetail.value.type || '',
@ -300,7 +315,8 @@ const exportExcel = async function () {
endTime: goldDetail.value.endTime || '',
sortField: goldDetail.value.sortField || '',
sortOrder: goldDetail.value.sortOrder || '',
flag: showEmployeeData.value ? 0 : 1 // flag
// flag: showEmployeeData.value ? 0 : 1 // flag
flag: flag.value
},
}
@ -485,9 +501,9 @@ const format3 = (num) => {
<el-cascader class="selectContent" v-model="selectedMarketPath" :options="markets" placeholder="请选择所属地区"
style="width:10vw" clearable @change="handleMarketChange" />
</div>
<div>
<!-- <div>
<el-checkbox v-model="showEmployeeData" @change="search()">员工数据</el-checkbox>
</div>
</div> -->
</div>
</el-col>

Loading…
Cancel
Save