|
|
@@ -259,22 +259,58 @@ function RerunDialog({ onClose }: { onClose: () => void }) {
|
|
|
|
|
|
/* ── FN-05 对账清单(14.1) ─────────────────────────────────────── */
|
|
|
|
|
|
-const statementColumns = [
|
|
|
- { label: "对账单号", width: 168 }, { label: "分成方", width: 190 },
|
|
|
- { label: "自然月", width: 86 }, { label: "应出账日期", width: 108 },
|
|
|
- { label: "触发方式", width: 92 }, { label: "明细条数", width: 84 },
|
|
|
- { label: "总金额", width: 112 }, { label: "分成金额", width: 116 },
|
|
|
- { label: "出账状态", width: 98 }, { label: "批次状态", width: 114 },
|
|
|
- { label: "执行人", width: 100 }, { label: "操作", width: 80 },
|
|
|
+type SettlementLedgerColumn = { label: string; width: number; numeric?: boolean };
|
|
|
+const settlementActionWidth = 84;
|
|
|
+const statementColumns: readonly SettlementLedgerColumn[] = [
|
|
|
+ { label: "对账单号", width: 172 }, { label: "分成方", width: 180 },
|
|
|
+ { label: "自然月", width: 80 }, { label: "应出账日期", width: 104 },
|
|
|
+ { label: "触发方式", width: 88 }, { label: "明细条数", width: 86, numeric: true },
|
|
|
+ { label: "总金额", width: 112, numeric: true }, { label: "分成金额", width: 116, numeric: true },
|
|
|
+ { label: "出账状态", width: 98 }, { label: "批次状态", width: 104 },
|
|
|
+ { label: "执行人", width: 106 },
|
|
|
];
|
|
|
-const statementTableWidth = statementColumns.reduce((sum, column) => sum + column.width, 0);
|
|
|
+const billColumns: readonly SettlementLedgerColumn[] = [
|
|
|
+ { label: "分成方", width: 164 }, { label: "自然月", width: 80 },
|
|
|
+ { label: "客户", width: 180 }, { label: "订阅", width: 192 },
|
|
|
+ { label: "计费天数", width: 90, numeric: true }, { label: "分成基数", width: 112, numeric: true },
|
|
|
+ { label: "本方分成金额", width: 124, numeric: true }, { label: "对账单号", width: 164 },
|
|
|
+];
|
|
|
+
|
|
|
+function useSettlementLedgerTable(columns: readonly SettlementLedgerColumn[]) {
|
|
|
+ const { ref, width, overflow, canScrollLeft, canScrollRight } = useHorizontalOverflow();
|
|
|
+ const minContentWidth = columns.reduce((sum, column) => sum + column.width, 0);
|
|
|
+ const contentWidth = Math.max(minContentWidth, width - settlementActionWidth);
|
|
|
+ const widths = columns.map((column) => contentWidth * (column.width / minContentWidth)).concat(settlementActionWidth);
|
|
|
+ const className = [
|
|
|
+ "measured-table-scroll ops-table-wrap settlement-ledger-scroll",
|
|
|
+ overflow && "has-horizontal-overflow",
|
|
|
+ width >= 900 && "can-pin-identity",
|
|
|
+ canScrollLeft && "can-scroll-left",
|
|
|
+ canScrollRight && "can-scroll-right",
|
|
|
+ ].filter(Boolean).join(" ");
|
|
|
+ return { ref, className, widths, minWidth: minContentWidth + settlementActionWidth };
|
|
|
+}
|
|
|
+
|
|
|
+function SettlementLedgerHead({ columns }: { columns: readonly SettlementLedgerColumn[] }) {
|
|
|
+ return <thead><tr>
|
|
|
+ {columns.map(({ label, numeric }) => <th key={label} scope="col" className={numeric ? "settlement-ledger-number" : undefined}>{label}</th>)}
|
|
|
+ <th scope="col" className="settlement-ledger-action">操作</th>
|
|
|
+ </tr></thead>;
|
|
|
+}
|
|
|
+
|
|
|
+function SettlementHolderCell({ name, type }: { name: string; type: HolderType }) {
|
|
|
+ return <td>
|
|
|
+ <strong className="table-cell-title" title={name}>{name || <span className="table-placeholder">—</span>}</strong>
|
|
|
+ <div className="settlement-ledger-holder-type"><OpsTag tone={holderTone[type]}>{HOLDER_TYPE_TEXT[type]}</OpsTag></div>
|
|
|
+ </td>;
|
|
|
+}
|
|
|
|
|
|
export function SettlementStatementListPage() {
|
|
|
const identity = useDemoIdentity();
|
|
|
const listState = useDetailLinkState();
|
|
|
const back = detailBack(listState.previousState, "/settlement-batches", BACK_TO_RECON_LIST);
|
|
|
const filters = useListFilters();
|
|
|
- const tableOverflow = useHorizontalOverflow();
|
|
|
+ const table = useSettlementLedgerTable(statementColumns);
|
|
|
const progressId = useId();
|
|
|
// 导出当前结果(B):admin/opsMain/opsSub(demo 角色无 opsSub);⛔ teamLead/partner/operator。
|
|
|
const canExportAll = !identity || identity.role === "admin" || identity.role === "regAdmin";
|
|
|
@@ -338,13 +374,6 @@ export function SettlementStatementListPage() {
|
|
|
const [runOpen, setRunOpen] = useState(false);
|
|
|
const [progressOpen, setProgressOpen] = useState(false);
|
|
|
const [exporting, setExporting] = useState(false);
|
|
|
- const tableClass = [
|
|
|
- "measured-table-scroll ops-table-wrap statement-ledger-scroll",
|
|
|
- tableOverflow.overflow && "has-horizontal-overflow",
|
|
|
- tableOverflow.width >= 900 && "can-pin-identity",
|
|
|
- tableOverflow.canScrollLeft && "can-scroll-left",
|
|
|
- tableOverflow.canScrollRight && "can-scroll-right",
|
|
|
- ].filter(Boolean).join(" ");
|
|
|
|
|
|
async function exportAll() {
|
|
|
if (exporting || list.loading) return;
|
|
|
@@ -484,28 +513,24 @@ export function SettlementStatementListPage() {
|
|
|
</div>
|
|
|
|
|
|
{/* S404 触顶 ⇒ 不渲染三卡与列表(⚠️ 禁止静默截断)。 */}
|
|
|
- <div className={tableClass} ref={tableOverflow.ref} role="region" aria-label="对账批次,可横向滚动查看字段" tabIndex={0}>
|
|
|
+ <div className={table.className} ref={table.ref} role="region" aria-label="对账批次,可横向滚动查看字段" tabIndex={0}>
|
|
|
{s404 ? <p className="ops-import-note" role="alert">{S404_EMPTY_NOTE}</p> : (
|
|
|
- <table className="ops-table statement-ledger" style={{ minWidth: statementTableWidth }}>
|
|
|
- <OpsTableColumns widths={statementColumns.map(({ width }) => width)} />
|
|
|
- <thead>
|
|
|
- <tr>{statementColumns.map(({ label }) => <th key={label} scope="col">{label}</th>)}</tr>
|
|
|
- </thead>
|
|
|
+ <table className="ops-table settlement-ledger statement-ledger" style={{ minWidth: table.minWidth }}>
|
|
|
+ <OpsTableColumns widths={table.widths} />
|
|
|
+ <SettlementLedgerHead columns={statementColumns} />
|
|
|
<tbody>
|
|
|
{rows.map((row) => (
|
|
|
<tr key={row.batch_no}>
|
|
|
<td>
|
|
|
<span className="table-cell-title" title={row.batch_no}>{row.batch_no}</span>
|
|
|
</td>
|
|
|
- <td><strong className="table-cell-title" title={row.holder_name}>{row.holder_name}</strong>
|
|
|
- <div className="statement-holder-type"><OpsTag tone={holderTone[row.holder_type]}>{HOLDER_TYPE_TEXT[row.holder_type]}</OpsTag></div>
|
|
|
- </td>
|
|
|
+ <SettlementHolderCell name={row.holder_name} type={row.holder_type} />
|
|
|
<td><span className="ops-mono">{row.period}</span></td>
|
|
|
<td>{row.recon_date}</td>
|
|
|
<td><OpsTag tone={row.trigger_type === "manual" ? "warning" : "neutral"}>{TRIGGER_TYPE_TEXT[row.trigger_type]}</OpsTag></td>
|
|
|
- <td><span className="table-number">{row.detail_count}</span><span className="statement-unit"> 条</span></td>
|
|
|
- <td><span className="table-number" title={moneyFromCents(row.base_cents)}>{moneyFromCents(row.base_cents)}</span></td>
|
|
|
- <td><span className="table-number statement-share" title={moneyFromCents(row.share_cents)}>{moneyFromCents(row.share_cents)}</span></td>
|
|
|
+ <td className="settlement-ledger-number"><span className="table-number">{row.detail_count}</span><span className="settlement-ledger-unit"> 条</span></td>
|
|
|
+ <td className="settlement-ledger-number"><span className="ops-money" title={moneyFromCents(row.base_cents)}>{moneyFromCents(row.base_cents)}</span></td>
|
|
|
+ <td className="settlement-ledger-number"><span className="ops-money settlement-ledger-share" title={moneyFromCents(row.share_cents)}>{moneyFromCents(row.share_cents)}</span></td>
|
|
|
<td><OpsStatus tone={reconcileTone[row.reconcile_status]}>{RECONCILE_STATUS_TEXT[row.reconcile_status]}</OpsStatus></td>
|
|
|
<td>
|
|
|
<div className="statement-batch-status">
|
|
|
@@ -514,7 +539,7 @@ export function SettlementStatementListPage() {
|
|
|
</div>
|
|
|
</td>
|
|
|
<td title={executorText(row)}>{executorText(row)}</td>
|
|
|
- <td>
|
|
|
+ <td className="settlement-ledger-action">
|
|
|
<Link className="ops-table-action" to={batchPath(row.holder_id, row.batch_no)} state={listState}>
|
|
|
详情<ArrowRight size={14} aria-hidden="true" />
|
|
|
</Link>
|
|
|
@@ -522,7 +547,7 @@ export function SettlementStatementListPage() {
|
|
|
</tr>
|
|
|
))}
|
|
|
{!rows.length && (
|
|
|
- <OpsTableEmpty colSpan={statementColumns.length}>
|
|
|
+ <OpsTableEmpty colSpan={table.widths.length}>
|
|
|
{list.loading ? "加载中…" : wiring ? "对账接口待后端接线,批次数据暂不可读。" : "没有符合筛选条件的对账清单。"}
|
|
|
</OpsTableEmpty>
|
|
|
)}
|
|
|
@@ -774,6 +799,7 @@ function BatchDetailBody({ d, isAdmin, onRerun, onExport, onCorrect, lineState }
|
|
|
export function SettlementBillListPage() {
|
|
|
const listNavState = useDetailLinkState();
|
|
|
const filters = useListFilters();
|
|
|
+ const table = useSettlementLedgerTable(billColumns);
|
|
|
const q = filters.get("q");
|
|
|
const type = filters.get("type");
|
|
|
const month = filters.get("month");
|
|
|
@@ -821,34 +847,34 @@ export function SettlementBillListPage() {
|
|
|
{hasFilter && <Button variant="ghost" size="sm" onClick={filters.reset}>重置筛选</Button>}
|
|
|
</div>
|
|
|
|
|
|
- <div className="ops-table-wrap">
|
|
|
- <table className="ops-table">
|
|
|
- <OpsTableColumns widths={[180, 90, 170, 200, 90, 120, 130, 160, 76]} />
|
|
|
- <thead><tr><th>分成方</th><th>自然月</th><th>客户</th><th>订阅</th><th>计费天数</th><th>分成基数</th><th>本方分成金额</th><th>对账单号</th><th>操作</th></tr></thead>
|
|
|
+ <div className={table.className} ref={table.ref} role="region" aria-label="账单明细,可横向滚动查看字段" tabIndex={0}>
|
|
|
+ <table className="ops-table settlement-ledger" style={{ minWidth: table.minWidth }}>
|
|
|
+ <OpsTableColumns widths={table.widths} />
|
|
|
+ <SettlementLedgerHead columns={billColumns} />
|
|
|
<tbody>
|
|
|
{rows.map((row) => (
|
|
|
<tr key={row.bill_detail_id}>
|
|
|
- <td><OpsTag tone={holderTone[row.holder_type]}>{HOLDER_TYPE_TEXT[row.holder_type]}</OpsTag> <strong className="table-cell-title">{row.holder_name}</strong></td>
|
|
|
+ <SettlementHolderCell name={row.holder_name} type={row.holder_type} />
|
|
|
<td><span className="ops-mono">{row.period}</span></td>
|
|
|
- <td>{row.customer_name}</td>
|
|
|
- <td>{row.subscription_label}</td>
|
|
|
- <td className="table-number">{row.billing_days} 天</td>
|
|
|
- <td><span className="ops-money">{moneyFromCents(row.share_base_cents)}</span></td>
|
|
|
- <td><strong className="reconcile-money">{moneyFromCents(row.share_amount_cents)}</strong></td>
|
|
|
+ <td><strong className="table-cell-title" title={row.customer_name}>{row.customer_name}</strong></td>
|
|
|
+ <td><strong className="table-cell-title" title={row.subscription_label}>{row.subscription_label}</strong></td>
|
|
|
+ <td className="settlement-ledger-number"><span className="table-number">{row.billing_days}</span><span className="settlement-ledger-unit"> 天</span></td>
|
|
|
+ <td className="settlement-ledger-number"><span className="ops-money" title={moneyFromCents(row.share_base_cents)}>{moneyFromCents(row.share_base_cents)}</span></td>
|
|
|
+ <td className="settlement-ledger-number"><span className="ops-money settlement-ledger-share" title={moneyFromCents(row.share_amount_cents)}>{moneyFromCents(row.share_amount_cents)}</span></td>
|
|
|
<td>
|
|
|
- <Link className="reconcile-row-link" title={row.batch_no} to={batchPath(row.holder_id, row.batch_no)} state={listNavState}>
|
|
|
- {row.batch_no}<ArrowRight size={14} />
|
|
|
+ <Link className="ops-table-action settlement-ledger-batch-link" title={row.batch_no} to={batchPath(row.holder_id, row.batch_no)} state={listNavState}>
|
|
|
+ <span>{row.batch_no}</span><ArrowRight size={14} aria-hidden="true" />
|
|
|
</Link>
|
|
|
</td>
|
|
|
- <td>
|
|
|
+ <td className="settlement-ledger-action">
|
|
|
<Link className="ops-table-action" to={`/settlement-bills/${encodeURIComponent(row.bill_detail_id)}`} state={listNavState}>
|
|
|
- 详情
|
|
|
+ 详情<ArrowRight size={14} aria-hidden="true" />
|
|
|
</Link>
|
|
|
</td>
|
|
|
</tr>
|
|
|
))}
|
|
|
{!rows.length && (
|
|
|
- <OpsTableEmpty colSpan={9}>
|
|
|
+ <OpsTableEmpty colSpan={table.widths.length}>
|
|
|
{list.loading ? "加载中…" : wiring ? "账单明细接口待后端接线,数据暂不可读。" : "没有符合筛选条件的账单明细。"}
|
|
|
</OpsTableEmpty>
|
|
|
)}
|