| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- import { useBusinessView } from "../lib/use-business-view";
- import { useState } from "react";
- import { FetchError } from "../components/fetchError";
- import { ArrowLeft, ArrowRight, CalendarPlus, Layers3, RefreshCw } from "lucide-react";
- import { Link, useLocation, useParams } from "react-router";
- import { OpsMore, OpsNotice, OpsStatus } from "../components/OperationsKit";
- import { OrderEditor, StackEditor } from "../components/OrderChangeDialogs";
- import { Tri } from "../components/triState";
- import { getBillableStartDate } from "../domain/order-dates";
- import { contractRawByParam, contractStatusOf } from "../lib/contract-demo";
- import { orderView, useAllOrders } from "../lib/order-demo";
- import { bandwidthTextOfRow, moneyCell, useCatalogPlans } from "../lib/package-catalog";
- import { rowsOf, customerGet, subAccountGetList } from "../lib/api/bos";
- import { ticketList, statusLabel, typeLabel } from "../lib/api/ticket";
- import { fmtDate } from "../lib/ticket";
- import { ACCT_STATUS, SUBJECT_TYPE, label, USE_CATEGORY } from "../lib/api/labels";
- import { regionMountPath } from "../lib/organization-demo";
- import { WORD_FETCH_FAILED, WORD_UNCONFIGURED } from "../lib/api/lockedCopy";
- import { useLoad } from "../lib/useLoad";
- import { detailBack, detailLinkState } from "../lib/detail-navigation";
- import "../styles/order-record.css";
- const statusTone = (status: string) => status === "生效中" || status === "在用" ? "success" : status === "停用" ? "danger" : status === "待生效" || status === "未开通" ? "warning" : "neutral";
- /** 三态文本格:键缺失=取数失败,null=未配置,⛔ 用 0/「—」冒充有值。 */
- function cell(value: string | null | undefined, missing: string = WORD_UNCONFIGURED) {
- if (value === undefined) return <Tri tone="fail" text={WORD_FETCH_FAILED} />;
- if (value === null || value === "") return <Tri tone="missing" text={missing} />;
- return value;
- }
- const moneyCellView = (c: { tone: "val" | "missing" | "fail"; text: string }) =>
- (c.tone === "val" ? <strong>{c.text}</strong> : <Tri tone={c.tone} text={c.text} />);
- /** 第6册「出账与对账」后端未提供任何接口:整块按未配置呈现,⛔ 以 0 元/0 期兜底。 */
- const billingMissing = (what: string) => <Tri tone="missing" text={WORD_UNCONFIGURED} title={`${what}属第 6 册出账与对账口径,后端未提供接口`} />;
- export function OrderRecordPage() {
- // 本页不直接读组织集合:工单口径的 `scopedTeamTickets` 所需团队名单由 `useBusinessView` 按身份补齐。
- const view = useBusinessView([]);
- const { id } = useParams();
- const param = decodeURIComponent(id ?? "");
- const location = useLocation();
- const back = detailBack(location.state, view.customerView ? "/workspace/plan" : view.readOnly ? "/customers" : "/orders", view.customerView ? "返回我的套餐" : view.readOnly ? `返回${view.customerListTitle}` : "返回全部订阅");
- const outgoingState = detailLinkState(location.pathname, location.state);
- /** 台账与详情同源取数:数据范围由服务端裁剪,⛔ 在此再按身份/客户过滤。 */
- const orders = useAllOrders();
- const all = orders.data === undefined ? [] : rowsOf(orders.data).map(orderView);
- const item = all.find((record) => record.no === param);
- const catalog = useCatalogPlans();
- const plan = item?.planId ? rowsOf(catalog.data?.items).find((record) => record.plan_id === item.planId) : undefined;
- const contractId = item?.contractId ?? "";
- const contract = useLoad(async () => (contractId ? await contractRawByParam(contractId) : null), [contractId]);
- /**
- * ④-A(2026-11-14):客户档案真源=`POST /customer/get@v1`,分账号计数=`/sub_account/get_list@v1`。
- *
- * 此前本节从 `view.customers`(浏览器演示存储 `oss-customer-records-v1`)反查客户,而真实登录态下
- * 那份存储是空的 ⇒ `customer` 恒 undefined ⇒ 页头「发起服务停用」对任何运营角色都不渲染
- * (P-50 FAIL:接口层早已打通,界面层从未可达),主体类型/识别号/账户状态也一律显示「未登记」。
- * 档案取数失败⛔ 熄灭写入口(判据只看订阅行自带的 `customer_id`),只在展示格标取数失败。
- */
- const customerId = item?.customerId ?? "";
- const cust = useLoad(() => (customerId ? customerGet({ customer_id: customerId }) : Promise.resolve(null)), [customerId]);
- const accounts = useLoad(() => (customerId ? subAccountGetList({ customer_id: customerId, page: 0, page_size: 200 }) : Promise.resolve(null)), [customerId]);
- /**
- * 关联工单(P3-D6):改读 `/ticket/list@v1` 的 `subscription_id` 过滤键。
- *
- * 旧口径从浏览器演示存储 `oss-work-order-records-v2` 里按 `orderId` 过滤——真实登录态里
- * 那份存储是空的 ⇒ 「关联工单(0 张)」常驻,即便开户工单已经落在 `ops_work_order`。
- * 现在按本条订单号现查服务端台账(可见性由服务端裁剪,⛔ 前端再按身份过滤)。
- */
- const relatedTickets = useLoad(
- () => (item?.no ? ticketList({ subscription_id: item.no, page: 0, page_size: 20 }) : Promise.resolve(null)),
- [item?.no],
- );
- /** 升降配/叠加:本条订阅就地办理(判据同全部订阅页=生效中且非只读身份),⛔ 再跳一次列表页。 */
- const [changeOpen, setChangeOpen] = useState(false);
- const [stackOpen, setStackOpen] = useState(false);
- const [notice, setNotice] = useState("");
- if (orders.loading) return <section className="order-record">
- <Link className="order-record-back" to={back.to} state={back.state}><ArrowLeft size={16} />{back.label}</Link>
- <div className="order-record-empty"><h1>正在从订阅接口读取订阅记录…</h1></div>
- </section>;
- if (orders.error) return <section className="order-record">
- <Link className="order-record-back" to={back.to} state={back.state}><ArrowLeft size={16} />{back.label}</Link>
- <div className="order-record-empty"><h1>订阅记录取数失败</h1><FetchError message={orders.error.message} onRetry={orders.reload} /></div>
- </section>;
- if (!item) return <section className="order-record">
- <Link className="order-record-back" to={back.to} state={back.state}><ArrowLeft size={16} />{back.label}</Link>
- <div className="order-record-empty"><h1>订阅不存在或不在当前负责范围</h1><p>该记录可能已被删除,或订阅编号已变更。</p></div>
- </section>;
- const contractRow = contract.data;
- const contractState = contractRow ? contractStatusOf(contractRow.start_date ?? "", contractRow.end_date ?? "") : undefined;
- const siblings = all.filter((record) => record.contractId && record.contractId === item.contractId && record.no !== item.no);
- const billableStart = item.start ? getBillableStartDate(item.start, item.openedOn ?? null) : null;
- const allCustomerSubs = all.filter((record) => record.customerId === item.customerId);
- /** 客户档案行(`/customer/get@v1.customer`):取数中/取数失败时由 `custCell` 承接三态。 */
- const custRow = cust.data?.customer;
- const accountRows = accounts.data?.items ?? [];
- const custCell = (what: string) => cust.loading
- ? <Tri tone="missing" text="读取中…" title={`客户档案(${what})读取中`} />
- : cust.error
- ? <Tri tone="fail" text={WORD_FETCH_FAILED} title={`客户档案取数失败:${cust.error.message}`} />
- : <Tri tone="missing" text={WORD_UNCONFIGURED} title={`客户档案未回该键(${what})`} />;
- /** 档案已取到则显示真值(空值按 `empty` 说明),未取到一律走三态,⛔ 冒充「未登记」。 */
- const custText = (value: string | null | undefined, empty: string, what: string) => (custRow ? value || empty : custCell(what));
- /**
- * 契约里 `CustomerDetail.region_mounts` 是必有键,`/customer/get@v1` 实测确实下发
- * (2026-11-14 复核更正:此前"15 个键里没有它"是取错了接口所致)⇒ 键缺失才按「接口未回」显示,
- * ⛔ 说成「未挂载区域」。区域名走 [`regionMountPath`](../lib/organization-demo):优先后端下发的
- * `path_name`,区域树只下发省级两层、挂载点常在市/区县层,光靠树查会显示「—」。
- */
- const regionMounts = cust.data?.region_mounts;
- const regionText = regionMounts === undefined
- ? custCell("所属区域")
- : regionMounts.length === 0
- ? "未挂载区域"
- : `${regionMountPath(view.organization, regionMounts[0]) || custCell("所属区域")}${regionMounts.length > 1 ? ` 等 ${regionMounts.length} 个挂载点` : ""}`;
- /** 客户视图的工单可见性由服务端裁剪;本页只按订单号现查(见上方 `relatedTickets`)。 */
- const ticketRows = relatedTickets.data?.rows ?? [];
- /** 可否编辑取后端下发的 `editable`,⛔ 前端按状态/角色自行推导。 */
- const editable = item.editable === true;
- const editReason = item.editable === undefined ? "写口可见性未随记录下发,按只读呈现。" : item.editable ? "服务端判定可写;已开通计费的订阅请新增替换订阅,不改写本条。" : "服务端判定本条只读。";
- const bandwidth = plan ? bandwidthTextOfRow(plan) : null;
- const catalogMatches = plan !== undefined && plan.annual_price_cents === item.row.annual_price_cents && plan.monthly_settle_cents === item.row.monthly_settle_cents;
- const orderKind = item.categoryLabel === "叠加增值" ? "叠加" : "正式";
- const catalogMode = item.categoryLabel === "叠加增值" ? "可叠加" : item.categoryLabel === "定制化" ? "单独约定" : "可升降配";
- return <article className="order-record">
- <Link className="order-record-back" to={back.to} state={back.state}><ArrowLeft size={16} />{back.label}</Link>
- <header className="order-record-header">
- <div className="order-record-symbol"><Layers3 size={28} /></div>
- <div className="order-record-heading">
- <div className="order-record-eyebrow">SUBSCRIPTION / {item.no || WORD_FETCH_FAILED}</div>
- <h1>{view.customerView ? "套餐详情" : "订阅详情"}</h1>
- <p className="order-record-subtitle"><strong>{cell(item.planName)}</strong><span>{cell(item.customer)}</span><span>合同 {cell(item.contractNo)}</span><span>订阅 {cell(item.orderNo, "无运营商订单号")}</span><span>第 {all.indexOf(item) + 1} 号订阅</span></p>
- <div className="order-record-pills"><span className="order-record-kind">{orderKind}订阅</span><span className="order-record-kind">{item.planKindLabel === undefined || item.planKindLabel === null ? (item.planKindLabel === undefined ? WORD_FETCH_FAILED : WORD_UNCONFIGURED) : item.planKindLabel}</span>{item.statusLabel ? <OpsStatus tone={statusTone(item.statusLabel)}>{item.statusLabel}</OpsStatus> : <Tri tone="fail" text={WORD_FETCH_FAILED} title="订阅状态编码未下发" />}</div>
- </div>
- {/* ⑦(2026-11-16):升降配/叠加收进页头「更多」——单笔替换的办理点在详情页,
- 「全部订阅」(`/orders`)已按需求 5.2 收敛为只读查询、⛔ 再挂写入口。
- 只对「生效中」且非只读身份挂出;原「套餐订阅管理」跳转一并下线(变更不必离页)。 */}
- {!view.readOnly && !view.customerView && item.statusLabel === "生效中" && <div className="order-record-actions">
- <OpsMore label="更多" items={[
- { label: "升降配", icon: <RefreshCw size={15} />, title: "新建替换订阅,原订阅保留为历史记录", onSelect: () => setChangeOpen(true) },
- { label: "叠加", icon: <CalendarPlus size={15} />, title: "只改本条订阅的服务结束日期", onSelect: () => setStackOpen(true) },
- ]} />
- </div>}
- {/* ④-A:入口判据=订阅行自带的 `customer_id`(服务端真源)+ 运营侧角色;
- 「仅在用客户/有无生效中订阅/有无在途停机单」交服务端裁决,⛔ 在此读演示存储预判。 */}
- {!view.readOnly && item.customerId && <CustomerServiceStopAction customerId={item.customerId} customerName={custRow?.customer_name ?? item.customer} orderId={item.no} orderLabel={item.statusLabel} />}
- </header>
- <section className="order-record-metrics" data-customer-view={view.customerView || undefined} aria-label="订阅与结算概览">
- <div><span>年订阅价格</span><strong>{item.annual.tone === "val" ? item.annual.text : <Tri tone={item.annual.tone} text={item.annual.text} title="金额取数失败=接口未下发该键;未配置=后端明确回 null" />}</strong><small>本条订阅的冻结价格</small></div>
- <div><span>月结算标准</span><strong>{item.settle.tone === "val" ? item.settle.text : <Tri tone={item.settle.tone} text={item.settle.text} />}</strong><small>首末月按在网天数折算</small></div>
- {!view.customerView && <>
- <div><span>应收合计</span><strong>{billingMissing("应收合计")}</strong><small>出账与对账接口未提供</small></div>
- <div><span>已出账金额</span><strong>{billingMissing("已出账金额")}</strong><small>出账与对账接口未提供</small></div>
- <div><span>未出账金额</span><strong>{billingMissing("未出账金额")}</strong><small>出账与对账接口未提供</small></div>
- {!view.readOnly && <div><span>累计成本</span><strong>{item.cost.tone === "val" ? item.cost.text : <Tri tone={item.cost.tone} text={item.cost.text} title="月成本取套餐成本项三态;合计需逐期成本快照,接口未提供" />}</strong><small>仅当前月成本快照,逐期合计未接线</small></div>}
- </>}
- {view.customerView && <><div><span>分账号额度</span><strong>{item.quotaSlots === undefined ? <Tri tone="fail" text={WORD_FETCH_FAILED} /> : item.quotaSlots === null ? <Tri tone="missing" text={WORD_UNCONFIGURED} /> : item.quotaSlots}</strong><small>本条订阅约定额度</small></div><div><span>总带宽</span><strong>{bandwidth ? (bandwidth.tone === "val" ? bandwidth.text : <Tri tone={bandwidth.tone} text={bandwidth.text} />) : <Tri tone="missing" text={WORD_UNCONFIGURED} title="订阅记录未下发带宽规格,目录档位亦未取到" />}</strong><small>取目录档位规格</small></div></>}
- </section>
- <section className="order-record-section" aria-labelledby="order-service-title">
- <div className="order-record-section-title"><h2 id="order-service-title">本条订阅</h2></div>
- <div className="order-record-detail-wrap"><table className="order-record-detail"><tbody>
- <tr><th scope="row">套餐档</th><td>{cell(item.planName)}{plan ? <span className="order-record-inline-note"> · {label(USE_CATEGORY, plan.use_category) || "用途未填"} · 目录年价 {moneyCell(plan.annual_price_cents).text} / 月标准 {moneyCell(plan.monthly_settle_cents).text} · 额度 {plan.sub_account_quota ?? WORD_UNCONFIGURED}</span> : <span className="order-record-inline-note"> · {catalog.error ? `目录档位取数失败:${catalog.error.message}` : "目录档位未取到,本条按冻结价继续计费"}</span>}</td></tr>
- <tr><th scope="row">冻结价格</th><td>年订阅价格 {moneyCellView(item.annual)} · 月结算标准 {moneyCellView(item.settle)}<span className="order-record-inline-note">({plan ? catalogMatches ? "与当前目录价一致" : "与当前目录价不同,以本条冻结值为准" : "目录档位未取到,以本条冻结值为准"})</span></td></tr>
- <tr><th scope="row">订阅方式</th><td>{item.modeLabel || WORD_UNCONFIGURED}<span className="order-record-inline-note"> · 该用途分类({item.categoryLabel || WORD_UNCONFIGURED}){catalogMode}</span>{item.original && <> · 替换 <Link to={`/orders/${encodeURIComponent(item.original.subscription_id)}`} state={outgoingState}>{item.original.subscription_id}</Link></>}{item.replacedBy && <> · 已被 <Link to={`/orders/${encodeURIComponent(item.replacedBy.subscription_id)}`} state={outgoingState}>{item.replacedBy.subscription_id}</Link> 替换</>}</td></tr>
- <tr><th scope="row">订阅状态</th><td>{item.statusLabel ? <OpsStatus tone={statusTone(item.statusLabel)}>{item.statusLabel}</OpsStatus> : <Tri tone="fail" text={WORD_FETCH_FAILED} />}{item.reason && <span className="order-record-inline-note"> · 办理说明:{item.reason}</span>}</td></tr>
- <tr><th scope="row">起止时间</th><td>{cell(item.start)} 至 {cell(item.end)}<span className="order-record-inline-note"> · 应收从实际开通日与合同生效日的较晚者起算{billableStart ? `(${billableStart})` : "(尚未开通)"}</span></td></tr>
- {item.trialMonths ? <tr><th scope="row">试用优惠</th><td>{item.trialMonths} 个月 · {item.trialDiscount === undefined ? <Tri tone="fail" text={WORD_FETCH_FAILED} /> : item.trialDiscount === null ? "优惠金额未填写" : `${moneyCell(item.trialDiscount).text} / 月`}</td></tr> : null}
- <tr><th scope="row">线路出口</th><td>{item.exits === undefined ? <Tri tone="fail" text={WORD_FETCH_FAILED} /> : item.exits === null ? <Tri tone="missing" text={WORD_UNCONFIGURED} /> : item.exits.length ? item.exits.join("、") : <Tri tone="missing" text={WORD_UNCONFIGURED} />}<span className="order-record-inline-note"> · 随合同服务构成条目带出,保存时冻结</span></td></tr>
- <tr><th scope="row">合同编号</th><td>{cell(item.contractNo)}{contract.error ? <span className="order-record-inline-note">(合同记录取数失败:{contract.error.message})</span> : contract.loading ? <span className="order-record-inline-note">(正在读取合同…)</span> : contractRow ? <> · {contractRow.start_date ?? WORD_UNCONFIGURED} 至 {contractRow.end_date ?? WORD_UNCONFIGURED} · 合同状态 {contractState ?? WORD_UNCONFIGURED} · 合同总额 {moneyCell(contractRow.amount_cents).text} <Link to={`/contracts/${encodeURIComponent(contractRow.contract_id)}`} state={outgoingState}>查看合同 <ArrowRight size={14} /></Link></> : <span className="order-record-inline-note">(合同记录不存在或未下发 contract_id)</span>}</td></tr>
- <tr><th scope="row">订单号</th><td>{cell(item.orderNo, "无运营商订单号")}<span className="order-record-inline-note"> · 保存时从合同外部单号冻结;订阅写入方在第4册{!view.readOnly && item.orderNo && <> · <Link to={`/orders?order=${encodeURIComponent(item.orderNo)}`}>按该单查询</Link></>}</span></td></tr>
- <tr><th scope="row">实际开通日</th><td>{item.openedOn === undefined ? <Tri tone="fail" text={WORD_FETCH_FAILED} /> : item.openedOn ? item.openedOn : <Tri tone="missing" text="未开通" />}<span className="order-record-inline-note"> · 由运维回填,本册只读</span></td></tr>
- <tr><th scope="row">可否编辑</th><td><OpsStatus tone={item.editable === undefined ? "neutral" : editable ? "success" : "neutral"}>{item.editable === undefined ? "未知" : editable ? "可编辑" : "只读"}</OpsStatus><span className="order-record-inline-note"> · {editReason}</span>{editable && <> · <Link to={`/customers/${encodeURIComponent(item.customerId)}/orders`} state={outgoingState}>前往办理 <ArrowRight size={14} /></Link></>}</td></tr>
- </tbody></table></div>
- <p className="order-record-note">订阅是计费与开通的最小单位。价格与线路出口在保存时冻结;续订、升降配与叠加均新增记录,原订阅保留。本条订阅的升降配/叠加在页头「更多」办理,新增订阅在「客户管理 → 套餐订阅」办理。</p>
- </section>
- {siblings.length > 0 && <section className="order-record-section" aria-labelledby="order-related-title">
- <div className="order-record-section-title"><h2 id="order-related-title">关联订阅(同一合同的其他订阅 {siblings.length} 份)</h2></div>
- <div className="order-record-table-wrap"><table><thead><tr><th>序号</th><th>套餐 / 用途</th><th>方式</th><th>订阅状态</th><th>期间</th><th>订阅价格</th><th>月标准</th><th>实际开通日</th></tr></thead><tbody>{siblings.map((sibling) => <tr key={sibling.no}><td><Link to={`/orders/${encodeURIComponent(sibling.no)}`} state={outgoingState}>{all.indexOf(sibling) + 1}<ArrowRight size={14} /></Link></td><td>{cell(sibling.planName)}</td><td>{sibling.categoryLabel === "叠加增值" ? "叠加" : "正式"}</td><td>{sibling.statusLabel ? <OpsStatus tone={statusTone(sibling.statusLabel)}>{sibling.statusLabel}</OpsStatus> : <Tri tone="fail" text={WORD_FETCH_FAILED} />}</td><td>{cell(sibling.start)} 至 {cell(sibling.end)}</td><td>{sibling.annual.tone === "val" ? sibling.annual.text : <Tri tone={sibling.annual.tone} text={sibling.annual.text} />}</td><td>{sibling.settle.tone === "val" ? sibling.settle.text : <Tri tone={sibling.settle.tone} text={sibling.settle.text} />}</td><td>{sibling.openedOn === undefined ? <Tri tone="fail" text={WORD_FETCH_FAILED} /> : sibling.openedOn || <Tri tone="missing" text="未开通" />}</td></tr>)}</tbody></table></div>
- <p className="order-record-note">这些订阅与本条引用同一份合同{item.orderNo ? `(订单号 ${item.orderNo})` : ""}。合同中每条服务构成条目分别形成订阅,各自冻结价格、计费与开通;点击序号查看详情。</p>
- </section>}
- {!view.customerView && <section className="order-record-section" aria-labelledby="order-billing-title">
- <div className="order-record-section-title"><h2 id="order-billing-title">计费与出账</h2></div>
- <p className="order-record-empty-note">{WORD_UNCONFIGURED}——应收期次、出账状态与成本快照属第 6 册出账与对账口径,后端未提供接口,此处不以 0 元或 0 期兜底。</p>
- <p className="order-record-note">一条应收结算记录对应本条订阅的一个自然月,首末月按在网天数折算;出账状态取决于覆盖该期的对账批次。接口接入后再按期列示。</p>
- </section>}
- {!view.identity || !["partner", "operator"].includes(view.identity.role) && <section className="order-record-section" aria-labelledby="order-tickets-title">
- <div className="order-record-section-title"><h2 id="order-tickets-title">关联工单({relatedTickets.loading ? "…" : ticketRows.length} 张)</h2></div>
- {relatedTickets.loading ? <p className="order-record-empty-note">正在按订单号读取工单台账…</p>
- : relatedTickets.error ? <p className="order-record-empty-note"><Tri tone="fail" text={WORD_FETCH_FAILED} title={relatedTickets.error.message} /> 工单台账取数失败,不得把「查不了」渲染成「0 张」。</p>
- : ticketRows.length ? <div className="order-record-table-wrap"><table><thead><tr><th>我方工单号</th><th>类型</th><th>状态</th><th>创建日</th><th>完成日</th></tr></thead><tbody>{ticketRows.map((ticket) => <tr key={ticket.ticket_id}><td><Link to={`/work-orders/${encodeURIComponent(ticket.ticket_id)}`} state={{ from: `/orders/${encodeURIComponent(item.no)}` }}>{ticket.ticket_no ?? ticket.ticket_id}<ArrowRight size={14} /></Link></td><td>{typeLabel(ticket.ticket_type)}</td><td><OpsStatus tone={ticket.status === "completed" || ticket.status === "settled" ? "success" : ticket.status === "processing" || ticket.status === "pending" ? "warning" : "neutral"}>{statusLabel(ticket.status)}</OpsStatus></td><td>{fmtDate(ticket.created_at)}</td><td>{fmtDate(ticket.completed_at)}</td></tr>)}</tbody></table></div> : <p className="order-record-empty-note">本条订阅暂无关联工单(按订单号现查 <code>/ticket/list@v1</code>,服务端可见范围内为空)。</p>}
- <p className="order-record-note">订阅保存后,未开户走开户工单,已在用走服务开通工单;运维回填的实际开通日写回本条订阅。点击工单号查看详情。</p>
- </section>}
- <section className="order-record-section" aria-labelledby="order-files-title">
- <div className="order-record-section-title"><h2 id="order-files-title">合同文件(随本条订阅留档)</h2></div>
- <p className="order-record-empty-note">{WORD_UNCONFIGURED}——订阅记录未下发文件字段,合同扫描件只随合同记录留档{contractRow ? <>,可在上方「查看合同」中查看</> : "。"}</p>
- <p className="order-record-note">合同文件挂在订阅上,仅保存文档名与存储键,不解析正文;后端未提供上传与私有桶下载接口。</p>
- </section>
- {!view.customerView && <section className="order-record-section" aria-labelledby="order-customer-title">
- <div className="order-record-section-title"><h2 id="order-customer-title">相关客户主体</h2><Link className="ops-card-link" to={`/customers/${encodeURIComponent(item.customerId)}`} state={outgoingState}>客户档案 <ArrowRight size={14} /></Link></div>
- <p className="order-record-section-intro">下面是本条订阅所属客户的主体信息;归属变更、主账号与全部分账号请到客户档案查看。</p>
- <div className="order-record-detail-wrap"><table className="order-record-detail"><tbody>
- <tr><th scope="row">客户主体</th><td>{item.customerId || WORD_UNCONFIGURED} · {cell(custRow?.customer_name ?? item.customer)}({custRow ? label(SUBJECT_TYPE, custRow.subject_type) : custCell("主体类型")} · 识别号 {custText(custRow?.identity_no_masked, "未登记", "识别号")})</td></tr>
- <tr><th scope="row">账户状态</th><td>{custRow ? <OpsStatus tone={statusTone(label(ACCT_STATUS, custRow.acct_status))}>{label(ACCT_STATUS, custRow.acct_status)}</OpsStatus> : custCell("账户状态")}<span className="order-record-inline-note"> · 所属区域 {regionText} · 运营商 {custText(custRow?.operator_name, "未关联", "运营商")} / 合伙人 {custText(custRow?.partner_name, "无", "合伙人")}</span></td></tr>
- <tr><th scope="row">经办联系人</th><td>{custText(custRow?.contact_name, "未填", "经办联系人")} / {custText(custRow?.contact_mobile, "未填", "经办联系电话")}<span className="order-record-inline-note"> · 地址 {custText(custRow?.address, "未填", "装机地址")}</span></td></tr>
- <tr><th scope="row">分账号</th><td>{accounts.error ? <Tri tone="fail" text={WORD_FETCH_FAILED} title={`分账号取数失败:${accounts.error.message}`} /> : accounts.loading ? <Tri tone="missing" text="读取中…" title="分账号读取中" /> : <>共 {accounts.data?.total ?? 0} 个 / 额度 {custText(custRow?.quota_cents, WORD_UNCONFIGURED, "分账号额度")} · 在用 {accountRows.filter((row) => row.status === "in_use").length}<span className="order-record-inline-note"> · 本条订阅计入额度 {item.quotaSlots === undefined ? WORD_FETCH_FAILED : item.quotaSlots === null ? WORD_UNCONFIGURED : item.quotaSlots}(未到期订阅按档位额度累加)</span></>}</td></tr>
- <tr><th scope="row">该客户订阅</th><td>共 {allCustomerSubs.length} 份,其中生效中 {allCustomerSubs.filter((record) => record.statusLabel === "生效中").length} 份</td></tr>
- </tbody></table></div>
- </section>}
- {notice && <OpsNotice message={notice} onClose={() => setNotice("")} />}
- {changeOpen && <OrderEditor key={`updown-${item.no}`} customerId={item.customerId} customerName={custRow?.customer_name ?? item.customer} context={{ mode: "updown", record: item }} onClose={() => setChangeOpen(false)} onSaved={(message) => { setChangeOpen(false); setNotice(message); orders.reload(); }} />}
- {stackOpen && <StackEditor record={item} customerName={custRow?.customer_name ?? item.customer} onClose={() => setStackOpen(false)} onSaved={(message) => { setStackOpen(false); setNotice(message); orders.reload(); }} />}
- </article>;
- }
- import { CustomerServiceStopAction } from "../components/CustomerServiceStopAction";
|