fix: 修复利润机会池播报文案口径错误和承诺值硬编码

问题1(口径错误):
- BusinessReportDialog 用整体贡献率(10.96%)对比标准门店贡献率目标(10%)
- 10.96%→10% 是下降不是提升,逻辑矛盾
- 移除错误的贡献率对比,与 BossPage 口径一致

问题2(承诺值硬编码):
- "30天承诺值≥150万元" 硬编码,但 totalOpportunity 仅15.3万,差10倍
- 改为动态计算:承诺值 = 理论月度机会 × 80%(考虑项目重叠和促销弹性)
- 同步修复 BossPage.tsx 中相同问题

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
selfrelease
2026-08-13 14:31:42 +08:00
parent 7ea6a2515f
commit 85b58c53b1
2 changed files with 7 additions and 5 deletions
@@ -50,13 +50,16 @@ export function BusinessReportDialog({ open, onClose, data }: BusinessReportDial
const expenseRate = wf ? (Number(wf.total_expense) / Number(wf.received) * 100) : 0
const contributionRate = wf ? (Number(wf.store_contribution) / Number(wf.received) * 100) : 0
// 30天承诺值:取理论月度机会的80%(考虑项目重叠和促销弹性),不低于0
const commitValue = Math.max(Math.round(totalOpp * 0.8), 0)
const otherStores = (ex?.total_stores || 0) - (ex?.profitable_stores || 0) - (ex?.loss_stores || 0)
const reportText = `本月经营态势报告,${data.month}月。
一、整体经营。营业收入${formatCurrency(ex?.total_consumption)},优惠${formatCurrency(ex?.total_discount)},实收总额${formatCurrency(ex?.total_received)},环比上周${data.trendReceived > 0 ? '增长' : '下降'}${Math.abs(data.trendReceived)}%。门店共${ex?.total_stores}家,其中盈利${ex?.profitable_stores}家,亏损${ex?.loss_stores}${otherStores > 0 ? `,待确认${otherStores}` : ''}。客单价${formatCurrency(ex?.avg_bill_value)},账单${ex?.total_bills}笔。门店贡献利润${formatCurrency(ex?.actual_net_profit)},贡献率${formatPercent(profitMargin)}
二、成本费用。食材成本率${formatPercent(foodCostRate)},建议低于32%。费用率${formatPercent(expenseRate)},建议低于40%。贡献率${formatPercent(contributionRate)},建议高于10%。食材成本超耗严重${costOv.red_count || 0}家,明显超耗${costOv.orange_count || 0}家,基本正常${costOv.green_count || 0}家,总差异金额${formatCurrency(costOv.total_variance)}
三、风险态势。红色门店${riskSummary['红色'] || 0}家,黄色门店${riskSummary['黄色'] || 0}家,绿色门店${riskSummary['绿色'] || 0}家。重点整改门店P0级${p0Stores.length}家,P1级${p1Stores.length}家。
四、利润机会。理论月度机会合计${formatCurrency(totalOpp)},涉及${profitOpp.length}个改善方向。30天承诺值大于等于150万元,目标将门店贡献率从${formatPercent(profitMargin)}提升至约10%`
四、利润机会。理论月度机会合计${formatCurrency(totalOpp)},涉及${profitOpp.length}个改善方向。考虑项目重叠和促销弹性,30天经营承诺值大于等于${formatCurrency(commitValue)}`
const handleTTS = async () => {
if (isPlaying) {
@@ -223,7 +226,7 @@ export function BusinessReportDialog({ open, onClose, data }: BusinessReportDial
<section>
<h3 className="mb-1 text-sm font-bold text-purple-700"></h3>
<p className="text-xs leading-relaxed">
<strong className="text-purple-600">{formatCurrency(totalOpp)}</strong> <strong>{profitOpp.length}</strong> 30 <strong className="text-purple-600"> 150 </strong> <strong>{formatPercent(profitMargin)}</strong> <strong>10%</strong>
<strong className="text-purple-600">{formatCurrency(totalOpp)}</strong> <strong>{profitOpp.length}</strong> 30 <strong className="text-purple-600"> {formatCurrency(commitValue)}</strong>
</p>
</section>
</div>
+2 -3
View File
@@ -324,7 +324,7 @@ export function BossPage() {
{/* ②b 利润机会池 */}
{profitOpp.length > 0 && (
<CollapsibleSection title="利润机会池" subtitle={`理论月度机会合计 ${formatCurrency(totalOpportunity)} · 30天承诺值 ≥ 150万元 · 点击展开详情`}>
<CollapsibleSection title="利润机会池" subtitle={`理论月度机会合计 ${formatCurrency(totalOpportunity)} · 30天承诺值 ≥ ${formatCurrency(Math.max(Math.round(totalOpportunity * 0.8), 0))} · 点击展开详情`}>
<div className="space-y-2">
{[...profitOpp].sort((a: any, b: any) => Number(b.opportunity || 0) - Number(a.opportunity || 0)).map((o: any, i: number) => {
const opp = Number(o.opportunity || 0)
@@ -341,8 +341,7 @@ export function BossPage() {
<span className="text-sm font-medium">30</span>
</div>
<p className="mt-1 text-xs text-muted-foreground">
{formatCurrency(totalOpportunity)} <span className="font-bold text-purple-600"> 150</span>
7.29% 10%
{formatCurrency(totalOpportunity)} <span className="font-bold text-purple-600"> {formatCurrency(Math.max(Math.round(totalOpportunity * 0.8), 0))}</span>
</p>
</div>
</CollapsibleSection>