/** * 客户自助侧页面(第 3 册 6.13 / 6.14)—— 真源=klt-bos。 * * 分账号读写:`POST /sub_account/get_list@v1` + `POST /sub_account/update@v1`; * [实] `/sub_account/*` ⛔ 新增与删除路由 ⇒ 只保留「修改真实姓名」; * 客户身份展示走 `/customer/get@v1`(**自读**,主体号取自会话),⛔ 下发项标「后端未下发」。 * * ⚠️ 本页此前取的是 `/customer/get_list@v1`——那是**运营侧**名录读口(权限键 `bos.customer.list`), * 客户角色本就不该拿到它(2026-11-14「我的套餐/分账号」整页空态的根因)。自读口只要求 * `bos.customer.view`,且行集由后端按主体收窄,客户看不到别家档案。 */ import { useMemo, useState } from "react"; import { PageIntro } from "../components/PageIntro"; import { useNavigate, useParams } from "react-router"; import { FetchError } from "../components/fetchError"; import { PencilLine } from "lucide-react"; import { Button } from "../components/ui/button"; import { Input } from "../components/ui/input"; import { ListPager } from "../components/ListPager"; import { OpsNotice, OpsStatus, OpsTableEmpty } from "../components/OperationsKit"; import { Tri } from "../components/triState"; import { slicePage, useLocalPage } from "../lib/list-paging"; import { useDemoIdentity } from "../lib/demo-session"; import { useProfileOverlay } from "../components/layout/ProfileOverlay"; import { useLoad } from "../lib/useLoad"; import { ApiError } from "../lib/api/http"; import { customerGet, portalPlanBoard, subAccountGetList, subAccountUpdate } from "../lib/api/bos"; import { ACCT_STATUS, PLAN_FAMILY, label } from "../lib/api/labels"; import type { PortalPlanBoardRow, SubAccountRow } from "../lib/api/types"; import { isSeatPlaceholder, seatDisplayName } from "../lib/customer-subaccounts"; import "../styles/operations.css"; const MISSING = "后端未下发"; /** 金额分 → 「¥1,234.56」;`null` 不可用 ⇒ 显「—」(§4.3 列 3 不许拿订阅价顶替)。 */ function money(cents: number | null): string { if (cents === null || !Number.isFinite(cents)) return "—"; return `¥${(cents / 100).toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`; } /** 线路出口列:数组逐项一行,空集 ⇒「—」。 */ function exits(exitsValue: string[] | null) { if (!exitsValue || exitsValue.length === 0) return —; return <>{exitsValue.map((e) =>
企业门户 · 我的套餐
企业门户 · 我的套餐
正在按会话主体号读取当前套餐与往期套餐。
企业门户 · 我的套餐
{customerNo ? `会话主体号 ${customerNo}` : "当前会话未带客户主体号"} 未取到套餐数据,请稍后重试或联系运维核实账号权限。
| 套餐 / 合同 | 运营商 | 总金额 | 方式 | 线路出口 | 期间 | 状态 |
|---|---|---|---|---|---|---|
|
{row.plan_name}
{row.contract_no ?? "—"}
{/* 交付现状摘要(第 9 册 §4.3 行内摘要):台账口径,只读;⛔ 不占列、不开详情口 */}
{row.ip_summary && 在册 {row.ip_summary.live_ip_count} 个 IP · {row.ip_summary.live_account_count} 个在用账号{row.ip_summary.released_ip_count > 0 ? `(已回收 ${row.ip_summary.released_ip_count})` : ""} }
|
{data.party.operator_name ?? |
{money(row.contract_amount_cents)} | {row.plan_family ? label(PLAN_FAMILY, row.plan_family) : "—"} | {exits(row.line_exits)} | {row.start_date ?? "—"} 至 {row.end_date ?? "—"} |
{data.amount_note}
企业门户 · 我的套餐
所属区域:{data.party.region_path ??
企业门户 · 分账号管理
后端不提供分账号新增/删除路由,本页仅支持修改真实姓名。
| 登录名 | 真实姓名 | 状态 | 操作 |
|---|---|---|---|
| {row.username?.trim()
? row.username
: row.status === "not_opened"
? 未开通
: row.status === "stopped"
? 已停用
: |
{seatDisplayName(row)
? <>{seatDisplayName(row)}{isSeatPlaceholder(row) && (席位占位·姓名待填)}>
: row.status === "not_opened"
? 未开通(开通后填写)
: |
修改真实姓名
{error}
}