|
@@ -23,25 +23,23 @@ import { OpsStatus, OpsTableColumns, OpsTableEmpty } from "../components/Operati
|
|
|
import { FetchError } from "../components/fetchError";
|
|
import { FetchError } from "../components/fetchError";
|
|
|
import { Tri } from "../components/triState";
|
|
import { Tri } from "../components/triState";
|
|
|
import { TreeSelect } from "../components/ui/tree-select";
|
|
import { TreeSelect } from "../components/ui/tree-select";
|
|
|
-import { CustomerTeamMultiSelect } from "../components/CustomerTeamMultiSelect";
|
|
|
|
|
|
|
+import { CustomerTeamSelect } from "../components/CustomerTeamSelect";
|
|
|
import { ACCT_STATUS, SUBJECT_TYPE, label } from "../lib/api/labels";
|
|
import { ACCT_STATUS, SUBJECT_TYPE, label } from "../lib/api/labels";
|
|
|
import type { ApiError } from "../lib/api/http";
|
|
import type { ApiError } from "../lib/api/http";
|
|
|
-import { customerAttributionUpdate, customerGet, customerHistory, customerMoveRegion, customerUpdate, subAccountGetList, subAccountUpdate } from "../lib/api/bos";
|
|
|
|
|
|
|
+import { customerAttributionUpdate, customerGet, customerHistory, customerMoveRegion, customerUpdate, subAccountGetList, subAccountUpdate, subscriptionGetList, contractGetList } from "../lib/api/bos";
|
|
|
import { invalidateCustomerList } from "../lib/customer-list-store";
|
|
import { invalidateCustomerList } from "../lib/customer-list-store";
|
|
|
import type { SubAccountRow } from "../lib/api/types";
|
|
import type { SubAccountRow } from "../lib/api/types";
|
|
|
import { useLoad } from "../lib/useLoad";
|
|
import { useLoad } from "../lib/useLoad";
|
|
|
import { regionPath, useOrganizationData } from "../lib/organization-demo";
|
|
import { regionPath, useOrganizationData } from "../lib/organization-demo";
|
|
|
import { regionTreeNodes } from "../lib/region-tree";
|
|
import { regionTreeNodes } from "../lib/region-tree";
|
|
|
import { customerMaterials } from "../lib/customer-records";
|
|
import { customerMaterials } from "../lib/customer-records";
|
|
|
-import { readSubscriptions } from "../lib/subscription-store";
|
|
|
|
|
import { detailBack, detailLinkState } from "../lib/detail-navigation";
|
|
import { detailBack, detailLinkState } from "../lib/detail-navigation";
|
|
|
-import { useBusinessView } from "../lib/use-business-view";
|
|
|
|
|
import "../styles/operations.css";
|
|
import "../styles/operations.css";
|
|
|
import "../styles/customer-onboarding.css";
|
|
import "../styles/customer-onboarding.css";
|
|
|
|
|
|
|
|
const MISSING = "后端未下发";
|
|
const MISSING = "后端未下发";
|
|
|
const NO_ACCOUNT_READ = MISSING + ":/account/* 只有开通、改状态、重置激活码等写口,无任何账号列表或详情读路由,主账号登录名、绑定手机号、账号状态、激活状态与激活码均无法读取";
|
|
const NO_ACCOUNT_READ = MISSING + ":/account/* 只有开通、改状态、重置激活码等写口,无任何账号列表或详情读路由,主账号登录名、绑定手机号、账号状态、激活状态与激活码均无法读取";
|
|
|
-const NO_PROFILE_READ = MISSING + ":/customer/get@v1 未回显识别号、经办联系人、联系电话与地址(写口 /customer/update@v1 可提交)";
|
|
|
|
|
|
|
+const NO_PROFILE_READ = MISSING + ":/customer/get@v1 未回显经办联系人、联系电话与地址(写口 /customer/update@v1 可提交);识别号已脱敏下发";
|
|
|
const NO_MATERIAL_READ = MISSING + ":后端未提供客户材料上传与下载路由";
|
|
const NO_MATERIAL_READ = MISSING + ":后端未提供客户材料上传与下载路由";
|
|
|
const NO_STATUS_WRITE = MISSING + ":bos.ts 未封装 /customer/acct_status/update@v1,停用与恢复须由后端状态写口办理";
|
|
const NO_STATUS_WRITE = MISSING + ":bos.ts 未封装 /customer/acct_status/update@v1,停用与恢复须由后端状态写口办理";
|
|
|
const NO_QUOTA_NOTE = MISSING + ":quota_cents 口径未在接口说明中定义(金额或席位不明),不在本页折算成分账号额度";
|
|
const NO_QUOTA_NOTE = MISSING + ":quota_cents 口径未在接口说明中定义(金额或席位不明),不在本页折算成分账号额度";
|
|
@@ -66,23 +64,31 @@ function AcctCell({ raw }: { raw: string | null | undefined }) {
|
|
|
|
|
|
|
|
export function CustomerWorkspacePage() {
|
|
export function CustomerWorkspacePage() {
|
|
|
const { no } = useParams();
|
|
const { no } = useParams();
|
|
|
- const view = useBusinessView();
|
|
|
|
|
- const readOnly = view.readOnly;
|
|
|
|
|
const location = useLocation();
|
|
const location = useLocation();
|
|
|
const navigate = useNavigate();
|
|
const navigate = useNavigate();
|
|
|
- const back = detailBack(location.state, "/customers", `返回${view.customerListTitle}`);
|
|
|
|
|
const outgoingState = detailLinkState(location.pathname, location.state);
|
|
const outgoingState = detailLinkState(location.pathname, location.state);
|
|
|
- const organization = useOrganizationData();
|
|
|
|
|
|
|
+ const organization = useOrganizationData(["regions", "operators", "partners", "maintenanceTeams"]);
|
|
|
|
|
|
|
|
const detail = useLoad(() => (no ? customerGet({ customer_id: no }) : Promise.resolve(null)), [no]);
|
|
const detail = useLoad(() => (no ? customerGet({ customer_id: no }) : Promise.resolve(null)), [no]);
|
|
|
const accounts = useLoad(() => (no ? subAccountGetList({ customer_id: no, page: 0, page_size: 200 }) : Promise.resolve(null)), [no]);
|
|
const accounts = useLoad(() => (no ? subAccountGetList({ customer_id: no, page: 0, page_size: 200 }) : Promise.resolve(null)), [no]);
|
|
|
const changes = useLoad(() => (no ? customerHistory({ customer_id: no, page: 0, page_size: 50 }) : Promise.resolve(null)), [no]);
|
|
const changes = useLoad(() => (no ? customerHistory({ customer_id: no, page: 0, page_size: 50 }) : Promise.resolve(null)), [no]);
|
|
|
|
|
+ const subsLoad = useLoad(() => (no ? subscriptionGetList({ customer_id: no, page: 0, page_size: 200 }) : Promise.resolve(null)), [no]);
|
|
|
|
|
+ const contractsLoad = useLoad(() => (no ? contractGetList({ customer_id: no, page: 0, page_size: 200 }) : Promise.resolve(null)), [no]);
|
|
|
|
|
|
|
|
const customer = detail.data?.customer ?? null;
|
|
const customer = detail.data?.customer ?? null;
|
|
|
const mountId = detail.data?.region_mounts?.[0]?.parent_node_id ?? "";
|
|
const mountId = detail.data?.region_mounts?.[0]?.parent_node_id ?? "";
|
|
|
const teamIds = detail.data?.team_ids ?? [];
|
|
const teamIds = detail.data?.team_ids ?? [];
|
|
|
const accountRows = accounts.data?.items ?? [];
|
|
const accountRows = accounts.data?.items ?? [];
|
|
|
const changeRows = changes.data?.items ?? [];
|
|
const changeRows = changes.data?.items ?? [];
|
|
|
|
|
+ const subs = subsLoad.data?.items ?? [];
|
|
|
|
|
+ const contracts = contractsLoad.data?.items ?? [];
|
|
|
|
|
+ const contractFiles = contracts.flatMap((contract) =>
|
|
|
|
|
+ (contract.attachment_url
|
|
|
|
|
+ ? [{ name: String(contract.attachment_url).split("/").pop() || contract.attachment_url, contractNo: contract.contract_id }]
|
|
|
|
|
+ : []));
|
|
|
|
|
+
|
|
|
|
|
+ const customerListTitle = "客户管理";
|
|
|
|
|
+ const back = detailBack(location.state, "/customers", `返回${customerListTitle}`);
|
|
|
|
|
|
|
|
const [editingAttribution, setEditingAttribution] = useState(false);
|
|
const [editingAttribution, setEditingAttribution] = useState(false);
|
|
|
const [attribution, setAttribution] = useState({ regionId: "", operatorId: "", partnerId: "", teamIds: [] as string[] });
|
|
const [attribution, setAttribution] = useState({ regionId: "", operatorId: "", partnerId: "", teamIds: [] as string[] });
|
|
@@ -103,15 +109,11 @@ export function CustomerWorkspacePage() {
|
|
|
const regionTree = useMemo(() => regionTreeNodes(organization.regions, organization.regions.map((item) => item.id)), [organization]);
|
|
const regionTree = useMemo(() => regionTreeNodes(organization.regions, organization.regions.map((item) => item.id)), [organization]);
|
|
|
const mountedRegionPath = mountId ? regionPath(organization, mountId).trim() : "";
|
|
const mountedRegionPath = mountId ? regionPath(organization, mountId).trim() : "";
|
|
|
const teamNames = teamIds.map((id) => organization.maintenanceTeams.find((item) => item.id === id)?.name ?? id);
|
|
const teamNames = teamIds.map((id) => organization.maintenanceTeams.find((item) => item.id === id)?.name ?? id);
|
|
|
|
|
+ /** 后端当期回显 2 支以上=历史脏数据(运维团队单支定案)⇒ 按实呈现并提示改派,⛔ 前端截断成一支假装正常。 */
|
|
|
|
|
+ const staleTeamHint = teamIds.length > 1 ? `历史脏数据:后端当期回显 ${teamIds.length} 支运维团队,按单支定案需改派为 1 支` : "";
|
|
|
const subjectText = customer?.subject_type ? label(SUBJECT_TYPE, customer.subject_type) : "";
|
|
const subjectText = customer?.subject_type ? label(SUBJECT_TYPE, customer.subject_type) : "";
|
|
|
const customerName = customer?.customer_name ?? "";
|
|
const customerName = customer?.customer_name ?? "";
|
|
|
|
|
|
|
|
- const subs = readSubscriptions().filter((row) => row.enterpriseAccount === no);
|
|
|
|
|
- const contracts = view.contracts.filter((row) => row.customerNo === no || subs.some((sub) => sub.contractNumber === row.no));
|
|
|
|
|
- const contractFiles = contracts.flatMap((contract) =>
|
|
|
|
|
- (contract.files?.length ? contract.files : contract.file ? [contract.file] : [])
|
|
|
|
|
- .map((name) => ({ name, contractNo: contract.no })));
|
|
|
|
|
-
|
|
|
|
|
if (detail.error) {
|
|
if (detail.error) {
|
|
|
return <section className="ops-page">
|
|
return <section className="ops-page">
|
|
|
<Link to={back.to} state={back.state} className="ops-back-link"><ArrowLeft size={16} />{back.label}</Link>
|
|
<Link to={back.to} state={back.state} className="ops-back-link"><ArrowLeft size={16} />{back.label}</Link>
|
|
@@ -120,15 +122,20 @@ export function CustomerWorkspacePage() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function openAttribution() {
|
|
function openAttribution() {
|
|
|
- if (readOnly) return;
|
|
|
|
|
|
|
+ if (false) return;
|
|
|
setAttribution({ regionId: mountId, operatorId: customer?.operator_id ?? "", partnerId: customer?.partner_id ?? "", teamIds });
|
|
setAttribution({ regionId: mountId, operatorId: customer?.operator_id ?? "", partnerId: customer?.partner_id ?? "", teamIds });
|
|
|
setAttributionError("");
|
|
setAttributionError("");
|
|
|
setEditingAttribution(true);
|
|
setEditingAttribution(true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function saveAttribution() {
|
|
async function saveAttribution() {
|
|
|
- if (readOnly || !no || busy) return;
|
|
|
|
|
|
|
+ if (false || !no || busy) return;
|
|
|
if (!attribution.regionId || !attribution.operatorId) { setAttributionError("请选择挂载区域和运营商(后端必填)。"); return; }
|
|
if (!attribution.regionId || !attribution.operatorId) { setAttributionError("请选择挂载区域和运营商(后端必填)。"); return; }
|
|
|
|
|
+ // 运维团队单支定案:`ops_team_ids` 最多 1 个元素;没改动 ⇒ ⛔ 提交(不提交=不改动,⛔ 提交空数组清空归属)。
|
|
|
|
|
+ // 原本就挂着多支的历史脏数据且未改派 ⇒ 只提示不拦(本次不提交运维团队,区域/运营商变更照常办理)。
|
|
|
|
|
+ const teamsTouched = attribution.teamIds.join(",") !== teamIds.join(",");
|
|
|
|
|
+ if (teamsTouched && attribution.teamIds.length !== 1) { setAttributionError("请选择 1 支运维团队(客户固定挂 1 支,不可清空)。"); return; }
|
|
|
|
|
+ const teamsPatch = teamsTouched ? attribution.teamIds : undefined;
|
|
|
setBusy(true);
|
|
setBusy(true);
|
|
|
setAttributionError("");
|
|
setAttributionError("");
|
|
|
try {
|
|
try {
|
|
@@ -136,9 +143,9 @@ export function CustomerWorkspacePage() {
|
|
|
await customerAttributionUpdate({ customer_id: no, operator_id: attribution.operatorId, partner_id: attribution.partnerId || undefined });
|
|
await customerAttributionUpdate({ customer_id: no, operator_id: attribution.operatorId, partner_id: attribution.partnerId || undefined });
|
|
|
}
|
|
}
|
|
|
if (attribution.regionId !== mountId) {
|
|
if (attribution.regionId !== mountId) {
|
|
|
- await customerMoveRegion({ customer_id: no, new_region_node_id: attribution.regionId, ops_team_ids: attribution.teamIds });
|
|
|
|
|
- } else if (attribution.teamIds.join(",") !== teamIds.join(",")) {
|
|
|
|
|
- await customerUpdate({ customer_id: no, ops_team_ids: attribution.teamIds });
|
|
|
|
|
|
|
+ await customerMoveRegion({ customer_id: no, new_region_node_id: attribution.regionId, ops_team_ids: teamsPatch });
|
|
|
|
|
+ } else if (teamsPatch) {
|
|
|
|
|
+ await customerUpdate({ customer_id: no, ops_team_ids: teamsPatch });
|
|
|
}
|
|
}
|
|
|
setEditingAttribution(false);
|
|
setEditingAttribution(false);
|
|
|
invalidateCustomerList();
|
|
invalidateCustomerList();
|
|
@@ -152,7 +159,7 @@ export function CustomerWorkspacePage() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function openSub(row: SubAccountRow) {
|
|
function openSub(row: SubAccountRow) {
|
|
|
- if (readOnly) return;
|
|
|
|
|
|
|
+ if (false) return;
|
|
|
setSubDraft({ displayName: row.display_name ?? "", netAccount: row.net_account ?? "" });
|
|
setSubDraft({ displayName: row.display_name ?? "", netAccount: row.net_account ?? "" });
|
|
|
setSubError("");
|
|
setSubError("");
|
|
|
setEditingSub(row);
|
|
setEditingSub(row);
|
|
@@ -160,7 +167,7 @@ export function CustomerWorkspacePage() {
|
|
|
|
|
|
|
|
async function saveSub(event: FormEvent<HTMLFormElement>) {
|
|
async function saveSub(event: FormEvent<HTMLFormElement>) {
|
|
|
event.preventDefault();
|
|
event.preventDefault();
|
|
|
- if (readOnly || !editingSub || busy) return;
|
|
|
|
|
|
|
+ if (false || !editingSub || busy) return;
|
|
|
if (!subDraft.displayName.trim()) { setSubError("请填写账号姓名。"); return; }
|
|
if (!subDraft.displayName.trim()) { setSubError("请填写账号姓名。"); return; }
|
|
|
setBusy(true);
|
|
setBusy(true);
|
|
|
setSubError("");
|
|
setSubError("");
|
|
@@ -190,13 +197,13 @@ export function CustomerWorkspacePage() {
|
|
|
<span><Building2 size={14} /><TextCell value={customer?.operator_name} /></span>
|
|
<span><Building2 size={14} /><TextCell value={customer?.operator_name} /></span>
|
|
|
<span><TextCell value={subjectText} /></span>
|
|
<span><TextCell value={subjectText} /></span>
|
|
|
<span>分账号 <b>{accounts.error ? <Tri tone="fail" text="取数失败" title={accounts.error.message} /> : accountRows.length}</b> 个</span>
|
|
<span>分账号 <b>{accounts.error ? <Tri tone="fail" text="取数失败" title={accounts.error.message} /> : accountRows.length}</b> 个</span>
|
|
|
- <span>运维团队 <TextCell value={teamNames.join("、")} note={MISSING + ":/customer/get@v1 的 team_ids 为空或未下发"} /></span>
|
|
|
|
|
|
|
+ <span>运维团队 <TextCell value={teamNames.join("、")} note={MISSING + ":/customer/get@v1 的 team_ids 为空或未下发"} />{staleTeamHint && <Tri tone="fail" text="需改派单支" title={staleTeamHint} />}</span>
|
|
|
<span><AcctCell raw={customer?.acct_status} /></span>
|
|
<span><AcctCell raw={customer?.acct_status} /></span>
|
|
|
</div></div>
|
|
</div></div>
|
|
|
<div className="ops-hero-actions">
|
|
<div className="ops-hero-actions">
|
|
|
- {!readOnly && <Button variant="outline" disabled title={NO_STATUS_WRITE}>发起服务停用</Button>}
|
|
|
|
|
- {!readOnly && <Button variant="outline" disabled title={NO_STATUS_WRITE}>办理恢复</Button>}
|
|
|
|
|
- {!readOnly && <Button variant="outline" onClick={() => navigate(`/customers/${encodeURIComponent(no ?? "")}/edit`, { state: { from: location.pathname, fromState: location.state } })}>编辑档案</Button>}
|
|
|
|
|
|
|
+ {false && <Button variant="outline" disabled title={NO_STATUS_WRITE}>发起服务停用</Button>}
|
|
|
|
|
+ {false && <Button variant="outline" disabled title={NO_STATUS_WRITE}>办理恢复</Button>}
|
|
|
|
|
+ <Button variant="outline" onClick={() => navigate(`/customers/${encodeURIComponent(no ?? "")}/edit`, { state: { from: location.pathname, fromState: location.state } })}>编辑档案</Button>
|
|
|
</div>
|
|
</div>
|
|
|
</header>
|
|
</header>
|
|
|
<div className="ops-metric-strip">
|
|
<div className="ops-metric-strip">
|
|
@@ -210,7 +217,7 @@ export function CustomerWorkspacePage() {
|
|
|
<div className="ops-record-summary">
|
|
<div className="ops-record-summary">
|
|
|
<div><dt>客户编号</dt><dd>{no}</dd></div>
|
|
<div><dt>客户编号</dt><dd>{no}</dd></div>
|
|
|
<div><dt>主体类型</dt><dd><TextCell value={subjectText} /></dd></div>
|
|
<div><dt>主体类型</dt><dd><TextCell value={subjectText} /></dd></div>
|
|
|
- <div><dt>识别号 / 统一社会信用代码</dt><dd><TextCell value={null} note={NO_PROFILE_READ} /></dd></div>
|
|
|
|
|
|
|
+ <div><dt>识别号 / 统一社会信用代码</dt><dd><TextCell value={customer?.identity_no_masked ?? null} note="该客户建档时未录入识别号(后端只在登记过时脱敏下发,明文不下发)" /></dd></div>
|
|
|
<div><dt>经办联系人</dt><dd><TextCell value={null} note={NO_PROFILE_READ} /></dd></div>
|
|
<div><dt>经办联系人</dt><dd><TextCell value={null} note={NO_PROFILE_READ} /></dd></div>
|
|
|
<div><dt>联系电话</dt><dd><TextCell value={null} note={NO_PROFILE_READ} /></dd></div>
|
|
<div><dt>联系电话</dt><dd><TextCell value={null} note={NO_PROFILE_READ} /></dd></div>
|
|
|
<div><dt>地址</dt><dd><TextCell value={null} note={NO_PROFILE_READ} /></dd></div>
|
|
<div><dt>地址</dt><dd><TextCell value={null} note={NO_PROFILE_READ} /></dd></div>
|
|
@@ -218,19 +225,19 @@ export function CustomerWorkspacePage() {
|
|
|
</div>
|
|
</div>
|
|
|
</section>
|
|
</section>
|
|
|
|
|
|
|
|
- <section className="ops-record-card"><div className="customer-form-section-title"><span>02</span><div><h2>归属关系</h2><p>客户唯一归属一个运营商;区域与运营商省份须一致。运维团队按客户配置并分配给服务人员。</p></div></div>
|
|
|
|
|
|
|
+ <section className="ops-record-card"><div className="customer-form-section-title"><span>02</span><div><h2>归属关系</h2><p>客户唯一归属一个运营商;区域与运营商省份须一致。运维团队按客户配置(固定 1 支)并分配给服务人员。</p></div></div>
|
|
|
<div className="ops-record-summary">
|
|
<div className="ops-record-summary">
|
|
|
<div><dt>所属区域</dt><dd><TextCell value={mountedRegionPath} note={MISSING + ":/customer/get@v1 只回挂载节点 ID,区域树未下发该节点名称"} /></dd></div>
|
|
<div><dt>所属区域</dt><dd><TextCell value={mountedRegionPath} note={MISSING + ":/customer/get@v1 只回挂载节点 ID,区域树未下发该节点名称"} /></dd></div>
|
|
|
<div><dt>运营商</dt><dd><TextCell value={customer?.operator_name} /></dd></div>
|
|
<div><dt>运营商</dt><dd><TextCell value={customer?.operator_name} /></dd></div>
|
|
|
<div><dt>合伙人</dt><dd><TextCell value={customer?.partner_name} /></dd></div>
|
|
<div><dt>合伙人</dt><dd><TextCell value={customer?.partner_name} /></dd></div>
|
|
|
- <div><dt>运维团队</dt><dd>{teamNames.length ? teamNames.join("、") : <Tri tone="missing" text={MISSING} title={MISSING + ":/customer/get@v1 的 team_ids 为空或未下发"} />}</dd></div>
|
|
|
|
|
|
|
+ <div><dt>运维团队</dt><dd>{teamNames.length ? <>{teamNames.join("、")}{staleTeamHint && <><br /><Tri tone="fail" text="历史脏数据,需改派为单支" title={staleTeamHint} /></>}</> : <Tri tone="missing" text={MISSING} title={MISSING + ":/customer/get@v1 的 team_ids 为空或未下发"} />}</dd></div>
|
|
|
</div>
|
|
</div>
|
|
|
- {!readOnly && <div className="ops-inline-actions"><Button variant="outline" onClick={openAttribution}>配置归属</Button><span className="ops-muted">挂载区域、运营商、合伙人与运维团队,变更依据由后端留存。</span></div>}
|
|
|
|
|
|
|
+ <div className="ops-inline-actions"><Button variant="outline" onClick={openAttribution}>配置归属</Button><span className="ops-muted">挂载区域、运营商、合伙人与运维团队(客户固定挂 1 支),变更依据由后端留存。</span></div>
|
|
|
{editingAttribution && <form className="ops-filter-bar ops-entity-form" onSubmit={(event) => { event.preventDefault(); void saveAttribution(); }}>
|
|
{editingAttribution && <form className="ops-filter-bar ops-entity-form" onSubmit={(event) => { event.preventDefault(); void saveAttribution(); }}>
|
|
|
<label><span className="ops-field-title">所属区域</span><TreeSelect treeData={regionTree} value={attribution.regionId} onChange={(value) => setAttribution((v) => ({ ...v, regionId: value }))} ariaLabel="所属区域" placeholder="请选择区域节点" name="regionId" required /></label>
|
|
<label><span className="ops-field-title">所属区域</span><TreeSelect treeData={regionTree} value={attribution.regionId} onChange={(value) => setAttribution((v) => ({ ...v, regionId: value }))} ariaLabel="所属区域" placeholder="请选择区域节点" name="regionId" required /></label>
|
|
|
<label><span className="ops-field-title">运营商</span><select value={attribution.operatorId} onChange={(event) => setAttribution((v) => ({ ...v, operatorId: event.target.value }))}><option value="">请选择运营商</option>{organization.operators.map((item) => <option key={item.id} value={item.id}>{item.name}</option>)}</select></label>
|
|
<label><span className="ops-field-title">运营商</span><select value={attribution.operatorId} onChange={(event) => setAttribution((v) => ({ ...v, operatorId: event.target.value }))}><option value="">请选择运营商</option>{organization.operators.map((item) => <option key={item.id} value={item.id}>{item.name}</option>)}</select></label>
|
|
|
<label><span className="ops-field-title">合伙人(选填)</span><select value={attribution.partnerId} onChange={(event) => setAttribution((v) => ({ ...v, partnerId: event.target.value }))}><option value="">不绑定</option>{organization.partners.map((item) => <option key={item.id} value={item.id}>{item.name}</option>)}</select></label>
|
|
<label><span className="ops-field-title">合伙人(选填)</span><select value={attribution.partnerId} onChange={(event) => setAttribution((v) => ({ ...v, partnerId: event.target.value }))}><option value="">不绑定</option>{organization.partners.map((item) => <option key={item.id} value={item.id}>{item.name}</option>)}</select></label>
|
|
|
- <div><span className="ops-field-title">运维团队</span><CustomerTeamMultiSelect options={organization.maintenanceTeams.map((item) => ({ id: item.id, name: item.name, hint: (item.ticketTypes ?? []).join("、") }))} values={attribution.teamIds} onChange={(ids) => setAttribution((v) => ({ ...v, teamIds: ids }))} /></div>
|
|
|
|
|
|
|
+ <div><span className="ops-field-title">运维团队</span><CustomerTeamSelect options={organization.maintenanceTeams.map((item) => ({ id: item.id, name: item.name, hint: (item.ticketTypes ?? []).join("、") }))} value={attribution.teamIds[0] ?? ""} onChange={(id) => setAttribution((v) => ({ ...v, teamIds: [id] }))} />{staleTeamHint && <small className="ops-muted">{staleTeamHint};改派前本次不提交运维团队。</small>}</div>
|
|
|
{attributionError && <p className="ops-form-error" role="alert">{attributionError}</p>}
|
|
{attributionError && <p className="ops-form-error" role="alert">{attributionError}</p>}
|
|
|
<div className="ops-inline-actions"><Button type="submit" disabled={busy}>{busy ? "正在保存…" : "保存变更"}</Button><Button type="button" variant="outline" disabled={busy} onClick={() => setEditingAttribution(false)}>取消</Button></div>
|
|
<div className="ops-inline-actions"><Button type="submit" disabled={busy}>{busy ? "正在保存…" : "保存变更"}</Button><Button type="button" variant="outline" disabled={busy} onClick={() => setEditingAttribution(false)}>取消</Button></div>
|
|
|
</form>}
|
|
</form>}
|
|
@@ -255,16 +262,21 @@ export function CustomerWorkspacePage() {
|
|
|
</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" id="workspace-service"><div className="customer-form-section-title"><span>04</span><div><h2>全部订阅</h2><p>客户在本运营商下的套餐订阅记录;同一时刻仅一份在用,升降配生成新记录。此处只读,办理请进详情。</p></div></div>
|
|
|
- <div className="ops-table-wrap"><table className="ops-table"><OpsTableColumns widths={[170, 90, 90, 110, 130, 170, 80, 110, 90, 80]} /><OpsTableHead columns={["套餐", "类型", "变更类型", "关联订阅", "合同", "服务期限", "分账号", "月缴金额", "状态", ""]} />
|
|
|
|
|
- <tbody>{subs.length ? subs.map((sub) => <tr key={sub.id}>
|
|
|
|
|
- <td>{sub.planName}</td><td>{sub.planKind}</td><td>{sub.changeKind}</td>
|
|
|
|
|
- <td><TextCell value={sub.relatedSubscriptionId} /></td><td>{sub.contractNumber}</td>
|
|
|
|
|
- <td>{sub.contractStartDate} 至 {sub.contractEndDate}</td>
|
|
|
|
|
- <td>{sub.subAccountQuota} 个</td><td>{money(sub.monthlySettlementAmount)}</td>
|
|
|
|
|
- <td><OpsStatus tone={statusTone(sub.status)}>{sub.status}</OpsStatus>{sub.voidOn ? `(${sub.voidOn} 终止)` : ""}</td>
|
|
|
|
|
- <td><Button variant="ghost" onClick={() => navigate(`/customers/${encodeURIComponent(no ?? "")}/subscriptions?subId=${encodeURIComponent(sub.id)}`, { state: outgoingState })}>查看<ArrowRight size={14} /></Button></td>
|
|
|
|
|
|
|
+ <div className="ops-table-wrap">{subsLoad.error ? <div className="ops-empty"><FetchError message={subsLoad.error.message} onRetry={subsLoad.reload} /></div> :
|
|
|
|
|
+ <table className="ops-table"><OpsTableColumns widths={[170, 90, 90, 110, 130, 170, 80, 110, 90, 80]} /><OpsTableHead columns={["套餐", "类型", "变更类型", "关联订阅", "合同", "服务期限", "分账号", "月缴金额", "状态", ""]} />
|
|
|
|
|
+ <tbody>{subs.length ? subs.map((sub: any) => <tr key={sub.subscription_id}>
|
|
|
|
|
+ <td>{sub.plan_name ?? sub.plan_id}</td>
|
|
|
|
|
+ <td>{sub.plan_kind ?? "-"}</td>
|
|
|
|
|
+ <td><Tri tone="missing" text={MISSING} title={MISSING + ":subscription/get_list@v1 未下发变更类型"} /></td>
|
|
|
|
|
+ <td><TextCell value={sub.replaces_subscription_id} /></td>
|
|
|
|
|
+ <td>{sub.contract_id ?? "-"}</td>
|
|
|
|
|
+ <td>{sub.start_date ?? "—"} 至 {sub.end_date ?? "—"}</td>
|
|
|
|
|
+ <td>{sub.quota_slots ?? 0} 个</td>
|
|
|
|
|
+ <td>{sub.monthly_settle_cents ? money(String(sub.monthly_settle_cents)) : <Tri tone="missing" text={MISSING} title={MISSING + ":monthly_settle_cents 未下发"} />}</td>
|
|
|
|
|
+ <td><OpsStatus tone={statusTone(sub.status_display?.label ?? sub.status)}>{sub.status_display?.label ?? sub.status ?? MISSING}</OpsStatus>{sub.editable === false && sub.reason ? `(${sub.reason.split("⛔")[0]?.trim() ?? "已终止"})` : ""}</td>
|
|
|
|
|
+ <td><Button variant="ghost" onClick={() => navigate(`/subscriptions/${encodeURIComponent(sub.subscription_id)}`, { state: outgoingState })}>查看<ArrowRight size={14} /></Button></td>
|
|
|
</tr>) : <OpsTableEmpty colSpan={10}>该客户暂无套餐订阅记录</OpsTableEmpty>}</tbody>
|
|
</tr>) : <OpsTableEmpty colSpan={10}>该客户暂无套餐订阅记录</OpsTableEmpty>}</tbody>
|
|
|
- </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"><div className="customer-form-section-title"><span>05</span><div><h2>分账号</h2><p>网络账号由网络开通流程创建,本页只维护展示名与网络侧账号名;主账号不占套餐额度、不在此列出。</p></div></div>
|
|
@@ -278,7 +290,7 @@ export function CustomerWorkspacePage() {
|
|
|
<td><AcctCell raw={row.status} /></td>
|
|
<td><AcctCell raw={row.status} /></td>
|
|
|
<td><TextCell value={row.created_at} /></td>
|
|
<td><TextCell value={row.created_at} /></td>
|
|
|
<td><Tri tone="missing" text={MISSING} title={MISSING + ":/sub_account/get_list@v1 未回停用日期"} /></td>
|
|
<td><Tri tone="missing" text={MISSING} title={MISSING + ":/sub_account/get_list@v1 未回停用日期"} /></td>
|
|
|
- <td>{!readOnly && <Button variant="ghost" onClick={() => openSub(row)}>编辑</Button>}</td>
|
|
|
|
|
|
|
+ <td><Button variant="ghost" onClick={() => openSub(row)}>编辑</Button></td>
|
|
|
</tr>) : <OpsTableEmpty colSpan={8}>该客户暂无分账号</OpsTableEmpty>}
|
|
</tr>) : <OpsTableEmpty colSpan={8}>该客户暂无分账号</OpsTableEmpty>}
|
|
|
</tbody>
|
|
</tbody>
|
|
|
</table></div>
|
|
</table></div>
|