fix: 修复老板驾驶舱与总部驾驶舱实收数据源不一致

BossPage核心指标行的优惠和实收从/store-expense/overview改为/overview API
- 优惠: ex.total_discount → od.discount
- 实收总额: ex.total_received → od.received
- totalRev(风险门店占比分母)同步改为od.received
现在两个驾驶舱的营业收入/优惠/实收完全一致
This commit is contained in:
freedakgmail
2026-08-11 19:58:22 +08:00
parent 2a3805c44f
commit b2cdf352db
+3 -3
View File
@@ -146,7 +146,7 @@ export function BossPage() {
return acc
}, {})
const totalStores = riskRows.length
const totalRev = Number(ex?.total_received || 0)
const totalRev = Number(od?.received || 0)
// P0/P1门店
const p0Stores = priorityRows.filter((s: any) => s.action_priority?.startsWith('P0'))
@@ -246,8 +246,8 @@ export function BossPage() {
{/* ① 核心经营指标 */}
<div className="grid grid-cols-2 gap-3 md:grid-cols-3 lg:grid-cols-6">
<MetricCard title="营业收入" value={od?.consumption} format="currency" description="全部门店消费金额合计" />
<MetricCard title="优惠" value={ex?.total_discount} format="currency" description="各类优惠扣减合计" />
<MetricCard title="实收总额" value={ex?.total_received} format="currency" trend={trendReceived} description={`全口径${ex?.total_stores}家门店。环比上周 ${trendReceived > 0 ? '↑' : '↓'} ${Math.abs(trendReceived)}%`} />
<MetricCard title="优惠" value={od?.discount} format="currency" description="各类优惠扣减合计" />
<MetricCard title="实收总额" value={od?.received} format="currency" trend={trendReceived} description={`全口径${ex?.total_stores}家门店。环比上周 ${trendReceived > 0 ? '↑' : '↓'} ${Math.abs(trendReceived)}%`} />
<MetricCard title="门店贡献利润估算" value={ex?.actual_net_profit} format="currency" status={Number(ex?.actual_net_margin_pct) < 5 ? 'bad' : Number(ex?.actual_net_margin_pct) < 10 ? 'warn' : 'good'} description={`贡献率 ${formatPercent(ex?.actual_net_margin_pct)}`} />
<MetricCard title="门店数" value={ex?.total_stores} unit="家" description={`盈利 ${ex?.profitable_stores}家 / 亏损 ${ex?.loss_stores}`} />
<MetricCard title="客单价" value={ex?.avg_bill_value} format="currency" trend={trend((last7.length > 0 ? sumKey(last7, 'received') / sumKey(last7, 'bill_count') : 0), (prev7.length > 0 ? sumKey(prev7, 'received') / sumKey(prev7, 'bill_count') : 0))} description={`账单 ${formatNumber(ex?.total_bills)}`} />