feat: 全部页面添加 MonthPicker 月份切换

新增 MonthPicker 的页面(6个):
- CostPage: 成本与库存管理
- SKUPage: 商品SKU管理
- PlatformPage: 平台与优惠管理
- MemberPage: 会员与复购管理
- SiteSelectionPage: 门店选址分析
- DataQualityPage: 数据质量看板

容器+子组件添加 MonthPicker(2个页面, 11个子组件):
- StoreExpensePage: 门店营业费用分析(10个子组件全部传month)
- CostAnalysisPage/StoreTab: 门店成本tab

跳过(后端不支持month参数):
- RiskPage: 风险管理(全量视图, 不按月过滤)
- TimePage: 时间段分析(全量视图, 不按月过滤)
This commit is contained in:
freedakgmail
2026-08-01 14:58:12 +08:00
parent 122290e3b0
commit 4b3a48976d
18 changed files with 119 additions and 78 deletions
+10 -5
View File
@@ -8,11 +8,13 @@ import { MetricCard } from '@/components/MetricCard'
import { formatCurrency, formatNumber, formatPercent } from '@/lib/utils'
import { useState, useMemo } from 'react'
import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer, PieChart, Pie, Cell } from 'recharts'
import { MonthPicker } from '@/components/MonthPicker'
const PAGE_SIZE = 15
export function MemberPage() {
const [repeatPage, setRepeatPage] = useState(1)
const [month, setMonth] = useState('2026-04')
const { data: comparisonData, isLoading: cmpLoading } = useQuery({
queryKey: ['member/comparison'],
@@ -20,8 +22,8 @@ export function MemberPage() {
})
const { data: repeatData, isLoading: repeatLoading } = useQuery({
queryKey: ['member/repeat'],
queryFn: () => api.get('/member/repeat'),
queryKey: ['member/repeat', month],
queryFn: () => api.get('/member/repeat', { params: { month } }),
})
const cmpRows = (comparisonData as any)?.data || []
@@ -66,9 +68,12 @@ export function MemberPage() {
return (
<div className="space-y-4">
<div>
<h1 className="text-xl font-bold"></h1>
<p className="mt-0.5 text-xs text-muted-foreground"> · · · 20264</p>
<div className="flex items-center justify-between">
<div>
<h1 className="text-xl font-bold"></h1>
<p className="mt-0.5 text-xs text-muted-foreground"> · · · {month}</p>
</div>
<MonthPicker month={month} onChange={setMonth} />
</div>
{/* 概览指标 */}