"use client"; import { Truck } from "@phosphor-icons/react"; import type { QuoteDetail, QuotePageStatus } from "@/lib/frontend/types"; import { Card } from "@/components/ui/card"; import { Skeleton } from "@/components/ui/skeleton"; import { ErrorBanner } from "@/components/ui/error-banner"; import { WarningBanner } from "@/components/ui/warning-banner"; import { SecondaryButton } from "@/components/ui/primary-button"; import { ConfirmDialog } from "@/components/ui/confirm-dialog"; import { QuoteCard } from "@/components/quote/quote-card"; import { CountdownTimer } from "@/components/quote/countdown-timer"; interface QuoteResultPanelProps { status: QuotePageStatus; quote: QuoteDetail | null; error: string | null; onRetry: () => void; onExpire: () => void; onExpiredConfirm: () => void; /** 轮询阶段提示(如 Priority1 填表较慢) */ processingHint?: string; /** 空闲态副文案 */ idleHint?: string; } const STATUS_LABEL: Partial> = { resolving_address: "正在解析 MotherShip 地址联想…", validating: "正在提交询价请求…", processing: "正在查询报价,请稍候…", }; function LoadingProgressCard({ title, hint, }: { title: string; hint?: string; }) { return (

{title}

{hint ? (

{hint}

) : null}
); } export function QuoteResultPanel({ status, quote, error, onRetry, onExpire, onExpiredConfirm, processingHint, idleHint, }: QuoteResultPanelProps) { if (status === "resolving_address") { return ( ); } if (status === "validating" || status === "processing") { return ( ); } if (status === "error") { return ( 重试 } > {error ?? "暂时无法获取报价,请稍后重试"} ); } if (status === "expired") { return ( <> {quote && } ); } if (status === "manual_followup") { return ( 重新询价 } > {error ?? "表单已提交,站点判定需人工确认细节后报价"} ); } if ((status === "success" || status === "fallback") && quote) { return (
{status === "fallback" && ( 非实时报价,仅供参考(已使用历史缓存降级) )} {quote.valid_until && (
)}
); } return (

填写信息后获取报价

{idleHint ?? "提交后将返回 MotherShip 全部可用运价档位"}

); }