// 彤冠茶莊 website — Checkout const { Button: CkButton, Input: CkInput, Select: CkSelect, Price: CkPrice } = window.TongguanTeaDesignSystem_a1a7a1; function CheckoutPage({ t, lang, products, items, setQty, removeItem, go, clearCart }) { const [placed, setPlaced] = React.useState(false); React.useEffect(() => { if (window.lucide) window.lucide.createIcons(); }); const lines = items.map((it) => ({ ...it, p: products.find((p) => p.id === it.id) })).filter((x) => x.p); const subtotal = lines.reduce((s, l) => s + l.p.price * l.qty, 0); const freeShip = subtotal >= 1500; const ship = freeShip || subtotal === 0 ? 0 : 120; const total = subtotal + ship; if (placed) { return (

{t.checkout.placed}

{t.checkout.placedBody}

go("home")}>{t.product.back === "返回選購" ? "回首頁" : "Home"}
); } if (lines.length === 0) { return (

{t.cart.empty}

go("shop")}>{t.cart.emptyCta}
); } const fieldRow = { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 16 }; return (

{t.checkout.title}

{/* form */}
{ e.preventDefault(); setPlaced(true); clearCart(); window.scrollTo(0, 0); }}>
{t.checkout.contact}
{t.checkout.shippingInfo}
{t.checkout.payment}
{t.checkout.payNote}
{t.checkout.placeOrder} · NT$ {total.toLocaleString("en-US")}
{/* summary */}
); } function Row({ label, children }) { return (
{label} {children}
); } window.CheckoutPage = CheckoutPage;