This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<div class="analysis-dashboard">
|
||||
<PollingStats />
|
||||
<CommissionSummary />
|
||||
<CommissionStats />
|
||||
<WithdrawalSettings />
|
||||
<ActiveWechatConfig />
|
||||
<PollingStats v-if="hasPermission('dashboard_analysis:polling_stats')" />
|
||||
<CommissionSummary v-if="hasPermission('dashboard_analysis:commission_summary')" />
|
||||
<CommissionStats v-if="hasPermission('dashboard_analysis:commission_stats')" />
|
||||
<WithdrawalSettings v-if="hasPermission('dashboard_analysis:withdrawal_settings')" />
|
||||
<ActiveWechatConfig v-if="hasPermission('dashboard_analysis:wechat_config')" />
|
||||
|
||||
<!--<el-row :gutter="20">-->
|
||||
<!-- <el-col :xl="14" :lg="15" :xs="24">-->
|
||||
@@ -47,8 +47,11 @@
|
||||
import CommissionStats from './widget/CommissionStats.vue'
|
||||
import WithdrawalSettings from './widget/WithdrawalSettings.vue'
|
||||
import ActiveWechatConfig from './widget/ActiveWechatConfig.vue'
|
||||
import { usePermission } from '@/composables/usePermission'
|
||||
|
||||
defineOptions({ name: 'Analysis' })
|
||||
|
||||
const { hasPermission } = usePermission()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -74,9 +74,12 @@
|
||||
import { ElTag } from 'element-plus'
|
||||
import type { WechatConfig, PaymentProviderType } from '@/types/api'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import { usePermission } from '@/composables/usePermission'
|
||||
|
||||
defineOptions({ name: 'ActiveWechatConfigWidget' })
|
||||
|
||||
const { hasPermission } = usePermission()
|
||||
|
||||
// 当前生效的支付配置
|
||||
const activeConfig = ref<WechatConfig | null>(null)
|
||||
|
||||
@@ -102,6 +105,11 @@
|
||||
|
||||
// 加载当前生效配置
|
||||
const loadActiveConfig = async () => {
|
||||
// 检查权限,没有权限不调用接口
|
||||
if (!hasPermission('dashboard_analysis:wechat_config')) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await WechatConfigService.getActiveWechatConfig()
|
||||
if (res.code === 0 && res.data) {
|
||||
|
||||
@@ -82,9 +82,11 @@
|
||||
import type { CommissionStatsResponse } from '@/types/api/commission'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { formatMoney } from '@/utils/business/format'
|
||||
import { usePermission } from '@/composables/usePermission'
|
||||
|
||||
defineOptions({ name: 'CommissionStatsWidget' })
|
||||
|
||||
const { hasPermission } = usePermission()
|
||||
const userStore = useUserStore()
|
||||
const currentShopId = computed(() => userStore.info?.shop_id)
|
||||
|
||||
@@ -97,6 +99,11 @@
|
||||
}
|
||||
|
||||
const loadCommissionStats = async () => {
|
||||
// 检查权限,没有权限不调用接口
|
||||
if (!hasPermission('dashboard_analysis:commission_stats')) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!currentShopId.value) return
|
||||
|
||||
try {
|
||||
|
||||
@@ -116,9 +116,11 @@
|
||||
import type { MyCommissionSummary } from '@/types/api/commission'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { formatMoney } from '@/utils/business/format'
|
||||
import { usePermission } from '@/composables/usePermission'
|
||||
|
||||
defineOptions({ name: 'CommissionSummaryWidget' })
|
||||
|
||||
const { hasPermission } = usePermission()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const currentShopId = computed(() => userStore.info?.shop_id)
|
||||
@@ -142,6 +144,11 @@
|
||||
} | null>(null)
|
||||
|
||||
const loadSummary = async () => {
|
||||
// 检查权限,没有权限不调用接口
|
||||
if (!hasPermission('dashboard_analysis:commission_summary')) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!currentShopId.value) {
|
||||
errorMsg.value = '当前账号未关联店铺'
|
||||
return
|
||||
@@ -181,6 +188,11 @@
|
||||
}
|
||||
|
||||
const loadWithdrawalSetting = async () => {
|
||||
// 检查权限,没有权限不调用接口
|
||||
if (!hasPermission('dashboard_analysis:commission_summary')) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await CommissionService.getCurrentWithdrawalSetting()
|
||||
if (res.code === 0 && res.data) {
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<div class="header-left">
|
||||
<span class="header-title">实时统计</span>
|
||||
<ElTag type="primary" effect="dark" size="small">实时</ElTag>
|
||||
<span class="header-title">轮询初始化进度</span>
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<ElButton size="small" @click="loadOverviewStats" :loading="loading">刷新</ElButton>
|
||||
@@ -91,14 +90,21 @@
|
||||
import { Document, CircleCheck, User, Box, DataLine } from '@element-plus/icons-vue'
|
||||
import { PollingMonitorService } from '@/api/modules'
|
||||
import type { PollingOverviewStats } from '@/types/api'
|
||||
import { usePermission } from '@/composables/usePermission'
|
||||
|
||||
defineOptions({ name: 'PollingStats' })
|
||||
|
||||
const { hasPermission } = usePermission()
|
||||
const overviewStats = ref<PollingOverviewStats>()
|
||||
const loading = ref(false)
|
||||
|
||||
// 加载总览统计
|
||||
const loadOverviewStats = async () => {
|
||||
// 检查权限,没有权限不调用接口
|
||||
if (!hasPermission('dashboard_analysis:polling_stats')) {
|
||||
return
|
||||
}
|
||||
|
||||
loading.value = true
|
||||
try {
|
||||
const { data } = await PollingMonitorService.getOverviewStats()
|
||||
|
||||
@@ -61,9 +61,11 @@
|
||||
import type { DailyCommissionStatsItem } from '@/types/api/commission'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { formatMoney } from '@/utils/business/format'
|
||||
import { usePermission } from '@/composables/usePermission'
|
||||
|
||||
defineOptions({ name: 'DailyCommissionStatsWidget' })
|
||||
|
||||
const { hasPermission } = usePermission()
|
||||
const userStore = useUserStore()
|
||||
const currentShopId = computed(() => userStore.info?.shop_id)
|
||||
|
||||
@@ -101,6 +103,11 @@
|
||||
}
|
||||
|
||||
const loadDailyStats = async () => {
|
||||
// 检查权限,没有权限不调用接口
|
||||
if (!hasPermission('dashboard_analysis:withdrawal_settings')) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!currentShopId.value) return
|
||||
|
||||
loading.value = true
|
||||
|
||||
Reference in New Issue
Block a user