feat(charge-points): add pricing mode for charge points with validation

feat(pricing): implement tariff management with peak, valley, and flat pricing
feat(api): add tariff API for fetching and updating pricing configurations
feat(tariff-schema): create database schema for tariff configuration
feat(pricing-page): create UI for displaying and managing pricing tiers
fix(sidebar): update sidebar to include pricing settings link
This commit is contained in:
2026-03-12 17:23:06 +08:00
parent 2638af3f7f
commit f7ee298060
17 changed files with 2729 additions and 89 deletions

View File

@@ -11,6 +11,7 @@ import dayjs from "@/lib/dayjs";
import { EvCharger, Plug } from "lucide-react";
import Link from "next/link";
import { IdTagCard } from "@/components/id-tag-card";
import router from "next/router";
// ── Status maps (same as charge-points page) ────────────────────────────────
@@ -333,12 +334,8 @@ function ChargePageContent() {
</div>
</div>
<div className="space-y-2">
<h2 className="text-2xl font-bold text-foreground"></h2>
<p className="text-sm text-muted leading-relaxed">
<br />
</p>
<h2 className="text-2xl font-bold text-foreground"></h2>
<p className="text-sm text-muted leading-relaxed"></p>
</div>
<div className="w-full max-w-xs rounded-2xl border border-border bg-surface p-4 text-left space-y-2">
<div className="flex justify-between text-sm">
@@ -354,10 +351,12 @@ function ChargePageContent() {
<span className="font-mono font-medium text-foreground">{selectedIdTag}</span>
</div>
</div>
<Button size="lg" onPress={resetAll} className="w-full max-w-xs">
<ThunderboltFill className="size-4" />
</Button>
<Link href="/dashboard/transactions" className="w-full max-w-xs">
<Button size="lg" className="w-full">
<ThunderboltFill className="size-4" />
</Button>
</Link>
</div>
);
}
@@ -498,7 +497,9 @@ function ChargePageContent() {
/{cp.connectors.length}
</span>
</span>
{cp.feePerKwh > 0 ? (
{cp.pricingMode === "tou" ? (
<span className="text-sm font-medium text-accent"></span>
) : cp.feePerKwh > 0 ? (
<span className="text-sm font-medium text-foreground">
¥{(cp.feePerKwh / 100).toFixed(2)}
<span className="text-xs text-muted font-normal">/kWh</span>