diff --git a/src/api/dashboard.js b/src/api/dashboard.js index fbe837f..fc716c8 100644 --- a/src/api/dashboard.js +++ b/src/api/dashboard.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 会员汇总数据 export function getMemberSummary() { return request({ - url: '/manage/dashboard/member/summary', + url: '/system/manage/board/member-summary', method: 'get' }) } @@ -11,7 +11,7 @@ export function getMemberSummary() { // 日业绩数据 export function getDailyPerformance(params) { return request({ - url: '/manage/dashboard/day-achieve', + url: '/system/manage/board/day-achieve', method: 'get', params }) @@ -20,7 +20,7 @@ export function getDailyPerformance(params) { // 月业绩数据 export function getMonthlyPerformance() { return request({ - url: '/manage/dashboard/month-achieve', + url: '/system/manage/board/month-achieve', method: 'get' }) } diff --git a/src/router/index.js b/src/router/index.js index 578ad37..3fee89a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -58,6 +58,13 @@ export const constantRoutes = [ component: () => import('@/views/dashboard/index'), meta: { title: '首页', icon: 'firstPage', icon1: 'firstPageSel' } }, + { + path: 'summaryDashboard', + name: 'SummaryDashboard', + component: () => import('@/views/dashboard/dashboard'), + meta: { title: '汇总', icon: 'dashboard' }, + hidden: true + }, { path: 'hasIndex', name: 'HasIndex', diff --git a/src/views/dashboard/dashboard.vue b/src/views/dashboard/dashboard.vue index c377341..60dbce6 100644 --- a/src/views/dashboard/dashboard.vue +++ b/src/views/dashboard/dashboard.vue @@ -7,6 +7,124 @@ :wait-approval-num="waitApprovalNum" :receive-approval-num="receiveApprovalNum" /> +
+ +
+
会员数据
+
+
+
会员总数
+
{{ memberSummary.memberTotal || 0 }}
+
+
+
今日新增会员
+
{{ memberSummary.memberToday || 0 }}
+
+
+
昨日新增会员
+
{{ memberSummary.memberYesterday || 0 }}
+
+
+
当月新增会员
+
{{ memberSummary.memberMonth || 0 }}
+
+
+
+ +
+
今日业绩
+
+
+
首购业绩
+
{{ dailyPerformance.today && dailyPerformance.today.firstAchieve || '0.00' }}
+
+
+
首购金额
+
{{ dailyPerformance.today && dailyPerformance.today.firstAmount || '0.00' }}
+
+
+
复购业绩
+
{{ dailyPerformance.today && dailyPerformance.today.repAchieve || '0.00' }}
+
+
+
复购金额
+
{{ dailyPerformance.today && dailyPerformance.today.repAmount || '0.00' }}
+
+
+
+
总金额
+
{{ getSum(dailyPerformance.today && dailyPerformance.today.firstAmount, dailyPerformance.today && dailyPerformance.today.repAmount) }}
+
+
+
总业绩
+
{{ getSum(dailyPerformance.today && dailyPerformance.today.firstAchieve, dailyPerformance.today && dailyPerformance.today.repAchieve) }}
+
+
+
+
+
+
昨日业绩
+
+
+
首购业绩
+
{{ dailyPerformance.yesterday && dailyPerformance.yesterday.firstAchieve || '0.00' }}
+
+
+
首购金额
+
{{ dailyPerformance.yesterday && dailyPerformance.yesterday.firstAmount || '0.00' }}
+
+
+
复购业绩
+
{{ dailyPerformance.yesterday && dailyPerformance.yesterday.repAchieve || '0.00' }}
+
+
+
复购金额
+
{{ dailyPerformance.yesterday && dailyPerformance.yesterday.repAmount || '0.00' }}
+
+
+
+
总金额
+
{{ getSum(dailyPerformance.yesterday && dailyPerformance.yesterday.firstAmount, dailyPerformance.yesterday && dailyPerformance.yesterday.repAmount) }}
+
+
+
总业绩
+
{{ getSum(dailyPerformance.yesterday && dailyPerformance.yesterday.firstAchieve, dailyPerformance.yesterday && dailyPerformance.yesterday.repAchieve) }}
+
+
+
+
+
+
本月业绩
+
+
+
首购业绩
+
{{ monthlyPerformance.firstAchieve || '0.00' }}
+
+
+
首购金额
+
{{ monthlyPerformance.firstAmount || '0.00' }}
+
+
+
复购业绩
+
{{ monthlyPerformance.repAchieve || '0.00' }}
+
+
+
复购金额
+
{{ monthlyPerformance.repAmount || '0.00' }}
+
+
+
+
总金额
+
{{ getSum(monthlyPerformance.firstAmount, monthlyPerformance.repAmount) }}
+
+
+
总业绩
+
{{ getSum(monthlyPerformance.firstAchieve, monthlyPerformance.repAchieve) }}
+
+
+
+
+
@@ -25,7 +143,8 @@ export default { memberSummary: {}, dailyPerformance: {}, monthlyPerformance: {}, - defaultTabItem: 'summary' + defaultTabItem: 'summaryDashboard', + userInfo: {} } }, mounted() { @@ -33,22 +152,67 @@ export default { this.getDailyPerformance() this.getMonthlyPerformance() this.getApprovalStatus() + this.userInfo = JSON.parse(localStorage.getItem('userInfo')) }, methods: { getMemberSummary() { + // { + // "msg": "操作成功", + // "code": 200, + // "data": { + // "memberTotal": 145, + // "memberToday": 0, + // "memberYesterday": 0, + // "memberMonth": 18 + // } + // } getMemberSummary().then(res => { this.memberSummary = res.data }) }, getDailyPerformance() { + // { + // "msg": "操作成功", + // "code": 200, + // "data": { + // "today": { + // "firstAchieve": "0.00", + // "firstAmount": "0.00", + // "repAchieve": "0.00", + // "repAmount": "0.00" + // }, + // "yesterday": { + // "firstAchieve": "0.00", + // "firstAmount": "0.00", + // "repAchieve": "1.29", + // "repAmount": "5.40" + // } + // } + // } getDailyPerformance().then(res => { this.dailyPerformance = res.data }) }, + // { + // "msg": "操作成功", + // "code": 200, + // "data": { + // "firstAchieve": "55.63", + // "firstAmount": "199.80", + // "repAchieve": "1.83", + // "repAmount": "10.61" + // } + // } getMonthlyPerformance() { getMonthlyPerformance().then(res => { this.monthlyPerformance = res.data }) + }, + getSum(a, b) { + // 字符串转数字后相加,保留两位小数 + const numA = parseFloat(a) || 0 + const numB = parseFloat(b) || 0 + return (numA + numB).toFixed(2) } } } @@ -60,4 +224,249 @@ export default { background: #f9f9f9; font-size: 14px; } +.dashboard-cards { + margin-top: 16px; + display: flex; + flex-direction: column; + gap: 24px; +} +.dashboard-card-group { + background: #fff; + border-radius: 12px; + box-shadow: 0 2px 12px 0 rgba(0,0,0,0.06); + padding: 24px 32px 16px 32px; +} + +/* 基础分组标题样式 */ +.dashboard-card-title { + font-size: 18px; + font-weight: 600; + margin-bottom: 20px; /* 统一标题下边距 */ + color: #333333; /* 默认标题颜色 */ +} + +/* 统一业绩分组标题样式 - 继承基础并扩展 */ +.dashboard-card-group--today .dashboard-card-title, +.dashboard-card-group--yesterday .dashboard-card-title, +.dashboard-card-group--month .dashboard-card-title { + font-size: 18px; + font-weight: 600; + margin-bottom: 20px; + padding-left: 12px; + position: relative; +} + +/* 业绩分组标题左侧装饰线 */ +.dashboard-card-group--today .dashboard-card-title::before, +.dashboard-card-group--yesterday .dashboard-card-title::before, +.dashboard-card-group--month .dashboard-card-title::before { + content: ''; + position: absolute; + left: 0; + top: 50%; + transform: translateY(-50%); + width: 4px; + height: 18px; /* 调整装饰线高度 */ + border-radius: 2px; +} + +.dashboard-card-group--today .dashboard-card-title { + color: #357ae8; + /* font-size, font-weight, margin-bottom will be inherited from .dashboard-card-title */ +} +.dashboard-card-group--today .dashboard-card-title::before { + background-color: #357ae8; +} + +.dashboard-card-group--yesterday .dashboard-card-title { + color: #f59e0b; /* 昨日标题颜色 - 暖黄色 */ + /* font-size, font-weight, margin-bottom will be inherited */ +} +.dashboard-card-group--yesterday .dashboard-card-title::before { + background-color: #f59e0b; +} + +.dashboard-card-group--month .dashboard-card-title { + color: #10b981; /* 本月标题颜色 - 绿色 */ + /* font-size, font-weight, margin-bottom will be inherited */ +} +.dashboard-card-group--month .dashboard-card-title::before { + background-color: #10b981; + transition: all 0.3s ease; +} + +.dashboard-card-list { + display: flex; + flex-wrap: wrap; + gap: 24px; +} + +.dashboard-card { + flex: 1 1 180px; + min-width: 180px; + background: linear-gradient(135deg, #f6d365 0%, #fda085 100%); + border-radius: 10px; + box-shadow: 0 1px 6px 0 rgba(253,160,133,0.12); + padding: 18px 16px; + display: flex; + flex-direction: column; + align-items: flex-start; + transition: all 0.3s ease; +} +.dashboard-card:hover { + transform: translateY(-3px); + box-shadow: 0 4px 12px 0 rgba(253,160,133,0.2); + /* 会员卡片样式不变 */ +} + +.dashboard-card-label { + font-size: 14px; + color: #666; + margin-bottom: 8px; +} +.dashboard-card-value { + font-size: 28px; + font-weight: bold; + color: #222; +} + +/* 业绩卡片专属基础样式 */ +.dashboard-card--performance { + background: #ffffff; + border: 1px solid #e5e7eb; + border-radius: 8px; + padding: 20px; + flex: 1 1 200px; + min-width: 180px; + display: flex; + flex-direction: column; + justify-content: space-between; + box-shadow: 0 2px 4px rgba(0,0,0,0.04); /* 更精致的阴影 */ + transition: all 0.3s ease-in-out; + position: relative; /* 用于内部绝对定位元素(如有) */ +} + +.dashboard-card--performance:hover { + transform: translateY(-5px); + box-shadow: 0 8px 16px rgba(0,0,0,0.07); +} + +.dashboard-card--performance .dashboard-card-label { + font-size: 14px; /* 标签字号略微增大以保持清晰 */ + color: #4b5563; /* 标签颜色调整,更柔和 */ + margin-bottom: 12px; +} + +.dashboard-card--performance .dashboard-card-value { + font-size: 24px; /* 基础数值字号 */ + font-weight: 700; /* 加粗数值 */ + color: #111827; /* 深色数值,对比度高 */ + display: flex; + align-items: baseline; + justify-content: flex-start; + line-height: 1.2; /* 改善行高 */ +} + +.dashboard-card--performance .dashboard-card-value::after { + /* content: '¥'; */ /* 去掉人民币符号 */ + font-size: 13px; /* 货币符号大小 */ + font-weight: 500; + color: #374151; /* 货币符号颜色 */ + margin-left: 4px; +} + +/* 今日业绩卡片特殊样式 */ +.dashboard-card--today.dashboard-card--performance { + background: linear-gradient(135deg, #a7d7f9 0%, #7fb2eb 100%); /* 更明显的蓝天到海洋蓝渐变 */ + border-left: 5px solid #357ae8; /* 标题蓝色 */ + border-color: transparent; /* 其他边框透明,突出左边框 */ + border-top-right-radius: 8px; + border-bottom-right-radius: 8px; + border-top-left-radius: 0; /* 配合左边框 */ + border-bottom-left-radius: 0; /* 配合左边框 */ +} + +.dashboard-card--today.dashboard-card--performance .dashboard-card-label { + color: #2c5282; /* 深蓝标签,配合主色 */ + font-weight: 500; +} + +.dashboard-card--today.dashboard-card--performance .dashboard-card-value { + color: #1e3a8a; /* 更深的蓝,突出数值 */ + font-size: 28px; /* 今日数值更大 */ +} + +/* 昨日业绩卡片 */ +.dashboard-card--yesterday.dashboard-card--performance { + background: linear-gradient(135deg, #fde68a 0%, #f5c767 100%); /* 更明显的阳光黄到橘黄渐变 */ + border-left: 5px solid #f59e0b; /* 标题黄色 */ + border-color: transparent; + border-top-right-radius: 8px; + border-bottom-right-radius: 8px; + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} +.dashboard-card--yesterday.dashboard-card--performance .dashboard-card-label { + color: #b45309; /* 深黄/橙色标签 */ +} +.dashboard-card--yesterday.dashboard-card--performance .dashboard-card-value { + color: #78350f; /* 深橙/棕色数值 */ +} + +/* 本月业绩卡片 */ +.dashboard-card--month.dashboard-card--performance { + background: linear-gradient(135deg, #a7f3d0 0%, #79d7b5 100%); /* 更明显的薄荷绿到青绿渐变 */ + border-left: 5px solid #10b981; /* 标题绿色 */ + border-color: transparent; + border-top-right-radius: 8px; + border-bottom-right-radius: 8px; + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} +.dashboard-card--month.dashboard-card--performance .dashboard-card-label { + color: #047857; /* 深绿色标签 */ +} +.dashboard-card--month.dashboard-card--performance .dashboard-card-value { + color: #065f46; /* 更深的绿色数值 */ +} + +/* 总计行特定样式 */ +.dashboard-total-row { + display: flex; + gap: 24px; /* 与 .dashboard-card-list 的 gap 保持一致或按需调整 */ + width: 100%; /* 占据整行宽度 */ +} + +.dashboard-total-row .dashboard-card--performance { + flex: 1 1 0; /* 让两个卡片均分空间 */ + /* 覆盖一些基础卡片样式,如果需要更紧凑 */ + min-width: 0; /* 允许卡片收缩 */ +} + +/* 特定对齐调整:确保总金额与金额对齐,总业绩与业绩对齐 */ +/* 由于业绩卡片内部已经是 flex-start,主要依赖卡片宽度和内部padding */ +/* 如果需要更精确的对齐,可能需要对 .dashboard-card-value 和 .dashboard-card-label 进行微调 */ + +.dashboard-card--total-amount .dashboard-card-value, +.dashboard-card--total-achievement .dashboard-card-value { + /* 如果希望文本部分左对齐以模拟效果,可以尝试 */ + /* justify-content: flex-start; */ + /* padding-left: 你可能需要根据实际视觉效果计算一个值 */ +} + +@media (max-width: 900px) { + .dashboard-card-list { + gap: 16px; + } + .dashboard-card, .dashboard-card--performance { + min-width: unset; + width: 100%; + } + .dashboard-card--performance .dashboard-card-value { + font-size: 22px; + } + .dashboard-card--today.dashboard-card--performance .dashboard-card-value { + font-size: 26px; + } +} diff --git a/src/views/dashboard/mixins/top-bar-mixin.js b/src/views/dashboard/mixins/top-bar-mixin.js index 0a4d297..c924cca 100644 --- a/src/views/dashboard/mixins/top-bar-mixin.js +++ b/src/views/dashboard/mixins/top-bar-mixin.js @@ -7,6 +7,10 @@ export default { receiveApprovalNum: '', defaultTabItem: 'dashboard', topList: [ + { + name: '面板', + path: 'summaryDashboard' + }, { name: '代办', path: 'dashboard'