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,6 +8,7 @@ import { MetricCard } from '@/components/MetricCard'
import { formatCurrency, formatNumber, formatPercent } from '@/lib/utils'
import { useState, useMemo } from 'react'
import { PieChart, Pie, Cell, Tooltip, Legend, ResponsiveContainer, BarChart, Bar, XAxis, YAxis, CartesianGrid } from 'recharts'
import { MonthPicker } from '@/components/MonthPicker'
const ABC_COLORS = { 'A-核心': '#22c55e', 'B-成长': '#3b82f6', 'C-长尾': '#ef4444' }
const PAGE_SIZE = 15
@@ -15,10 +16,11 @@ const PAGE_SIZE = 15
export function SKUPage() {
const [abcFilter, setAbcFilter] = useState('')
const [skuPage, setSkuPage] = useState(1)
const [month, setMonth] = useState('2026-04')
const { data: skuData, isLoading: skuLoading } = useQuery({
queryKey: ['sku/abc'],
queryFn: () => api.get('/sku/abc'),
queryKey: ['sku/abc', month],
queryFn: () => api.get('/sku/abc', { params: { month } }),
})
const { data: catData, isLoading: catLoading } = useQuery({
@@ -61,9 +63,12 @@ export function SKUPage() {
return (
<div className="space-y-4">
<div>
<h1 className="text-xl font-bold">SKU管理</h1>
<p className="mt-0.5 text-xs text-muted-foreground">SKU ABC分析 · · · 20264</p>
<div className="flex items-center justify-between">
<div>
<h1 className="text-xl font-bold">SKU管理</h1>
<p className="mt-0.5 text-xs text-muted-foreground">SKU ABC分析 · · · {month}</p>
</div>
<MonthPicker month={month} onChange={setMonth} />
</div>
{/* 概览指标 */}