import type { HydrogenCustomerRow, HydrogenStationFull } from '../../types';
import { formatKg as fmtKg, formatYuan as fmtYuan } from '../model';
export function StationSummaryTable({ stations }: { stations: HydrogenStationFull[] }) {
return (
<>
{stations.length > 0 && (
加氢站加氢汇总
共 {stations.length} 站
| # |
加氢站 |
加氢量 |
占比 |
氢费收入 |
收入占比 |
{stations.map((s, i) => {
const kgFmt = fmtKg(s.kg);
const revFmt = fmtYuan(s.revenue);
return (
| {i + 1} |
{s.name} |
{kgFmt.value}{kgFmt.unit}
|
{(s.share * 100).toFixed(1)}%
|
¥{revFmt.value}{revFmt.unit}
|
{(s.revenueShare * 100).toFixed(1)}%
|
);
})}
)}
>
);
}
export function CustomerSummaryTable({ customers }: { customers: HydrogenCustomerRow[] }) {
return (
<>
{customers.length > 0 && (
客户账单汇总
Top {customers.length}
| # |
客户 |
承担方 |
加氢量 |
成本支出 |
应收 |
{customers.map((c2, i) => {
const kgFmt = fmtKg(c2.kg);
const costFmt = fmtYuan(c2.cost);
const revFmt = fmtYuan(c2.revenue);
return (
| {i + 1} |
{c2.name} |
{c2.payer === 'lingniu' ? (
羚牛
) : (
客户
)}
|
{kgFmt.value}{kgFmt.unit}
|
¥{costFmt.value}{costFmt.unit}
|
¥{revFmt.value}{revFmt.unit}
|
);
})}
)}
>
);
}