更改直营代理和代理的页面显示
This commit is contained in:
@@ -8,6 +8,7 @@ const userType = computed(() => {
|
||||
try {
|
||||
const adminUser = localStorage.getItem('admin_user')
|
||||
if (adminUser) {
|
||||
console.log('user_type:', JSON.parse(adminUser).user_type)
|
||||
return JSON.parse(adminUser).user_type
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -29,7 +30,7 @@ const routes = [
|
||||
{
|
||||
path: '/',
|
||||
component: () => import('@/layout/Layout.vue'),
|
||||
redirect: userType.value === 'agent' ? '/dashboard_agent' : '/dashboard_directly',
|
||||
redirect: userType.value === 'agent' ? '/dashboard_agent' : userType.value === 'agent_directly' ? '/dashboard_directly' : '/login',
|
||||
meta: {
|
||||
requiresAuth: true
|
||||
},
|
||||
|
||||
@@ -274,11 +274,12 @@ const statsData = ref({
|
||||
total_users: 0,
|
||||
total_balance: 0,
|
||||
today_new_users: 0,
|
||||
active_users: 0
|
||||
active_users: 0,
|
||||
today_shared_users: 0,
|
||||
shared_users: 0
|
||||
},
|
||||
commissions: {
|
||||
total_commission: 0,
|
||||
today_commission: 0,
|
||||
paid_commission: 0,
|
||||
pending_commission: 0
|
||||
},
|
||||
@@ -304,7 +305,7 @@ const userActivityData = ref([])
|
||||
const stats = computed(() => [
|
||||
{
|
||||
key: 'users',
|
||||
label: '招募商户数量',
|
||||
label: '直推用户数量',
|
||||
value: statsData.value.users.active_users,
|
||||
icon: User,
|
||||
class: 'stat-users',
|
||||
@@ -312,6 +313,16 @@ const stats = computed(() => [
|
||||
changeClass: statsData.value.users.today_new_users >= 0 ? 'positive' : 'negative',
|
||||
changeIcon: statsData.value.users.today_new_users >= 0 ? 'ArrowUp' : 'ArrowDown'
|
||||
},
|
||||
{
|
||||
key: 'shared_users',
|
||||
label: '分享用户数量',
|
||||
value: statsData.value.users.shared_users,
|
||||
icon: User,
|
||||
class: 'stat-users',
|
||||
change: `${statsData.value.users.today_shared_users > 0 ? '+' : ''}${statsData.value.users.today_shared_users}`,
|
||||
changeClass: statsData.value.users.today_shared_users >= 0 ? 'positive' : 'negative',
|
||||
changeIcon: statsData.value.users.today_shared_users >= 0 ? 'ArrowUp' : 'ArrowDown'
|
||||
},
|
||||
{
|
||||
key: 'commission',
|
||||
label: '佣金',
|
||||
@@ -322,16 +333,6 @@ const stats = computed(() => [
|
||||
changeClass: 'positive',
|
||||
changeIcon: ArrowUp
|
||||
},
|
||||
{
|
||||
key: 'today',
|
||||
label: '已提现佣金',
|
||||
value: `¥${statsData.value.commissions.today_commission}`,
|
||||
icon: Coin,
|
||||
class: 'stat-today',
|
||||
change: '+15.3%',
|
||||
changeClass: 'positive',
|
||||
changeIcon: ArrowUp
|
||||
},
|
||||
{
|
||||
key: 'pending',
|
||||
label: '本月佣金',
|
||||
@@ -665,6 +666,7 @@ watch(userChartPeriod, () => {
|
||||
// 组件挂载时加载数据
|
||||
onMounted(() => {
|
||||
refreshData()
|
||||
// console.log('statsData.users:',statsData.value.users)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</el-icon>
|
||||
</div>
|
||||
<div class="greeting-text">
|
||||
<h1 class="page-title">代理数据统计</h1>
|
||||
<h1 class="page-title">直营代理数据统计</h1>
|
||||
<p class="page-subtitle">{{ getGreeting() }},{{ userStore.user?.realName }}!</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -37,8 +37,12 @@
|
||||
|
||||
<!-- 统计卡片 -->
|
||||
<div class="stats-section">
|
||||
<el-row :gutter="24" class="stats-row">
|
||||
<el-col :xs="24" :sm="12" :md="6" :lg="6" v-for="stat in stats" :key="stat.key">
|
||||
<el-row :gutter="20" class="stats-row">
|
||||
<el-col
|
||||
v-for="stat in stats"
|
||||
:key="stat.key"
|
||||
class="stat-col"
|
||||
>
|
||||
<div class="stat-card" :class="stat.class" @click="handleStatClick(stat.key)">
|
||||
<div class="stat-background"></div>
|
||||
<div class="stat-content">
|
||||
@@ -274,7 +278,9 @@ const statsData = ref({
|
||||
total_users: 0,
|
||||
total_balance: 0,
|
||||
today_new_users: 0,
|
||||
active_users: 0
|
||||
active_users: 0,
|
||||
total_directly_agents: 0,
|
||||
total_new_users: 0,
|
||||
},
|
||||
commissions: {
|
||||
total_commission: 0,
|
||||
@@ -304,7 +310,17 @@ const userActivityData = ref([])
|
||||
const stats = computed(() => [
|
||||
{
|
||||
key: 'users',
|
||||
label: '业务员数量',
|
||||
label: '直营代理总数',
|
||||
value: statsData.value.users.total_directly_agents,
|
||||
icon: User,
|
||||
class: 'stat-users',
|
||||
change: `${statsData.value.users.total_new_users > 0 ? '+' : ''}${statsData.value.users.total_new_users}`,
|
||||
changeClass: statsData.value.users.total_new_users >= 0 ? 'positive' : 'negative',
|
||||
changeIcon: statsData.value.users.total_new_users >= 0 ? 'ArrowUp' : 'ArrowDown'
|
||||
},
|
||||
{
|
||||
key: 'users',
|
||||
label: '招募商户数量',
|
||||
value: statsData.value.users.active_users,
|
||||
icon: User,
|
||||
class: 'stat-users',
|
||||
@@ -314,7 +330,7 @@ const stats = computed(() => [
|
||||
},
|
||||
{
|
||||
key: 'commission',
|
||||
label: '总业绩',
|
||||
label: '佣金',
|
||||
value: `¥${statsData.value.commissions.total_commission}`,
|
||||
icon: Money,
|
||||
class: 'stat-commission',
|
||||
@@ -324,7 +340,7 @@ const stats = computed(() => [
|
||||
},
|
||||
{
|
||||
key: 'today',
|
||||
label: '客户总数',
|
||||
label: '已提现佣金',
|
||||
value: `¥${statsData.value.commissions.today_commission}`,
|
||||
icon: Coin,
|
||||
class: 'stat-today',
|
||||
@@ -334,7 +350,7 @@ const stats = computed(() => [
|
||||
},
|
||||
{
|
||||
key: 'pending',
|
||||
label: '本月收入',
|
||||
label: '本月佣金',
|
||||
value: `¥${statsData.value.commissions.pending_commission}`,
|
||||
icon: Clock,
|
||||
class: 'stat-pending',
|
||||
@@ -744,6 +760,43 @@ onMounted(() => {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.stats-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.stat-col {
|
||||
flex: 1;
|
||||
min-width: 200px; /* 根据需要调整最小宽度 */
|
||||
max-width: 20%; /* 5个卡片就是 100% / 5 = 20% */
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* 响应式调整 */
|
||||
@media (max-width: 1200px) {
|
||||
.stat-col {
|
||||
max-width: 25%; /* 4个一行 */
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 992px) {
|
||||
.stat-col {
|
||||
max-width: 33.333%; /* 3个一行 */
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.stat-col {
|
||||
max-width: 50%; /* 2个一行 */
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.stat-col {
|
||||
max-width: 100%; /* 1个一行 */
|
||||
}
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
|
||||
@@ -127,6 +127,7 @@ const handleLogin = async () => {
|
||||
})
|
||||
|
||||
if (result.success) {
|
||||
console.log('登录信息:',JSON.parse(localStorage.getItem('admin_user')))
|
||||
// 保存记住我状态
|
||||
if (loginForm.remember) {
|
||||
localStorage.setItem('admin_remember', 'true')
|
||||
@@ -137,7 +138,7 @@ const handleLogin = async () => {
|
||||
}
|
||||
|
||||
// 跳转到仪表盘
|
||||
router.push('/dashboard')
|
||||
JSON.parse(localStorage.getItem('admin_user')).user_type === 'agent' ? router.push('/dashboard_agent') : router.push('/dashboard_directly')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('登录失败:', error)
|
||||
|
||||
Reference in New Issue
Block a user