|
|
@@ -16,7 +16,7 @@ import { hasBizCode } from "../lib/api/http";
|
|
|
import { billingConfigGet, operatorUpdate } from "../lib/api/bos";
|
|
|
import type { BillingConfigOperatorRow, EffectiveMode, HolderType } from "../lib/api/types";
|
|
|
import { submitBillingConfigUpdate, useBillingConfig } from "../lib/recon";
|
|
|
-import { SHARE_TERMS_UNSET, settleTextFromSnapshot, shareAmountText } from "../lib/settle-text";
|
|
|
+import { SHARE_TERMS_INCOMPLETE, SHARE_TERMS_UNSET, settlePartsFromSnapshot, settleTextFromSnapshot, shareAmountText } from "../lib/settle-text";
|
|
|
import { shareSummaryKey, useShareParamSummary, type ShareSummaryState } from "../lib/share-summary";
|
|
|
import { PARTY_NO_SHARE_ROWS, PARTY_SCOPE_NOTE } from "../lib/copy-views";
|
|
|
import {
|
|
|
@@ -73,7 +73,7 @@ export function ShareRulePage() {
|
|
|
* 1500 页宽 ⇒ 侧栏 252 + main 左右内边距 64 + list-shell 边框 2 + scrollbar-gutter 15
|
|
|
* ⇒ 表格容器 ≈1167px,故 `.ops-table.share-ledger` 的 min-width 定 1100(容器 1107 时可放满,
|
|
|
* 即 1440 页宽也不出滚动条)。⛔ 再按 tableOverflow 动态摊剩余宽度:那会让列宽随窗口抖动,
|
|
|
- * 且 1500 下「分成方式与取值」被摊到 319px。
|
|
|
+ * 且 1500 下「分成规则」被摊到 319px。
|
|
|
*/
|
|
|
const columnWidths = [64, 244, 252, 96, 200, 92, 80, 154];
|
|
|
const { identity, organization } = useBusinessView(ALL_ORG_COLLECTIONS);
|
|
|
@@ -122,15 +122,27 @@ export function ShareRulePage() {
|
|
|
const pageRows = slicePage(filtered, paging.safePage);
|
|
|
const hasFilter = region !== "" || kind !== "全部" || state !== "全部状态" || search !== "";
|
|
|
function reset() { setRegion(""); setKind("全部"); setState("全部状态"); setSearch(""); paging.resetPage(); }
|
|
|
- /** 「分成方式与取值」格:!item→读口未覆盖;item_error→取数失败;!configured→档案未配置;命中→settleText。 */
|
|
|
+ /**
|
|
|
+ * 「分成规则」格(样式对齐运营商台账同名列:取值主题色突出+方式小字,共两行):
|
|
|
+ * !item→读口未覆盖;item_error→取数失败;!configured→档案未配置(占位灰字);
|
|
|
+ * 命中→settle-text 单源拆出的方式/取值两段(⛔ 本页自拼)。
|
|
|
+ */
|
|
|
function termsCell(row: SharePartyRow) {
|
|
|
if (summary.fail === "wiring") return <Tri tone="missing" text={WORD_NOT_PROVIDED} title="share_param_summary 读口未在 OpenAPI 声明(待 klt-bos 交付)⇒ 两列待接线" />;
|
|
|
if (summary.fail) return <Tri tone="fail" text={WORD_FETCH_FAILED} title={summary.fail === "s406" ? "KLT-S406:只这两列取数失败,其余照常;不因此整页不渲染" : summary.message} />;
|
|
|
const item = summary.items.get(shareSummaryKey(PARTY_HOLDER_TYPE[row.type], row.id));
|
|
|
if (!item) return <Tri tone="missing" text={WORD_NOT_PROVIDED} title="读口应答未覆盖该方" />;
|
|
|
if (item.item_error) return <Tri tone="fail" text={WORD_FETCH_FAILED} title={item.item_error} />;
|
|
|
- if (!item.configured) return <small>{SHARE_TERMS_UNSET}</small>;
|
|
|
- return <strong>{settleTextFromSnapshot(item.share_mode, item.share_value)}</strong>;
|
|
|
+ if (!item.configured) return <span className="table-placeholder">{SHARE_TERMS_UNSET}</span>;
|
|
|
+ const terms = settlePartsFromSnapshot(item.share_mode, item.share_value);
|
|
|
+ if (!terms) return <span className="org-directory-value org-directory-share-value">{SHARE_TERMS_INCOMPLETE}</span>;
|
|
|
+ return <><span className="org-directory-value org-directory-share-value">{terms.value}</span><small>{terms.mode}</small></>;
|
|
|
+ }
|
|
|
+ /** 「分成规则」格悬停出完整文案(格内拆两行,截断时看全貌);未配/失败态不挂(占位与三态自带说明)。 */
|
|
|
+ function termsTitle(row: SharePartyRow): string | undefined {
|
|
|
+ if (summary.fail) return undefined;
|
|
|
+ const item = summary.items.get(shareSummaryKey(PARTY_HOLDER_TYPE[row.type], row.id));
|
|
|
+ return item?.configured && !item.item_error ? settleTextFromSnapshot(item.share_mode, item.share_value) : undefined;
|
|
|
}
|
|
|
return <section className="ops-page ops-page--rules page-fill page-fill-window">
|
|
|
<header className="ops-heading"><div><p className="ops-eyebrow"><span /> REVENUE SHARING / 分成与对账</p><h1>分成管理</h1><PageIntro>核对各方的分成约定,出账有差异时可回查适用规则。</PageIntro></div></header>
|
|
|
@@ -142,12 +154,12 @@ export function ShareRulePage() {
|
|
|
<FilterSelect icon="status" aria-label="分成状态筛选" value={state} onChange={(event) => { setState(event.target.value); paging.resetPage(); }}><option>全部状态</option><option>已配分成</option><option>未配分成</option></FilterSelect>
|
|
|
{hasFilter && <Button variant="ghost" size="sm" onClick={reset}>重置筛选</Button>}
|
|
|
</div>
|
|
|
- <div ref={tableOverflow.ref} tabIndex={0} role="region" aria-label="分成方台账,可横向滚动查看字段" className={`measured-table-scroll ops-table-wrap share-ledger-scroll${tableOverflow.overflow ? " has-horizontal-overflow" : ""}${tableOverflow.width >= 640 ? " can-pin-identity" : ""}${tableOverflow.canScrollLeft ? " can-scroll-left" : ""}${tableOverflow.canScrollRight ? " can-scroll-right" : ""}`}><table className="ops-table share-ledger"><OpsTableColumns widths={columnWidths} /><thead><tr><th>序号</th><th>分成方</th><th>所属区域</th><th>分成方类型</th><th>分成方式与取值</th><th>状态</th><th>分成客户</th><th>操作</th></tr></thead><tbody>{pageRows.map((row, index) => <tr key={row.id}>
|
|
|
+ <div ref={tableOverflow.ref} tabIndex={0} role="region" aria-label="分成方台账,可横向滚动查看字段" className={`measured-table-scroll ops-table-wrap share-ledger-scroll${tableOverflow.overflow ? " has-horizontal-overflow" : ""}${tableOverflow.width >= 640 ? " can-pin-identity" : ""}${tableOverflow.canScrollLeft ? " can-scroll-left" : ""}${tableOverflow.canScrollRight ? " can-scroll-right" : ""}`}><table className="ops-table share-ledger"><OpsTableColumns widths={columnWidths} /><thead><tr><th>序号</th><th>分成方</th><th>所属区域</th><th>分成方类型</th><th>分成规则</th><th>状态</th><th>分成客户</th><th>操作</th></tr></thead><tbody>{pageRows.map((row, index) => <tr key={row.id}>
|
|
|
<td><span className="ops-mono table-number">{String(paging.safePage * paging.pageSize + index + 1).padStart(2, "0")}</span></td>
|
|
|
<td><strong className="table-cell-title" title={row.displayName}>{row.displayName}</strong><small title={row.note}>{row.note}</small></td>
|
|
|
<td><span title={row.regionLabel}>{row.regionLabel || "—"}</span></td>
|
|
|
<td><OpsTag tone={row.type === "合伙人" ? "brand" : row.type === "运营商" ? "info" : "neutral"}>{row.type}</OpsTag></td>
|
|
|
- <td className="org-maintenance-share">{termsCell(row)}</td>
|
|
|
+ <td title={termsTitle(row)}>{termsCell(row)}</td>
|
|
|
<td>{rowConfigured(row) ? <OpsStatus tone="success">已配分成</OpsStatus> : <small>未配分成</small>}</td>
|
|
|
<td><span className="ops-money">{row.customerCount}</span></td>
|
|
|
<td><button type="button" className="ops-table-action" onClick={() => setDetail(row)} title="契约 14.2:弹窗出四卡+取值摘要(只读),配置分成请点弹窗里的「去档案里配置分成」">分成金额 <ArrowRight size={14} /></button></td>
|