|
@@ -23,6 +23,7 @@ import { Button } from "../components/ui/button";
|
|
|
import { Input } from "../components/ui/input";
|
|
import { Input } from "../components/ui/input";
|
|
|
import { OpsMore, OpsNotice, OpsStatus, OpsTableColumns, OpsTableEmpty, type OpsMoreItem } from "../components/OperationsKit";
|
|
import { OpsMore, OpsNotice, OpsStatus, OpsTableColumns, OpsTableEmpty, type OpsMoreItem } from "../components/OperationsKit";
|
|
|
import { OrderEditor, StackEditor } from "../components/OrderChangeDialogs";
|
|
import { OrderEditor, StackEditor } from "../components/OrderChangeDialogs";
|
|
|
|
|
+import { DeliveryStatusTable } from "../components/DeliveryStatusTable";
|
|
|
import { orderView, type OrderView } from "../lib/order-demo";
|
|
import { orderView, type OrderView } from "../lib/order-demo";
|
|
|
import { FetchError } from "../components/fetchError";
|
|
import { FetchError } from "../components/fetchError";
|
|
|
import { Tri } from "../components/triState";
|
|
import { Tri } from "../components/triState";
|
|
@@ -47,6 +48,22 @@ import "../styles/operations.css";
|
|
|
import "../styles/customer-onboarding.css";
|
|
import "../styles/customer-onboarding.css";
|
|
|
|
|
|
|
|
const MISSING = "后端未下发";
|
|
const MISSING = "后端未下发";
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 客户工作台的页签(讨论稿 §7.7:01–07 七个区块全部改为页签,并新增「交付现状」)。
|
|
|
|
|
+ * `#workspace-service` 锚点落在「全部订阅」页签上(保留旧链接的落点)。
|
|
|
|
|
+ */
|
|
|
|
|
+type WorkspaceTab = "profile" | "attribution" | "primary" | "subscriptions" | "subaccounts" | "materials" | "history" | "delivery";
|
|
|
|
|
+const WORKSPACE_TABS: { id: WorkspaceTab; label: string }[] = [
|
|
|
|
|
+ { id: "profile", label: "主体资料" },
|
|
|
|
|
+ { id: "attribution", label: "归属关系" },
|
|
|
|
|
+ { id: "primary", label: "客户主账号" },
|
|
|
|
|
+ { id: "subscriptions", label: "全部订阅" },
|
|
|
|
|
+ { id: "subaccounts", label: "分账号" },
|
|
|
|
|
+ { id: "materials", label: "登记材料与合同文档" },
|
|
|
|
|
+ { id: "history", label: "历史记录" },
|
|
|
|
|
+ { id: "delivery", label: "交付现状" },
|
|
|
|
|
+];
|
|
|
/** 客户建档/更正只收这三个主体码(后端 `60004` 会拦下主体类型字典里的其余历史码)。 */
|
|
/** 客户建档/更正只收这三个主体码(后端 `60004` 会拦下主体类型字典里的其余历史码)。 */
|
|
|
const CUSTOMER_SUBJECT_CODES = ["enterprise", "individual", "sole_proprietor"] as const;
|
|
const CUSTOMER_SUBJECT_CODES = ["enterprise", "individual", "sole_proprietor"] as const;
|
|
|
const NO_ACCOUNT_FOUND = "未查到该客户的主账号记录:可能尚未开通,或该账号不在当前登录账号的可见范围(/account/get_list@v1 按 subject_id 查询为空)";
|
|
const NO_ACCOUNT_FOUND = "未查到该客户的主账号记录:可能尚未开通,或该账号不在当前登录账号的可见范围(/account/get_list@v1 按 subject_id 查询为空)";
|
|
@@ -147,6 +164,11 @@ export function CustomerWorkspacePage() {
|
|
|
const navigate = useNavigate();
|
|
const navigate = useNavigate();
|
|
|
const outgoingState = detailLinkState(location.pathname, location.state);
|
|
const outgoingState = detailLinkState(location.pathname, location.state);
|
|
|
const organization = useOrganizationData(["regions", "operators", "partners", "maintenanceTeams"]);
|
|
const organization = useOrganizationData(["regions", "operators", "partners", "maintenanceTeams"]);
|
|
|
|
|
+ /** 页签=本页唯一的浏览轴(讨论稿 §7.7);`#workspace-service` 仍落在「全部订阅」。 */
|
|
|
|
|
+ const [tab, setTab] = useState<WorkspaceTab>(() => (location.hash === "#workspace-service" ? "subscriptions" : "profile"));
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ if (location.hash === "#workspace-service") setTab("subscriptions");
|
|
|
|
|
+ }, [location.hash]);
|
|
|
|
|
|
|
|
const detail = useLoad(() => (no ? customerGet({ customer_id: no }) : Promise.resolve(null)), [no]);
|
|
const detail = useLoad(() => (no ? customerGet({ customer_id: no }) : Promise.resolve(null)), [no]);
|
|
|
// 主账号读口:按绑定主体直取(`subject_id`=客户号),一次取回启停态与激活码生命周期。
|
|
// 主账号读口:按绑定主体直取(`subject_id`=客户号),一次取回启停态与激活码生命周期。
|
|
@@ -503,7 +525,16 @@ export function CustomerWorkspacePage() {
|
|
|
<div className="ops-metric-card"><em>关联合同</em><h2>{contracts.length}</h2><small>客户号与订阅关联的合同</small></div>
|
|
<div className="ops-metric-card"><em>关联合同</em><h2>{contracts.length}</h2><small>客户号与订阅关联的合同</small></div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <section className="ops-record-card"><div className="customer-form-section-title"><span>01</span><div><h2>主体资料</h2><p>客户以识别号查重、以客户号关联业务。</p></div></div>
|
|
|
|
|
|
|
+ {/* 页签条:01–07 七个区块逐一成页签,最后是「交付现状」(§7.7 新增)。 */}
|
|
|
|
|
+ <div className="ops-tabs customer-workspace-tabs" role="tablist" aria-label="客户工作台视图">
|
|
|
|
|
+ {WORKSPACE_TABS.map((item) => <button key={item.id} role="tab" id={`customer-tab-${item.id}`} aria-selected={tab === item.id} aria-controls={`customer-panel-${item.id}`} className={tab === item.id ? "active" : ""} onClick={() => setTab(item.id)}>
|
|
|
|
|
+ {item.label}
|
|
|
|
|
+ {item.id === "subscriptions" ? <span>{orders.length}</span> : null}
|
|
|
|
|
+ {item.id === "subaccounts" ? <span>{accounts.error ? "—" : accountRows.length}</span> : null}
|
|
|
|
|
+ </button>)}
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <section className="ops-record-card customer-workspace-panel" id="customer-panel-profile" role="tabpanel" aria-labelledby="customer-tab-profile" hidden={tab !== "profile"}><div className="customer-form-section-title"><span>01</span><div><h2>主体资料</h2><p>客户以识别号查重、以客户号关联业务。</p></div></div>
|
|
|
{writable && <p className="customer-record-edit-hint"><PencilLine size={13} />悬停可编辑项显示铅笔,点击即切换编辑状态;改完点对号(或按 Enter)立即保存该项,无需统一提交</p>}
|
|
{writable && <p className="customer-record-edit-hint"><PencilLine size={13} />悬停可编辑项显示铅笔,点击即切换编辑状态;改完点对号(或按 Enter)立即保存该项,无需统一提交</p>}
|
|
|
<dl className="ops-record-summary">
|
|
<dl className="ops-record-summary">
|
|
|
<div><dt>客户编号</dt><dd>{no}</dd></div>
|
|
<div><dt>客户编号</dt><dd>{no}</dd></div>
|
|
@@ -522,7 +553,7 @@ export function CustomerWorkspacePage() {
|
|
|
{subjectRevokesLicense && <p className="customer-form-note">提交后主体类型将改为「{label(SUBJECT_TYPE, form?.subject ?? "")}」,系统会同时撤销该客户已留存的营业执照影像(非企业不采集证件影像),之后如需恢复只能按企业主体重新上传。</p>}
|
|
{subjectRevokesLicense && <p className="customer-form-note">提交后主体类型将改为「{label(SUBJECT_TYPE, form?.subject ?? "")}」,系统会同时撤销该客户已留存的营业执照影像(非企业不采集证件影像),之后如需恢复只能按企业主体重新上传。</p>}
|
|
|
</section>
|
|
</section>
|
|
|
|
|
|
|
|
- <section className="ops-record-card"><div className="customer-form-section-title"><span>02</span><div><h2>归属关系</h2><p>客户唯一归属一个运营商;区域与运营商省份须一致。运维团队按客户配置(固定 1 支)并分配给服务人员。</p></div></div>
|
|
|
|
|
|
|
+ <section className="ops-record-card customer-workspace-panel" id="customer-panel-attribution" role="tabpanel" aria-labelledby="customer-tab-attribution" hidden={tab !== "attribution"}><div className="customer-form-section-title"><span>02</span><div><h2>归属关系</h2><p>客户唯一归属一个运营商;区域与运营商省份须一致。运维团队按客户配置(固定 1 支)并分配给服务人员。</p></div></div>
|
|
|
<dl className="ops-record-summary">
|
|
<dl className="ops-record-summary">
|
|
|
<div><dt>所属区域</dt><dd><InlineField id="customer-region" label="所属区域" value={form?.regionId ?? ""} editing={editingField === "regionId"} writable={writable} busy={busy} onStart={() => startField("regionId")} onChange={(value) => patch("regionId", value)} onDone={() => void commitField("regionId")} onCancel={() => cancelField("regionId")} display={draftRegionDisplay || undefined} emptyText={MISSING} editor={<TreeSelect treeData={regionTree} value={form?.regionId ?? ""} onChange={(value) => patch("regionId", value)} ariaLabel="所属区域" placeholder="请选择区域节点" name="customer-region" />} invalid={invalidOf("regionId")} error={errorOf("regionId")} /></dd></div>
|
|
<div><dt>所属区域</dt><dd><InlineField id="customer-region" label="所属区域" value={form?.regionId ?? ""} editing={editingField === "regionId"} writable={writable} busy={busy} onStart={() => startField("regionId")} onChange={(value) => patch("regionId", value)} onDone={() => void commitField("regionId")} onCancel={() => cancelField("regionId")} display={draftRegionDisplay || undefined} emptyText={MISSING} editor={<TreeSelect treeData={regionTree} value={form?.regionId ?? ""} onChange={(value) => patch("regionId", value)} ariaLabel="所属区域" placeholder="请选择区域节点" name="customer-region" />} invalid={invalidOf("regionId")} error={errorOf("regionId")} /></dd></div>
|
|
|
<div><dt>运营商</dt><dd><InlineField id="customer-operator" label="运营商" value={form?.operatorId ?? ""} editing={editingField === "operatorId"} writable={writable} busy={busy} onStart={() => startField("operatorId")} onChange={(value) => patch("operatorId", value)} onDone={() => void commitField("operatorId")} onCancel={() => cancelField("operatorId")} display={draftOperatorName || undefined} emptyText={MISSING} selectOptions={[{ value: "", label: "请选择运营商" }, ...organization.operators.map((item) => ({ value: item.id, label: item.name }))]} invalid={invalidOf("operatorId")} error={errorOf("operatorId")} /></dd></div>
|
|
<div><dt>运营商</dt><dd><InlineField id="customer-operator" label="运营商" value={form?.operatorId ?? ""} editing={editingField === "operatorId"} writable={writable} busy={busy} onStart={() => startField("operatorId")} onChange={(value) => patch("operatorId", value)} onDone={() => void commitField("operatorId")} onCancel={() => cancelField("operatorId")} display={draftOperatorName || undefined} emptyText={MISSING} selectOptions={[{ value: "", label: "请选择运营商" }, ...organization.operators.map((item) => ({ value: item.id, label: item.name }))]} invalid={invalidOf("operatorId")} error={errorOf("operatorId")} /></dd></div>
|
|
@@ -534,7 +565,7 @@ export function CustomerWorkspacePage() {
|
|
|
</section>
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
- <section className="ops-record-card"><div className="customer-form-section-title"><span>03</span><div><h2>客户主账号</h2><p>一个客户一个主账号,不占套餐席位。账号状态与客户状态分列。</p></div></div>
|
|
|
|
|
|
|
+ <section className="ops-record-card customer-workspace-panel" id="customer-panel-primary" role="tabpanel" aria-labelledby="customer-tab-primary" hidden={tab !== "primary"}><div className="customer-form-section-title"><span>03</span><div><h2>客户主账号</h2><p>一个客户一个主账号,不占套餐席位。账号状态与客户状态分列。</p></div></div>
|
|
|
<div className="customer-panel-grid">
|
|
<div className="customer-panel-grid">
|
|
|
<div className="customer-panel"><h3>客户主账号</h3><dl>
|
|
<div className="customer-panel"><h3>客户主账号</h3><dl>
|
|
|
<div><dt>登录名</dt><dd>{primaryAccount ? <TextCell value={primaryAccount.username} /> : <Tri tone={primaryAccountLoad.error ? "fail" : "missing"} text={MISSING} title={primaryAccountMissing} />}</dd></div>
|
|
<div><dt>登录名</dt><dd>{primaryAccount ? <TextCell value={primaryAccount.username} /> : <Tri tone={primaryAccountLoad.error ? "fail" : "missing"} text={MISSING} title={primaryAccountMissing} />}</dd></div>
|
|
@@ -562,7 +593,7 @@ export function CustomerWorkspacePage() {
|
|
|
<p className="customer-form-note">账号状态取 <code>bos_user_binding.status</code>(启停),激活状态取 <code>bos_account_ext.status</code>(激活码生命周期),两者正交:账号可用性只决定能否登录。激活码明文仅开通/重置当次回执一次性下发,本页「重置激活码」后的新码同样只在上方回显一次。</p>
|
|
<p className="customer-form-note">账号状态取 <code>bos_user_binding.status</code>(启停),激活状态取 <code>bos_account_ext.status</code>(激活码生命周期),两者正交:账号可用性只决定能否登录。激活码明文仅开通/重置当次回执一次性下发,本页「重置激活码」后的新码同样只在上方回显一次。</p>
|
|
|
</section>
|
|
</section>
|
|
|
|
|
|
|
|
- <section className="ops-record-card" id="workspace-service"><div className="customer-form-section-title"><span>04</span><div><h2>全部订阅</h2><p>客户在本运营商下的套餐订阅记录;同一时刻仅一份在用,升降配生成新记录。升降配与叠加在生效中订阅行的「更多」里直接办理。</p></div></div>
|
|
|
|
|
|
|
+ <section className="ops-record-card customer-workspace-panel" id="workspace-service" role="tabpanel" aria-labelledby="customer-tab-subscriptions" hidden={tab !== "subscriptions"}><div className="customer-form-section-title"><span>04</span><div><h2>全部订阅</h2><p>客户在本运营商下的套餐订阅记录;同一时刻仅一份在用,升降配生成新记录。升降配与叠加在生效中订阅行的「更多」里直接办理。</p></div></div>
|
|
|
<div className="ops-table-wrap">{ordersLoad.error ? <div className="ops-empty"><FetchError message={ordersLoad.error.message} onRetry={ordersLoad.reload} /></div> :
|
|
<div className="ops-table-wrap">{ordersLoad.error ? <div className="ops-empty"><FetchError message={ordersLoad.error.message} onRetry={ordersLoad.reload} /></div> :
|
|
|
<table className="ops-table"><OpsTableColumns widths={[170, 90, 90, 110, 130, 170, 80, 110, 90, 80]} /><OpsTableHead columns={["套餐", "类型", "变更类型", "关联订阅", "合同", "服务期限", "分账号", "月缴金额", "状态", ""]} />
|
|
<table className="ops-table"><OpsTableColumns widths={[170, 90, 90, 110, 130, 170, 80, 110, 90, 80]} /><OpsTableHead columns={["套餐", "类型", "变更类型", "关联订阅", "合同", "服务期限", "分账号", "月缴金额", "状态", ""]} />
|
|
|
<tbody>{orders.length ? orders.map((sub: any) => {
|
|
<tbody>{orders.length ? orders.map((sub: any) => {
|
|
@@ -589,7 +620,7 @@ export function CustomerWorkspacePage() {
|
|
|
</table>}</div>
|
|
</table>}</div>
|
|
|
</section>
|
|
</section>
|
|
|
|
|
|
|
|
- <section className="ops-record-card"><div className="customer-form-section-title"><span>05</span><div><h2>分账号</h2><p>网络账号由网络开通流程创建,本页只维护展示名与网络侧账号名;主账号不占套餐额度、不在此列出。</p></div></div>
|
|
|
|
|
|
|
+ <section className="ops-record-card customer-workspace-panel" id="customer-panel-subaccounts" role="tabpanel" aria-labelledby="customer-tab-subaccounts" hidden={tab !== "subaccounts"}><div className="customer-form-section-title"><span>05</span><div><h2>分账号</h2><p>网络账号由网络开通流程创建,本页只维护展示名与网络侧账号名;主账号不占套餐额度、不在此列出。</p></div></div>
|
|
|
<div className="ops-table-wrap"><table className="ops-table"><OpsTableColumns widths={[60, 130, 110, 170, 90, 110, 110, 80]} /><OpsTableHead columns={["序号", "账号名", "姓名", "网络侧账号名", "账号状态", "开通日", "停用日", "操作"]} />
|
|
<div className="ops-table-wrap"><table className="ops-table"><OpsTableColumns widths={[60, 130, 110, 170, 90, 110, 110, 80]} /><OpsTableHead columns={["序号", "账号名", "姓名", "网络侧账号名", "账号状态", "开通日", "停用日", "操作"]} />
|
|
|
<tbody>{accounts.error ? <tr><td colSpan={8}><Tri tone="fail" text="取数失败" title={accounts.error.message} /></td></tr>
|
|
<tbody>{accounts.error ? <tr><td colSpan={8}><Tri tone="fail" text="取数失败" title={accounts.error.message} /></td></tr>
|
|
|
: accountRows.length ? accountRows.map((row, index) => <tr key={row.sub_account_id}>
|
|
: accountRows.length ? accountRows.map((row, index) => <tr key={row.sub_account_id}>
|
|
@@ -623,7 +654,7 @@ export function CustomerWorkspacePage() {
|
|
|
<p className="customer-form-note">网络侧账号名由客户提供,仅用于与本系统账号对照,系统不为其做唯一性或格式校验。分账号的开通与停发:{MISSING} —— <code>/sub_account/*</code> 只有读列表与改姓名两个口,无新增与删除路由。</p>
|
|
<p className="customer-form-note">网络侧账号名由客户提供,仅用于与本系统账号对照,系统不为其做唯一性或格式校验。分账号的开通与停发:{MISSING} —— <code>/sub_account/*</code> 只有读列表与改姓名两个口,无新增与删除路由。</p>
|
|
|
</section>
|
|
</section>
|
|
|
|
|
|
|
|
- <section className="ops-record-card"><div className="customer-form-section-title"><span>06</span><div><h2>登记材料与合同文档</h2><p>企业客户营业执照影像由本系统留存备查;个人与个体工商户不适用。</p></div></div>
|
|
|
|
|
|
|
+ <section className="ops-record-card customer-workspace-panel" id="customer-panel-materials" role="tabpanel" aria-labelledby="customer-tab-materials" hidden={tab !== "materials"}><div className="customer-form-section-title"><span>06</span><div><h2>登记材料与合同文档</h2><p>企业客户营业执照影像由本系统留存备查;个人与个体工商户不适用。</p></div></div>
|
|
|
<div className="customer-panel"><h3>登记材料 · 营业执照影像</h3>
|
|
<div className="customer-panel"><h3>登记材料 · 营业执照影像</h3>
|
|
|
{!licenseApplicable ? <p className="ops-muted">不适用(个人与个体工商户不采集证件影像)</p>
|
|
{!licenseApplicable ? <p className="ops-muted">不适用(个人与个体工商户不采集证件影像)</p>
|
|
|
: license?.status === "viewable" ? <div className="customer-file-list"><div><span className="customer-file-thumb"><FileText size={16} /></span><div><strong>{license.file_name ?? MISSING}</strong><p>可查看(签名短时效,仅本次页面有效)</p></div>
|
|
: license?.status === "viewable" ? <div className="customer-file-list"><div><span className="customer-file-thumb"><FileText size={16} /></span><div><strong>{license.file_name ?? MISSING}</strong><p>可查看(签名短时效,仅本次页面有效)</p></div>
|
|
@@ -638,7 +669,7 @@ export function CustomerWorkspacePage() {
|
|
|
<p className="customer-form-note">应备材料(按主体类型):{subjectText ? customerMaterials(subjectText as "企业" | "个体工商户" | "个人") : <Tri tone="missing" text={MISSING} title={MISSING + ":subject_type"} />};合同文档:{CONTRACT_DOC_NOTE}。</p>
|
|
<p className="customer-form-note">应备材料(按主体类型):{subjectText ? customerMaterials(subjectText as "企业" | "个体工商户" | "个人") : <Tri tone="missing" text={MISSING} title={MISSING + ":subject_type"} />};合同文档:{CONTRACT_DOC_NOTE}。</p>
|
|
|
</section>
|
|
</section>
|
|
|
|
|
|
|
|
- <section className="ops-record-card"><div className="customer-form-section-title"><span>07</span><div><h2>历史记录</h2><p>记录档案与账号的关键变更,只读保留。</p></div></div>
|
|
|
|
|
|
|
+ <section className="ops-record-card customer-workspace-panel" id="customer-panel-history" role="tabpanel" aria-labelledby="customer-tab-history" hidden={tab !== "history"}><div className="customer-form-section-title"><span>07</span><div><h2>历史记录</h2><p>记录档案与账号的关键变更,只读保留。</p></div></div>
|
|
|
<div className="ops-table-wrap"><table className="ops-table"><OpsTableColumns widths={[150, 140, 320, 150]} /><OpsTableHead columns={["时间", "变更项", "变化前 → 变化后", "操作人"]} />
|
|
<div className="ops-table-wrap"><table className="ops-table"><OpsTableColumns widths={[150, 140, 320, 150]} /><OpsTableHead columns={["时间", "变更项", "变化前 → 变化后", "操作人"]} />
|
|
|
<tbody>{changes.error ? <tr><td colSpan={4}><Tri tone="fail" text="取数失败" title={changes.error.message} /></td></tr>
|
|
<tbody>{changes.error ? <tr><td colSpan={4}><Tri tone="fail" text="取数失败" title={changes.error.message} /></td></tr>
|
|
|
: changeRows.length ? changeRows.map((row, index) => <tr key={`${row.changed_at ?? "h"}-${index}`}>
|
|
: changeRows.length ? changeRows.map((row, index) => <tr key={`${row.changed_at ?? "h"}-${index}`}>
|
|
@@ -651,6 +682,12 @@ export function CustomerWorkspacePage() {
|
|
|
</table></div>
|
|
</table></div>
|
|
|
</section>
|
|
</section>
|
|
|
|
|
|
|
|
|
|
+ {/* 交付现状(讨论稿 §7.7):按需挂载——不进该页签就不发 `/delivery/list@v1`。 */}
|
|
|
|
|
+ {tab === "delivery" && <section className="ops-record-card customer-workspace-panel" id="customer-panel-delivery" role="tabpanel" aria-labelledby="customer-tab-delivery">
|
|
|
|
|
+ <div className="customer-form-section-title"><span>08</span><div><h2>交付现状</h2><p>该客户全部在册资源:在册只认交付台账,实测参数取该账号最近一次成功开通回填(列头带测值日期)。</p></div></div>
|
|
|
|
|
+ {no ? <DeliveryStatusTable customerId={no} /> : null}
|
|
|
|
|
+ </section>}
|
|
|
|
|
+
|
|
|
{notice && <OpsNotice message={notice} onClose={() => setNotice("")} />}
|
|
{notice && <OpsNotice message={notice} onClose={() => setNotice("")} />}
|
|
|
|
|
|
|
|
{editingSub && <dialog ref={orderDialogRef} onClose={() => setEditingSub(null)} className="ops-dialog" aria-labelledby="sub-account-edit-title">
|
|
{editingSub && <dialog ref={orderDialogRef} onClose={() => setEditingSub(null)} className="ops-dialog" aria-labelledby="sub-account-edit-title">
|