|
|
|
@ -21,14 +21,6 @@ |
|
|
|
> |
|
|
|
{{ $t('clientCount.clientCountBalance') }} |
|
|
|
</el-button> |
|
|
|
<el-button |
|
|
|
class="no-active-btn" |
|
|
|
:class="{ 'active-btn': activeTab === 'clientCountWallet' }" |
|
|
|
@click="navigateTo('clientCountWallet')" |
|
|
|
:disabled="!hasWallet" v-if="hasWallet" |
|
|
|
> |
|
|
|
{{ $t('clientCount.clientCountWallet') }} |
|
|
|
</el-button> |
|
|
|
</el-button-group> |
|
|
|
<!-- 渲染子路由组件 --> |
|
|
|
</div> |
|
|
|
@ -56,7 +48,6 @@ const {menuTree} = storeToRefs(adminStore); |
|
|
|
const activeTab = ref(''); |
|
|
|
const hasDetail = ref(false); |
|
|
|
const hasBalance = ref(false); |
|
|
|
const hasWallet = ref(false); |
|
|
|
// 导航方法 |
|
|
|
const navigateTo = (name) => { |
|
|
|
activeTab.value = name; |
|
|
|
@ -69,7 +60,6 @@ const initPermissions = () => { |
|
|
|
if (!menuTree.value || !menuTree.value.length) return; |
|
|
|
hasDetail.value = hasMenuPermission(menuTree.value, permissionMapping.gold_coin_customer_bill); |
|
|
|
hasBalance.value = hasMenuPermission(menuTree.value, permissionMapping.gold_coin_customer_balance); |
|
|
|
hasWallet.value = hasMenuPermission(menuTree.value, permissionMapping.wallet); |
|
|
|
}; |
|
|
|
|
|
|
|
// 默认跳转逻辑 |
|
|
|
@ -77,14 +67,13 @@ const getDefaultAuditRoute = () => { |
|
|
|
initPermissions(); |
|
|
|
if (hasDetail.value) return 'clientCountDetail'; |
|
|
|
if (hasBalance.value) return 'clientCountBalance'; |
|
|
|
if (hasWallet.value) return 'clientCountWallet'; |
|
|
|
return 'clientCountDetail'; |
|
|
|
}; |
|
|
|
|
|
|
|
// 监听路由变化更新标签状态 |
|
|
|
watch(() => route.name, (newName) => { |
|
|
|
initPermissions() |
|
|
|
if (newName === 'clientCountDetail' || newName === 'clientCountBalance' || newName === 'clientCountWallet') { |
|
|
|
if (newName === 'clientCountDetail' || newName === 'clientCountBalance') { |
|
|
|
activeTab.value = newName; |
|
|
|
} else if (newName === 'usergold') { |
|
|
|
// 每次访问 /coinConsume 都进行默认跳转 |
|
|
|
@ -101,7 +90,7 @@ onMounted(() => { |
|
|
|
navigateTo(defaultRoute); |
|
|
|
} else { |
|
|
|
// 非父路由初始化当前标签状态 |
|
|
|
if (route.name === 'clientCountDetail' || route.name === 'clientCountBalance' || route.name === 'clientCountWallet') { |
|
|
|
if (route.name === 'clientCountDetail' || route.name === 'clientCountBalance') { |
|
|
|
activeTab.value = route.name; |
|
|
|
} |
|
|
|
} |
|
|
|
|