|
|
@@ -17,11 +17,11 @@
|
|
|
* * ⛔ 合同文档上传路由 ⇒ 合同文档区只给应备项说明。
|
|
|
*/
|
|
|
import { useEffect, useMemo, useRef, useState, type FormEvent, type KeyboardEvent as ReactKeyboardEvent, type ReactNode } from "react";
|
|
|
-import { ArrowLeft, Building2, CalendarPlus, Check, FileText, LoaderCircle, MapPin, PencilLine, RefreshCcw, RefreshCw, Upload, X } from "lucide-react";
|
|
|
+import { ArrowLeft, Building2, CalendarPlus, Check, FileSignature, FileText, LoaderCircle, MapPin, PencilLine, RefreshCcw, RefreshCw, ScrollText, Upload, UserCheck, UsersRound, X } from "lucide-react";
|
|
|
import { Link, useLocation, useParams } from "react-router";
|
|
|
import { Button } from "../components/ui/button";
|
|
|
import { Input } from "../components/ui/input";
|
|
|
-import { OpsMore, OpsNotice, OpsStatus, OpsTableColumns, OpsTableEmpty, type OpsMoreItem } from "../components/OperationsKit";
|
|
|
+import { OpsMore, OpsNotice, OpsStatus, OpsTableColumns, OpsTableEmpty, OpsTag, type OpsMoreItem } from "../components/OperationsKit";
|
|
|
import { OrderEditor } from "../components/OrderChangeDialogs";
|
|
|
import { CustomerServiceStopAction } from "../components/CustomerServiceStopAction";
|
|
|
import { DeliveryStatusTable } from "../components/DeliveryStatusTable";
|
|
|
@@ -102,6 +102,12 @@ function AcctCell({ raw }: { raw: string | null | undefined }) {
|
|
|
return text ? <OpsStatus tone={acctTone(raw ?? "")}>{text}</OpsStatus> : <Tri tone="missing" text={MISSING} title={MISSING + ":acct_status"} />;
|
|
|
}
|
|
|
|
|
|
+function metricCount(value: number | undefined, loading: boolean, error: ApiError | null) {
|
|
|
+ if (error) return <Tri tone="fail" text="取数失败" title={error.message} />;
|
|
|
+ if (loading) return <span className="customer-record-metric-loading">读取中</span>;
|
|
|
+ return <TextCell value={value} />;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* 详情里的单个可编辑项(与合同详情同一交互):非编辑态只渲染值,鼠标移入才显出铅笔;点铅笔切到输入态。
|
|
|
* 改完点对号(或按 Enter)即提交**该项**:客户写口按字段可选,⛔ 攒到底部统一保存。
|
|
|
@@ -521,15 +527,17 @@ export function CustomerWorkspacePage() {
|
|
|
});
|
|
|
return <section className="ops-page ops-record-page customer-workspace record-detail">
|
|
|
<Link to={back.to} state={back.state} className="ops-back-link"><ArrowLeft size={16} />{back.label}</Link>
|
|
|
- <div className="customer-record-masthead">
|
|
|
- <header className="ops-page-hero">
|
|
|
- <div className="ops-page-hero-copy"><p>客户档案 / {no}</p><div className="customer-record-title"><h1>{displayName}</h1><AcctCell raw={customer?.acct_status} /></div><div className="ops-hero-meta">
|
|
|
- <span><MapPin size={14} /><TextCell value={mountedRegionPath} note={MISSING + ":/customer/get@v1 未回 region_mounts(该客户未挂载区域,或挂载节点在层级真源未定级)"} /></span>
|
|
|
- <span><Building2 size={14} /><TextCell value={customer?.operator_name} /></span>
|
|
|
- <span><TextCell value={subjectText} /></span>
|
|
|
- <span>运维团队 <TextCell value={teamNames.join("、")} note={MISSING + ":/customer/get@v1 的 team_ids 为空或未下发"} />{staleTeamHint && <Tri tone="fail" text="需改派单支" title={staleTeamHint} />}</span>
|
|
|
- </div></div>
|
|
|
- <div className="ops-hero-actions">
|
|
|
+ <header className="customer-record-masthead">
|
|
|
+ <div className="customer-hero-symbol" aria-hidden="true"><Building2 size={26} /></div>
|
|
|
+ <div className="customer-hero-copy">
|
|
|
+ <p className="customer-record-id">客户档案 <span>{no}</span></p>
|
|
|
+ <h1 className="customer-record-title">{displayName}</h1>
|
|
|
+ <div className="customer-record-tags">
|
|
|
+ {subjectText && <OpsTag tone="brand">{subjectText}</OpsTag>}
|
|
|
+ <AcctCell raw={customer?.acct_status} />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className="ops-hero-actions customer-record-actions">
|
|
|
{/* D-11:手册「客户/订阅详情页」均可发起服务停用;停用挂具体订阅(工单§3.2.1)。 */}
|
|
|
{writable && heroStopSub ? <CustomerServiceStopAction
|
|
|
customerId={no || ""}
|
|
|
@@ -539,14 +547,37 @@ export function CustomerWorkspacePage() {
|
|
|
/> : null}
|
|
|
<Button variant="outline" onClick={detail.reload}><RefreshCcw size={15} />刷新</Button>
|
|
|
</div>
|
|
|
+ <dl className="customer-record-context">
|
|
|
+ <div><dt><MapPin size={14} aria-hidden="true" />所属区域</dt><dd><TextCell value={mountedRegionPath} note="未取到该客户的区域挂载信息" /></dd></div>
|
|
|
+ <div><dt>运营商</dt><dd><TextCell value={customer?.operator_name} /></dd></div>
|
|
|
+ <div><dt>运维团队</dt><dd><TextCell value={teamNames.join("、")} />{staleTeamHint && <Tri tone="fail" text="需改派单支" title={staleTeamHint} />}</dd></div>
|
|
|
+ </dl>
|
|
|
</header>
|
|
|
- <div className="ops-metric-strip customer-record-metrics" aria-label="客户业务摘要">
|
|
|
- <div className="ops-metric-card"><em>分账号</em><strong>{accounts.error ? <Tri tone="fail" text="取数失败" title={accounts.error.message} /> : accountRows.length}</strong><small>{accounts.error ? "列表接口未回执" : <>后端下发 <TextCell value={accounts.data?.total} /> 条</>}</small></div>
|
|
|
- <div className="ops-metric-card"><em>分账号额度</em><strong>{customer?.quota_cents ?? "0"} 个</strong><small>按在用订阅合计</small></div>
|
|
|
- <div className="ops-metric-card"><em>全部订阅</em><strong>{orders.length}</strong><small>不限状态,含已终止</small></div>
|
|
|
- <div className="ops-metric-card"><em>关联合同</em><strong>{contracts.length}</strong><small>客户号与订阅关联的合同</small></div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+
|
|
|
+ <dl className="customer-record-metrics" aria-label="客户业务摘要">
|
|
|
+ <div>
|
|
|
+ <dt><UsersRound size={16} aria-hidden="true" />分账号</dt>
|
|
|
+ <dd>
|
|
|
+ <strong>{metricCount(accounts.data?.total, accounts.loading, accounts.error)}</strong>
|
|
|
+ <small>订阅额度 <TextCell value={customer?.quota_cents != null ? `${customer.quota_cents} 席` : undefined} /></small>
|
|
|
+ </dd>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <dt><UserCheck size={16} aria-hidden="true" />在用分账号</dt>
|
|
|
+ <dd>
|
|
|
+ <strong>{metricCount(accounts.data ? accountRows.filter((row) => row.status === "in_use").length : undefined, accounts.loading, accounts.error)}</strong>
|
|
|
+ <small>{(accounts.data?.total ?? 0) > accountRows.length ? "当前已加载账号中在用" : "服务状态为在用"}</small>
|
|
|
+ </dd>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <dt><ScrollText size={16} aria-hidden="true" />全部订阅</dt>
|
|
|
+ <dd><strong>{metricCount(ordersLoad.data?.total ?? ordersLoad.data?.items.length, ordersLoad.loading, ordersLoad.error)}</strong><small>含历史订阅</small></dd>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <dt><FileSignature size={16} aria-hidden="true" />关联合同</dt>
|
|
|
+ <dd><strong>{metricCount(contractsLoad.data?.total ?? contractsLoad.data?.items.length, contractsLoad.loading, contractsLoad.error)}</strong><small>当前客户名下</small></dd>
|
|
|
+ </div>
|
|
|
+ </dl>
|
|
|
|
|
|
<div className="record-tabs-frame">
|
|
|
<RecordTabs prefix="customer" label="客户工作台视图" active={tab} onChange={setTab}
|