"use client"; import { useEffect, useState } from "react"; import styles from "../admin.module.css"; type Channel = { id: string; region: string; note: string }; export default function AdminOrdersPage() { const [channels, setChannels] = useState([]); const [upstream, setUpstream] = useState<{ ok: boolean; detail?: string } | null>(null); const [apiBase, setApiBase] = useState(""); const [note, setNote] = useState(""); const [error, setError] = useState(""); useEffect(() => { fetch("/api/admin/orders", { cache: "no-store" }) .then(async (r) => { const j = await r.json(); if (!r.ok) throw new Error(j.error || r.statusText); setChannels(j.channels || []); setUpstream(j.upstream || null); setApiBase(j.apiBase || ""); setNote(j.note || ""); }) .catch((e) => setError(e instanceof Error ? e.message : String(e))); }, []); return ( <>

💳 订单 / 支付

网关 {apiBase || "…"}{" "} {upstream ? ( {upstream.ok ? "健康" : "异常"} {upstream.detail} ) : null}

{error ?

{error}

: null} {note ?

{note}

: null}
{channels.map((c) => (

{c.id}

{c.region}

{c.note}

))}
); }