Browse Source

Merge branch 'refs/heads/milestone-20251104-现金二期' into lihui/feature-20251104165712-现金二期

zhangyong/milestone-20250913-现金管理二期^2
lihui 4 weeks ago
parent
commit
db2acf0fd3
  1. 14
      src/store/index.js
  2. 20
      src/views/consume/bean/beanConsume.vue
  3. 13
      src/views/home.vue
  4. 30
      src/views/recharge/bean/beanRecharge.vue
  5. 32
      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')
}
}

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/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>

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;
}
}

32
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()
}
})
//
@ -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