fix(energy): 单价直接取 MAX(cost_price),不重算不返 null
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

之前用 MIN=MAX...ELSE NULL 判定,再 NULLIF 排零,遇到「1 笔 0 元免费单 + 多笔 35 元正价单」
仍可能误判混合,最终页面显示「—」(如佛山豪汇石油加氢站)。

按业务约定:单价就是订单上记录的成本价,不做"统一性"判定,也不返 null。
改用 MAX(b.cost_price):
  - 自然忽略 0 元免费/赠送单(被正价 max 掉)
  - 同价组等于原价
  - 极少数真正混合价组也展示该日付出过的最高单价(仍是订单上的真实数字)

回退类型:HydrogenStationRow.pricePerKg 重新固定为 number。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
kkfluous
2026-04-29 19:56:26 +08:00
parent 3851335843
commit c788dd4577
3 changed files with 8 additions and 8 deletions

View File

@@ -197,9 +197,9 @@ export default function HydrogenDaily() {
>
<span className="text-[12px] text-slate-600 truncate">
{s.name}
<span className="md:hidden text-slate-400 text-[10px]"> · {s.pricePerKg == null ? '—' : s.pricePerKg}</span>
<span className="md:hidden text-slate-400 text-[10px]"> · {s.pricePerKg}</span>
</span>
<span className="hidden md:block text-right text-[12px] text-slate-500 font-bold tabular-nums">{s.pricePerKg == null ? '—' : s.pricePerKg}</span>
<span className="hidden md:block text-right text-[12px] text-slate-500 font-bold tabular-nums">{s.pricePerKg}</span>
<span className="text-right text-[12px] text-slate-700 font-bold tabular-nums">
{s.kg.toLocaleString('zh-CN', { maximumFractionDigits: 2 })}
</span>

View File

@@ -31,7 +31,7 @@ export interface HydrogenRegionShare {
export interface HydrogenStationRow {
name: string;
pricePerKg: number | null;
pricePerKg: number;
kg: number;
chainPct: number;
}