浏览代码

feat(web): 重设计合伙人清单与运营商对账页面

sy 3 天之前
父节点
当前提交
ee8ebcc9a8

+ 25 - 0
web-scaffold/src/components/SettlementLedger.tsx

@@ -0,0 +1,25 @@
+import { useHorizontalOverflow } from "../lib/use-horizontal-overflow";
+
+export type SettlementLedgerColumn = { label: string; width: number; numeric?: boolean };
+
+export function useSettlementLedgerTable(columns: readonly SettlementLedgerColumn[], actionWidth = 84) {
+  const { ref, width, overflow, canScrollLeft, canScrollRight } = useHorizontalOverflow();
+  const minContentWidth = columns.reduce((sum, column) => sum + column.width, 0);
+  const contentWidth = Math.max(minContentWidth, width - actionWidth);
+  const widths = columns.map((column) => contentWidth * (column.width / minContentWidth)).concat(actionWidth);
+  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 + actionWidth };
+}
+
+export 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>;
+}

+ 307 - 253
web-scaffold/src/pages/PartyViewPages.tsx

@@ -18,14 +18,16 @@
  * ⛔「涉及分成方」卡与「同一张应收上其他分成方」面板(14.5,服务端亦不返回);
  * 金额整数分传输、前端不做浮点运算;本方对账默认全部自然月,其余只读台账默认预选 lastClosedMonth()。
  */
-import { useCallback, useEffect, useRef, useState } from "react";
+import { Children, useCallback, useEffect, useRef, useState, type ReactNode } from "react";
 import { PageIntro } from "../components/PageIntro";
-import { ArrowDown, ArrowRight, CalendarDays, Download, Info, Search, X } from "lucide-react";
-import { Link, useLocation, useParams } from "react-router";
+import { SettlementLedgerHead, useSettlementLedgerTable, type SettlementLedgerColumn } from "../components/SettlementLedger";
+import { ArrowDown, ArrowLeft, ArrowRight, CalendarClock, CalendarDays, Download, Info, Search, X } from "lucide-react";
+import { Link, useLocation, useParams, useSearchParams } from "react-router";
 import { detailBack, detailLinkState, partnerReconDetailPath } from "../lib/detail-navigation";
-import { ServerListPager } from "../components/ListPager";
+import { ListPager, ServerListPager } from "../components/ListPager";
 import { Button } from "../components/ui/button";
 import { Input } from "../components/ui/input";
+import { SearchInput } from "../components/ui/search-input";
 import { FilterSelect } from "../components/ui/filter-select";
 import { MonthFilter } from "../components/ui/month-filter";
 import { OpsNotice, OpsStatus, OpsTableColumns, OpsTableEmpty, OpsTag } from "../components/OperationsKit";
@@ -41,7 +43,6 @@ import {
   customerGetList,
   reconExportDetail,
   reconGetList,
-  reconGetPeriods,
   viewPartnerRecon,
 } from "../lib/api/bos";
 import type {
@@ -52,10 +53,12 @@ import type {
   ViewReconBatchRow,
 } from "../lib/api/types";
 import { WORD_FETCH_FAILED, WORD_NOT_PROVIDED, WORD_UNCONFIGURED } from "../lib/api/lockedCopy";
-import { ACCT_STATUS, SUBJECT_TYPE, label } from "../lib/api/labels";
+import { ACCT_STATUS, PAY_CYCLE, SUBJECT_TYPE, label } from "../lib/api/labels";
+import { contractStatusOf, contractStatusTone } from "../lib/contract-demo";
+import { EXPIRING_SOON_DAYS } from "../lib/expiring-soon";
 import { settleTextFromSnapshot } from "../lib/settle-text";
 import { lastClosedMonth } from "../lib/recon";
-import { ALL_PERIODS_LABEL, BACKEND_NOT_WIRED, BATCH_STATUS_TEXT, EXPORT_EMPTY_NOTE, RECONCILE_STATUS_TEXT, exportResultNote, saveReconExportCsv } from "../lib/copy-billing";
+import { ALL_PERIODS_LABEL, BACKEND_NOT_WIRED, BATCH_STATUS_TEXT, EXPORT_EMPTY_NOTE, RECONCILE_STATUS_TEXT, TRIGGER_TYPE_TEXT, exportResultNote, saveReconExportCsv } from "../lib/copy-billing";
 import {
   BACK_TO_BILL_DETAIL_LIST,
   BACK_TO_CONTRACT_LIST,
@@ -179,7 +182,7 @@ function FullPageState({ text, retry }: { text: string; retry?: () => void }) {
 
 /* ── V-P1/V-P1b 合并页(六段一次请求,⛔ 分段懒加载) ────────────────────── */
 
-type PartyListView = { page: number; month?: string; keyword?: string; batchKw?: string; customerKw?: string };
+type PartyListView = { page: number; month?: string; keyword?: string; subject?: string; status?: string; expiring?: boolean };
 
 function usePartyListReturn() {
   const location = useLocation();
@@ -451,273 +454,272 @@ export function TeamReconPage() {
 
 /* ── V-P5 运营商「本方对账清单」(⚠️ 独立组件,⛔ 与 V-P1 合并靠 props 抹平,A51) ── */
 
+const PARTY_PAGE_SIZE = 20;
+
+function PartySearch({ label, placeholder, value, onChange }: {
+  label: string; placeholder: string; value: string; onChange: (value: string) => void;
+}) {
+  return <div className="ops-search">
+    <Search size={17} aria-hidden="true" />
+    <SearchInput aria-label={label} placeholder={placeholder} value={value} onCommit={onChange} />
+    {value && <button type="button" aria-label={`清空${label}`} onClick={() => onChange("")}><X size={15} aria-hidden="true" /></button>}
+  </div>;
+}
+
+function PartyLedger({ title, columns, actionWidth = 88, filters, dataState, total, page, setPage, unit, empty, children }: {
+  title: string;
+  columns: readonly SettlementLedgerColumn[];
+  actionWidth?: number;
+  filters: ReactNode;
+  dataState: { loading: boolean; fail: ViewFail | null; reload: () => void };
+  total: number;
+  page: number;
+  setPage: (page: number) => void;
+  unit: string;
+  empty: string;
+  children: ReactNode;
+}) {
+  const table = useSettlementLedgerTable(columns, actionWidth);
+  const { loading, fail, reload } = dataState;
+  const errorMessage = fail?.kind === "fail" ? fail.message
+    : fail?.kind === "wiring" ? VIEW_WIRING_NOTE
+    : fail?.kind === "binding" ? VIEW_BINDING_FAILED
+    : fail?.kind === "forbidden" ? VIEW_ROLE_FORBIDDEN
+    : fail?.kind === "param" ? VIEW_FILTER_INCOMPLETE
+    : fail?.kind === "snapshot" ? VIEW_SNAPSHOT_NOT_READY
+    : WORD_FETCH_FAILED;
+
+  return <div className="ops-list-shell list-shell-fill">
+    <div className="ops-toolbar">{filters}</div>
+    <div ref={table.ref} className={table.className} tabIndex={0} role="region" aria-label={title}>
+      <table className="ops-table settlement-ledger statement-ledger party-ledger" aria-label={title} aria-busy={loading} style={{ minWidth: table.minWidth }}>
+        <OpsTableColumns widths={table.widths} />
+        <SettlementLedgerHead columns={columns} />
+        <tbody>
+          {fail ? <OpsTableEmpty colSpan={table.widths.length}><span role="alert">{errorMessage}</span>
+            {(fail.kind === "fail" || fail.kind === "snapshot") && <Button variant="ghost" size="sm" onClick={reload}>重试</Button>}
+          </OpsTableEmpty> : children}
+          {!fail && Children.count(children) === 0 && <OpsTableEmpty colSpan={table.widths.length}>{loading ? <span role="status">正在读取…</span> : empty}</OpsTableEmpty>}
+        </tbody>
+      </table>
+    </div>
+    <ListPager total={total} page={page - 1} pageSize={PARTY_PAGE_SIZE} onPageChange={(next) => setPage(next + 1)} unit={unit} />
+  </div>;
+}
+
+const operatorReconColumns = [
+  { label: "对账单号 / 自然月", width: 174 },
+  { label: "出账日期 / 触发方式", width: 146 },
+  { label: "出账状态", width: 91 },
+  { label: "批次状态", width: 91 },
+  { label: "明细条数", width: 85, numeric: true },
+  { label: "分成基数", width: 105, numeric: true },
+  { label: "本方分成金额", width: 120, numeric: true },
+] as const;
+
 export function OperatorReconPage() {
   const { saved, stateFor } = usePartyListReturn();
-  const [month, setMonth] = useState(saved?.month ?? lastClosedMonth());
+  const [month, setMonth] = useState(saved?.month ?? "");
   const [keyword, setKeyword] = useState(saved?.keyword ?? "");
   const [page, setPage] = useState(saved?.page ?? 1);
   const linkState = stateFor({ month, keyword, page });
   const [notice, setNotice] = useState("");
   const exportBatch = useExportBatch(setNotice);
 
-  const periodsFetch = useViewFetch(() => reconGetPeriods(), []);
-  const periods = periodsFetch.data?.periods ?? null;
   const fetchState = useViewFetch(
-    // 分页器是 1 基、后端 `page` 是 0 基(openapi:页码 0 基索引)⇒ 只在请求边界换算。
-    () => reconGetList({ page: Math.max(0, page - 1), page_size: 20, period: month || undefined, keyword: keyword.trim() || undefined }),
+    () => reconGetList({ page: page - 1, page_size: PARTY_PAGE_SIZE, period: month || undefined, keyword: keyword.trim() || undefined }),
     [month, keyword, page],
   );
-  const { data, fail } = fetchState;
-  const wiring = fail?.kind === "wiring";
-  const rows = data?.items ?? [];
-
-  useEffect(() => {
-    if (!periods?.length || !month) return;
-    if (!periods.includes(month)) setMonth(periods[0]);
-  }, [periods, month]);
-  const monthFallback = Boolean(periods?.length && month && !periods.includes(month));
-
-  const selfConfig = data?.self_config ?? null;
-  const total = data?.total ?? 0;
-  const pageSize = 20;
-
-  return (
-    <section className="ops-page reconcile-index page-fill">
-      <header className="reconcile-page-heading">
-        <div>
-          <p className="ops-eyebrow"><span /> READONLY / 只读视图</p>
-          <h1>本方对账清单</h1>
-          <PageIntro>核对本方各账期的出账进度和应结分成。</PageIntro>
-        </div>
-      </header>
-      {notice && <OpsNotice message={notice} onClose={() => setNotice("")} />}
-      {wiring && <p className="ops-import-note" role="status">{VIEW_WIRING_NOTE}</p>}
-
-      {/* V6 页顶两卡(随 recon/list 响应 self_config 附带,只读身份⛔ 授配置读键)。 */}
-      <div className="reconcile-totals" aria-label="本方对账配置">
-        <div>
-          <span>本方对账日</span>
-          <strong>{wiring ? BACKEND_NOT_WIRED : selfConfig ? `每月 ${selfConfig.recon_day} 日` : BACKEND_NOT_WIRED}</strong>
-          <small>当前生效配置</small>
-        </div>
-        <div>
-          <span>付款周期</span>
-          <strong>{wiring ? BACKEND_NOT_WIRED : selfConfig ? (selfConfig.pay_cycle ?? VIEW_DEFAULT_PAY_CYCLE) : BACKEND_NOT_WIRED}</strong>
-          <small>当前生效配置</small>
-        </div>
-      </div>
-
-      {/* 筛选条:自然月+对账单号关键字(⛔ 分成方/区域等范围类筛选,I30)。 */}
-      <div className="reconcile-filters">
-        <label className="ops-search">
-          <Search size={17} />
-          <Input
-            aria-label="搜索对账单号"
-            placeholder="搜索对账单号"
-            value={keyword}
-            onChange={(event) => { setKeyword(event.target.value); setPage(1); }}
-          />
-          {keyword && <button type="button" aria-label="清空搜索" onClick={() => { setKeyword(""); setPage(1); }}><X size={15} /></button>}
-        </label>
-        <FilterSelect
-          icon="month"
-          aria-label="自然月"
-          value={month}
-          disabled={!periods}
-          onChange={(event) => { setMonth(event.target.value); setPage(1); }}
-        >
-          <option value="">{ALL_PERIODS_LABEL}</option>
-          {(periods ?? (month ? [month] : [])).map((p) => <option key={p} value={p}>{p}</option>)}
-        </FilterSelect>
-        <Button variant="ghost" size="sm" onClick={() => { setKeyword(""); setMonth(lastClosedMonth()); setPage(1); }}>重置筛选</Button>
-      </div>
-      {monthFallback && <p className="ops-import-note" role="status">{VIEW_MONTH_NO_BATCH}</p>}
-
-      {fail?.kind === "binding" && <FullPageState text={VIEW_BINDING_FAILED} />}
-      {fail?.kind === "forbidden" && <FullPageState text={VIEW_ROLE_FORBIDDEN} />}
-      {fail?.kind === "fail" && <FullPageState text={fail.message} retry={fetchState.reload} />}
+  const { data } = fetchState;
+  const config = data?.self_config;
+  const share = data?.stats?.total_share_cents ?? null;
+  const filtered = !!(month || keyword);
+  const filters = <>
+    <PartySearch label="搜索对账单号" placeholder="搜索对账单号" value={keyword} onChange={(value) => { setKeyword(value); setPage(1); }} />
+    <MonthFilter value={month} onChange={(value) => { setMonth(value); setPage(1); }} />
+    {filtered && <Button variant="ghost" size="sm" onClick={() => { setKeyword(""); setMonth(""); setPage(1); }}>重置筛选</Button>}
+  </>;
 
-      {(wiring || data) && (
-        <div className="reconcile-ledger list-shell-fill">
-          <div className="ops-table-wrap">
-            <table className="ops-table">
-              <thead><tr><th>对账单号</th><th>自然月</th><th>出账状态</th><th>批次状态</th><th>明细条数</th><th>本方分成金额</th><th>操作</th></tr></thead>
-              <tbody>
-                {wiring ? (
-                  <tr><td colSpan={7}><Tri tone="missing" text={BACKEND_NOT_WIRED} /></td></tr>
-                ) : (
-                  rows.map((row) => (
-                    <tr key={row.batch_no}>
-                      <td className="ops-mono">{row.batch_no}</td>
-                      <td>{row.period}</td>
-                      <td><OpsStatus tone={row.reconcile_status === "settled" ? "success" : row.reconcile_status === "abnormal" ? "danger" : "neutral"}>{RECONCILE_STATUS_TEXT[row.reconcile_status]}</OpsStatus></td>
-                      <td><OpsStatus tone={row.status === "executed" ? "success" : row.status === "failed" ? "danger" : "neutral"}>{BATCH_STATUS_TEXT[row.status]}</OpsStatus></td>
-                      <td className="table-number">{row.detail_count}</td>
-                      <td><strong className="table-number">{moneyFromCents(row.share_cents)}</strong></td>
-                      <td>
-                        {/* 本批无明细 ⇒ 按钮整块不渲染;「查看明细」→ V-P6 按对账单号过滤(14.3 筛选行)。 */}
-                        {row.detail_count > 0 && (
-                          <button type="button" className="ops-table-action" onClick={() => exportBatch(row.batch_no)}>
-                            <Download size={13} /> 导出本批账单明细
-                          </button>
-                        )}{" "}
-                        <Link className="workspace-link" to={`/bos/ov/bill-detail?batch=${encodeURIComponent(row.batch_no)}`} state={linkState}>查看明细</Link>
-                      </td>
-                    </tr>
-                  ))
-                )}
-                {!wiring && !rows.length && (
-                  <OpsTableEmpty colSpan={7}>
-                    {VIEW_LIST_EMPTY}{!month && `;${VIEW_ALL_PERIODS_NOTE}`}
-                  </OpsTableEmpty>
-                )}
-              </tbody>
-            </table>
-          </div>
-          {!wiring && (
-            <ServerListPager total={total} page={page} pageSize={pageSize} onPageChange={setPage} unit="批" />
-          )}
-        </div>
-      )}
-    </section>
-  );
+  return <section className="ops-page reconcile-index page-fill page-fill-window">
+    <header className="ops-heading statement-heading"><div>
+      <h1>本方对账清单</h1>
+      <PageIntro>按账期核对本方出账进度、分成金额和批次明细。</PageIntro>
+    </div></header>
+    {data && <div className="ops-list-shell team-recon-overview operator-recon-overview">
+      <section className="team-recon-snapshot" aria-labelledby="operator-recon-summary">
+        <header>
+          <h2 id="operator-recon-summary">本方对账概况</h2>
+          <span><CalendarDays size={13} aria-hidden="true" />{month || ALL_PERIODS_LABEL}</span>
+        </header>
+        <dl className="team-recon-amounts">
+          <div><dt>当前筛选分成合计</dt><dd className={share == null ? "is-unavailable" : undefined}>{moneyCell(share)}</dd></div>
+          <div><dt>对账批次</dt><dd>{data.total} 批</dd></div>
+        </dl>
+      </section>
+      <dl className="team-recon-config" aria-label="本方对账配置">
+        <div><dt>本方对账日</dt><dd>{config?.recon_day != null ? `每月 ${config.recon_day} 日` : VIEW_CONFIG_UNSET}</dd></div>
+        <div><dt>付款周期</dt><dd>{config?.pay_cycle ? label(PAY_CYCLE, config.pay_cycle) : VIEW_DEFAULT_PAY_CYCLE}</dd></div>
+      </dl>
+    </div>}
+    <PartyLedger title="对账清单" columns={operatorReconColumns} actionWidth={192} filters={filters} dataState={fetchState}
+      total={data?.total ?? 0} page={page} setPage={setPage} unit="批" empty={filtered ? "没有符合筛选条件的对账批次。" : "暂无对账批次。"}>
+      {data?.items.map((row) => {
+        const drillQuery = new URLSearchParams({ batch: row.batch_no, month: row.period });
+        return <tr key={row.batch_no}>
+          <td><span className="table-cell-title" title={row.batch_no}>{row.batch_no}</span><small>{row.period}</small></td>
+          <td>{row.recon_date || <span className="table-placeholder">—</span>}<small>{TRIGGER_TYPE_TEXT[row.trigger_type]}</small></td>
+          <td><OpsStatus tone={row.reconcile_status === "settled" ? "success" : row.reconcile_status === "abnormal" ? "danger" : "neutral"}>{RECONCILE_STATUS_TEXT[row.reconcile_status]}</OpsStatus></td>
+          <td><OpsStatus tone={row.status === "executed" ? "success" : row.status === "failed" ? "danger" : "neutral"}>{BATCH_STATUS_TEXT[row.status]}</OpsStatus></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">{moneyFromCents(row.base_cents)}</span></td>
+          <td className="settlement-ledger-number"><span className="ops-money settlement-ledger-share">{moneyFromCents(row.share_cents)}</span></td>
+          <td className="settlement-ledger-action">
+            {row.status === "executed" && row.detail_count > 0 && <button type="button" className="ops-table-action" onClick={() => exportBatch(row.batch_no)}>
+              <Download size={14} aria-hidden="true" />导出明细
+            </button>}
+            <Link className="ops-table-action" to={`/bos/ov/bill-detail?${drillQuery}`} state={linkState}>查看明细<ArrowRight size={14} aria-hidden="true" /></Link>
+          </td>
+        </tr>;
+      })}
+    </PartyLedger>
+    {notice && <OpsNotice message={notice} onClose={() => setNotice("")} />}
+  </section>;
 }
 
-/* ── V-P6 运营商「账单明细」(⛔ 导出按钮——导出单位是批次;⛔「涉及分成方」卡) ────── */
+// 运营商明细清单只提供查询。归属在服务端按当前账号收窄。
+const operatorBillColumns = [
+  { label: "客户 / 账单明细号", width: 174 },
+  { label: "订阅", width: 152 },
+  { label: "自然月", width: 84 },
+  { label: "计费天数", width: 88, numeric: true },
+  { label: "分成基数", width: 106, numeric: true },
+  { label: "本方分成金额", width: 120, numeric: true },
+  { label: "对账单号", width: 153 },
+] as const;
 
 export function OperatorBillDetailPage() {
-  const { location, saved, stateFor } = usePartyListReturn();
-  const [month, setMonth] = useState(saved?.month ?? lastClosedMonth());
-  const [batchKw, setBatchKw] = useState(saved?.batchKw ?? new URLSearchParams(location.search).get("batch") ?? "");
-  const [customerKw, setCustomerKw] = useState(saved?.customerKw ?? "");
-  const [page, setPage] = useState(saved?.page ?? 1);
-  const linkState = stateFor({ month, batchKw, customerKw, page });
-  const back = detailBack(location.state, "/bos/ov/bill-detail", "返回账单明细");
+  const location = useLocation();
+  const [params, setParams] = useSearchParams();
+  const month = params.get("month") ?? "";
+  const batch = params.get("batch") ?? "";
+  const customer = params.get("customer") ?? "";
+  const page = Math.max(1, Number.parseInt(params.get("page") ?? "", 10) || 1);
+  const back = detailBack(location.state, "/bos/ov/bill-detail", BACK_TO_BILL_DETAIL_LIST);
+  const linkState = detailLinkState(location.pathname + location.search + location.hash, location.state);
+
+  function setFilter(key: "month" | "batch" | "customer" | "page", value: string) {
+    const next = new URLSearchParams(params);
+    if (value) next.set(key, value); else next.delete(key);
+    if (key !== "page") next.delete("page");
+    setParams(next, { replace: true, state: location.state });
+  }
 
-  const periodsFetch = useViewFetch(() => reconGetPeriods(), []);
-  const periods = periodsFetch.data?.periods ?? null;
   const fetchState = useViewFetch(
-    () => billGetList({ page: Math.max(0, page - 1), page_size: 20, period: month || undefined, keyword: batchKw.trim() || undefined, customer_kw: customerKw.trim() || undefined }),
-    [month, batchKw, customerKw, page],
+    () => billGetList({ page: page - 1, page_size: PARTY_PAGE_SIZE, period: month || undefined, keyword: batch.trim() || undefined, customer_kw: customer.trim() || undefined }),
+    [month, batch, customer, page],
   );
-  const { data, fail } = fetchState;
-  const wiring = fail?.kind === "wiring";
-  const rows = data?.items ?? [];
-  const total = data?.total ?? 0;
-  const pageSize = 20;
-
-  useEffect(() => {
-    if (!periods?.length || !month) return;
-    if (!periods.includes(month)) setMonth(periods[0]);
-  }, [periods, month]);
-  return (
-    <section className="ops-page reconcile-index page-fill">
-      {back.to !== "/bos/ov/bill-detail" && <Link className="ops-back-link self-start" to={back.to} state={back.state}>{back.label}</Link>}
-      <header className="reconcile-page-heading">
-        <div>
-          <p className="ops-eyebrow"><span /> READONLY / 只读视图</p>
-          <h1>账单明细</h1>
-          <PageIntro>沿账单追到具体客户和订阅,核对本方每笔分成。</PageIntro>
-        </div>
-      </header>
-      {wiring && <p className="ops-import-note" role="status">{VIEW_WIRING_NOTE}</p>}
-
-      <div className="reconcile-filters">
-        <label className="ops-search">
-          <Search size={17} />
-          <Input
-            aria-label="搜索对账单号"
-            placeholder="搜索对账单号"
-            value={batchKw}
-            onChange={(event) => { setBatchKw(event.target.value); setPage(1); }}
-          />
-          {batchKw && <button type="button" aria-label="清空搜索" onClick={() => { setBatchKw(""); setPage(1); }}><X size={15} /></button>}
-        </label>
-        <label className="ops-search">
-          <Search size={17} />
-          <Input
-            aria-label="搜索客户"
-            placeholder="搜索客户"
-            value={customerKw}
-            onChange={(event) => { setCustomerKw(event.target.value); setPage(1); }}
-          />
-          {customerKw && <button type="button" aria-label="清空搜索" onClick={() => { setCustomerKw(""); setPage(1); }}><X size={15} /></button>}
-        </label>
-        <FilterSelect
-          icon="month"
-          aria-label="自然月"
-          value={month}
-          disabled={!periods}
-          onChange={(event) => { setMonth(event.target.value); setPage(1); }}
-        >
-          <option value="">{ALL_PERIODS_LABEL}</option>
-          {(periods ?? (month ? [month] : [])).map((p) => <option key={p} value={p}>{p}</option>)}
-        </FilterSelect>
-        <Button variant="ghost" size="sm" onClick={() => { setBatchKw(""); setCustomerKw(""); setMonth(lastClosedMonth()); setPage(1); }}>重置筛选</Button>
-      </div>
-      <p className="ops-import-note" role="note">{VIEW_KEYWORD_FILTER_NOTE};{VIEW_DETAIL_ONLY_SETTLED}</p>
-
-      {fail?.kind === "binding" && <FullPageState text={VIEW_BINDING_FAILED} />}
-      {fail?.kind === "forbidden" && <FullPageState text={VIEW_ROLE_FORBIDDEN} />}
-      {fail?.kind === "fail" && <FullPageState text={fail.message} retry={fetchState.reload} />}
+  const filtered = !!(month || batch || customer);
+  const filters = <>
+    <PartySearch label="搜索对账单号" placeholder="搜索对账单号" value={batch} onChange={(value) => setFilter("batch", value)} />
+    <PartySearch label="搜索客户" placeholder="搜索客户名称" value={customer} onChange={(value) => setFilter("customer", value)} />
+    <MonthFilter value={month} onChange={(value) => setFilter("month", value)} />
+    {filtered && <Button variant="ghost" size="sm" onClick={() => setParams({}, { replace: true, state: location.state })}>重置筛选</Button>}
+  </>;
 
-      {(wiring || data) && (
-        <div className="reconcile-ledger list-shell-fill">
-          <div className="ops-table-wrap">
-            <table className="ops-table">
-              {/* ⚠️ 应收单号/应结金额两列待 R2 真源(对账§6 明细列表口)补列 ⇒ 暂以分成基数/本方分成呈现,缺口已登记。 */}
-              <thead><tr><th>账单明细号</th><th>客户名称</th><th>自然月</th><th>分成基数</th><th>本方分成金额</th><th>对账单号</th><th>操作</th></tr></thead>
-              <tbody>
-                {wiring ? (
-                  <tr><td colSpan={7}><Tri tone="missing" text={BACKEND_NOT_WIRED} /></td></tr>
-                ) : (
-                  rows.map((row) => (
-                    <tr key={row.bill_detail_id}>
-                      <td className="ops-mono">{row.bill_detail_id}</td>
-                      <td>{row.customer_name}</td>
-                      <td>{row.period}</td>
-                      <td className="table-number">{moneyFromCents(row.share_base_cents)}</td>
-                      <td><strong className="table-number">{moneyFromCents(row.share_amount_cents)}</strong></td>
-                      <td className="ops-mono">{row.batch_no}</td>
-                      <td><Link className="workspace-link" to={`/bos/ov/bill-detail/${encodeURIComponent(row.bill_detail_id)}`} state={linkState}>查看详情</Link></td>
-                    </tr>
-                  ))
-                )}
-                {!wiring && !rows.length && (
-                  <OpsTableEmpty colSpan={7}>
-                    {VIEW_LIST_EMPTY}{!month && `;${VIEW_ALL_PERIODS_NOTE}`}
-                  </OpsTableEmpty>
-                )}
-              </tbody>
-            </table>
-          </div>
-          {!wiring && (
-            <ServerListPager total={total} page={page} pageSize={pageSize} onPageChange={setPage} />
-          )}
-        </div>
-      )}
-    </section>
-  );
+  return <section className="ops-page reconcile-index page-fill page-fill-window">
+    {back.to !== "/bos/ov/bill-detail" && <Link className="ops-back-link self-start" to={back.to} state={back.state}><ArrowLeft size={16} aria-hidden="true" />{back.label.replace(/^←\s*/, "")}</Link>}
+    <header className="ops-heading statement-heading"><div>
+      <h1>账单明细</h1>
+      <PageIntro>按客户和订阅核对已出账的计费天数、分成基数及本方分成。</PageIntro>
+    </div></header>
+    <PartyLedger title="账单明细" columns={operatorBillColumns} filters={filters} dataState={fetchState} total={fetchState.data?.total ?? 0}
+      page={page} setPage={(next) => setFilter("page", next > 1 ? String(next) : "")} unit="条" empty={filtered ? "没有符合筛选条件的账单明细。" : "暂无已出账的账单明细。"}>
+      {fetchState.data?.items.map((row) => <tr key={row.bill_detail_id}>
+        <td><span className="table-cell-title" title={row.customer_name}>{row.customer_name}</span><small title={row.bill_detail_id}>{row.bill_detail_id}</small></td>
+        <td title={row.subscription_label}>{row.subscription_label || <span className="table-placeholder">—</span>}</td>
+        <td>{row.period}</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">{moneyFromCents(row.share_base_cents)}</span></td>
+        <td className="settlement-ledger-number"><span className="ops-money settlement-ledger-share">{moneyFromCents(row.share_amount_cents)}</span></td>
+        <td className="ops-mono" title={row.batch_no}>{row.batch_no}</td>
+        <td className="settlement-ledger-action">
+          <Link className="ops-table-action" to={`/bos/ov/bill-detail/${encodeURIComponent(row.bill_detail_id)}`} state={linkState}>详情<ArrowRight size={14} aria-hidden="true" /></Link>
+        </td>
+      </tr>)}
+    </PartyLedger>
+  </section>;
 }
 
 /* ── V-P2/V-P7 本方客户清单(同组件两路由;形态 D 列待客户§登记) ────────────── */
 
+const partnerCustomerColumns = [
+  { label: "客户名称", width: 185 },
+  { label: "主体 / 识别号", width: 140 },
+  { label: "所属区域", width: 168 },
+  { label: "生效套餐", width: 175 },
+  { label: "服务开通状态", width: 105 },
+] as const;
+
 export function PartyCustomerListPage({ kind }: { kind: "partner" | "operator" }) {
   const prefix = kindPrefix(kind);
   const { saved, stateFor } = usePartyListReturn();
   const [keyword, setKeyword] = useState(saved?.keyword ?? "");
+  const [subject, setSubject] = useState(saved?.subject ?? "");
+  const [status, setStatus] = useState(saved?.status ?? "");
   const [page, setPage] = useState(saved?.page ?? 1);
-  const linkState = stateFor({ keyword, page });
+  const linkState = stateFor({ keyword, page, subject, status });
   // ⛔ 前端下传 partner_id/operator_id(总则§16.1:范围在服务端谓词层展开)。
   const fetchState = useViewFetch(
     // 分页器是 1 基、后端 `page` 是 0 基(openapi:页码 0 基索引)⇒ 只在请求边界换算。
-    () => customerGetList({ page: Math.max(0, page - 1), page_size: 20, keyword: keyword.trim() || undefined }),
-    [keyword, page],
+    () => customerGetList({ page: page - 1, page_size: PARTY_PAGE_SIZE, keyword: keyword.trim() || undefined,
+      subject_type: subject || undefined, status: status || undefined }),
+    [keyword, page, subject, status],
   );
   const { data, fail } = fetchState;
   const rows = data?.items ?? [];
   const total = data?.total ?? 0;
-  const pageSize = 20;
+  const pageSize = PARTY_PAGE_SIZE;
+
+  if (kind === "partner") {
+    const filtered = !!(keyword || subject || status);
+    const filters = <>
+      <PartySearch label="搜索客户" placeholder="搜索客户名称或主体号" value={keyword} onChange={(value) => { setKeyword(value); setPage(1); }} />
+      <FilterSelect icon="type" aria-label="主体类型筛选" value={subject} onChange={(event) => { setSubject(event.target.value); setPage(1); }}>
+        <option value="">全部主体类型</option>
+        {["enterprise", "individual", "sole_proprietor"].map((code) => <option value={code} key={code}>{SUBJECT_TYPE[code]}</option>)}
+      </FilterSelect>
+      <FilterSelect icon="status" aria-label="客户状态筛选" value={status} onChange={(event) => { setStatus(event.target.value); setPage(1); }}>
+        <option value="">全部状态</option>
+        {["not_opened", "in_use", "stopped"].map((code) => <option value={code} key={code}>{ACCT_STATUS[code]}</option>)}
+      </FilterSelect>
+      {filtered && <Button variant="ghost" size="sm" onClick={() => { setKeyword(""); setSubject(""); setStatus(""); setPage(1); }}>重置筛选</Button>}
+    </>;
+
+    return <section className="ops-page reconcile-index page-fill page-fill-window">
+      <header className="ops-heading statement-heading"><div>
+        <h1>客户清单</h1>
+        <PageIntro>查看负责范围内的客户,核对所属区域、在用套餐和服务状态。</PageIntro>
+      </div></header>
+      <PartyLedger title="客户清单" columns={partnerCustomerColumns} filters={filters} dataState={fetchState}
+        total={total} page={page} setPage={setPage} unit="家" empty={filtered ? "没有符合筛选条件的客户。" : "暂无客户。"}>
+        {rows.map((row) => {
+          const planNames = row.plan_names?.join("、");
+          const accountStatus = label(ACCT_STATUS, row.acct_status);
+          const tone = accountStatus === "已停用" ? "danger" : accountStatus === "正常" || accountStatus === "使用中" ? "success" : "neutral";
+          return <tr key={row.customer_id}>
+            <td><span className="table-cell-title" title={row.customer_name}>{row.customer_name}</span><small title={row.customer_id}>{row.customer_id}</small></td>
+            <td>{label(SUBJECT_TYPE, row.subject_type)}<small title={row.identity_no_masked || undefined}>
+              {row.identity_no_masked === undefined ? <Tri tone="fail" text={WORD_NOT_PROVIDED} /> : row.identity_no_masked || <span className="table-placeholder">未登记识别号</span>}
+            </small></td>
+            <td title={row.region_path || undefined}>{row.region_path === undefined ? <Tri tone="fail" text={WORD_NOT_PROVIDED} /> : row.region_path || <span className="table-placeholder">未挂载区域</span>}</td>
+            <td title={planNames}>{row.plan_names === undefined ? <Tri tone="fail" text={WORD_NOT_PROVIDED} /> : planNames || <span className="table-placeholder">无在用订阅</span>}</td>
+            <td>{accountStatus ? <OpsStatus tone={tone}>{accountStatus}</OpsStatus> : <span className="table-placeholder">—</span>}</td>
+            <td className="settlement-ledger-action"><Link className="ops-table-action" to={`${prefix}/customer/${encodeURIComponent(row.customer_id)}`} state={linkState}>详情<ArrowRight size={14} aria-hidden="true" /></Link></td>
+          </tr>;
+        })}
+      </PartyLedger>
+    </section>;
+  }
 
   return (
     <section className="ops-page reconcile-index page-fill">
@@ -786,35 +788,87 @@ export function PartyCustomerListPage({ kind }: { kind: "partner" | "operator" }
  * ⇒ 按本合同服务条目的套餐现名/派生档名汇总(真值派生,⛔ 造名)。
  * 条目存在但两枚名字都取不到(档位被删)=「未配置」,无条目也=「未配置」。
  */
-function contractNameOf(row: ContractRow) {
-  const items = row.service_items ?? [];
-  const names = items
+function contractPlanNames(row: ContractRow) {
+  const names = (row.service_items ?? [])
     .map((item) => item.plan_name)
     .filter((name): name is string => Boolean(name && name.trim()));
-  if (!names.length) return <Tri tone="missing" text={WORD_UNCONFIGURED} title="本合同未登记服务条目,无法从条目汇总名称(合同数据模型不存名称列)" />;
-  return (
-    <span title="合同数据模型不存名称列(第 3 册:合同条目不存名);此处按本合同服务条目的套餐名汇总">
-      {[...new Set(names)].join("、")}
-    </span>
-  );
+  return [...new Set(names)].join("、");
 }
 
+const partnerContractColumns = [
+  { label: "合同 / 客户", width: 182 },
+  { label: "外部单号", width: 115 },
+  { label: "套餐", width: 146 },
+  { label: "状态 / 期间", width: 187 },
+  { label: "是否已开通", width: 106 },
+  { label: "总额 / 服务期", width: 119, numeric: true },
+] as const;
+
 export function PartyContractListPage({ kind }: { kind: "partner" | "operator" }) {
   const prefix = kindPrefix(kind);
   const { saved, stateFor } = usePartyListReturn();
   const [keyword, setKeyword] = useState(saved?.keyword ?? "");
+  const [status, setStatus] = useState(saved?.status ?? "");
+  const [expiring, setExpiring] = useState(saved?.expiring ?? false);
   const [page, setPage] = useState(saved?.page ?? 1);
-  const linkState = stateFor({ keyword, page });
+  const linkState = stateFor({ keyword, page, status, expiring });
   // 行集=本方客户集合传导(SQL-2 第二段);⛔ 前端下传范围入参。
   const fetchState = useViewFetch(
     // 分页器是 1 基、后端 `page` 是 0 基(openapi:页码 0 基索引)⇒ 只在请求边界换算。
-    () => contractGetList({ page: Math.max(0, page - 1), page_size: 20, keyword: keyword.trim() || undefined }),
-    [keyword, page],
+    () => contractGetList({ page: page - 1, page_size: PARTY_PAGE_SIZE, keyword: keyword.trim() || undefined,
+      status: status || undefined, expiring_within_days: expiring ? EXPIRING_SOON_DAYS : undefined }),
+    [keyword, page, status, expiring],
   );
   const { data, fail } = fetchState;
   const rows = data?.items ?? [];
   const total = data?.total ?? rows.length;
-  const pageSize = 20;
+  const pageSize = PARTY_PAGE_SIZE;
+
+  if (kind === "partner") {
+    const filtered = !!(keyword || status || expiring);
+    const filters = <>
+      <PartySearch label="搜索合同" placeholder="搜索合同编号、客户或外部单号" value={keyword} onChange={(value) => { setKeyword(value); setPage(1); }} />
+      <FilterSelect icon="status" aria-label="合同状态筛选" value={status} onChange={(event) => { setStatus(event.target.value); setPage(1); }}>
+        <option value="">全部状态</option>
+        <option value="not_effective">待生效</option><option value="effective">生效中</option>
+        <option value="expired">已到期</option><option value="undetermined">不可判(缺起止日)</option>
+      </FilterSelect>
+      <Button variant={expiring ? "default" : "outline"} size="sm" aria-pressed={expiring} onClick={() => { setExpiring(!expiring); setPage(1); }}>
+        <CalendarClock size={15} aria-hidden="true" />快到期 {EXPIRING_SOON_DAYS} 天内
+      </Button>
+      {filtered && <Button variant="ghost" size="sm" onClick={() => { setKeyword(""); setStatus(""); setExpiring(false); setPage(1); }}>重置筛选</Button>}
+    </>;
+
+    return <section className="ops-page reconcile-index page-fill page-fill-window">
+      <header className="ops-heading statement-heading"><div>
+        <h1>合同清单</h1>
+        <PageIntro>按客户查找合同,核对服务期限、合同金额和开通情况。</PageIntro>
+      </div></header>
+      <PartyLedger title="合同清单" columns={partnerContractColumns} filters={filters} dataState={fetchState}
+        total={total} page={page} setPage={setPage} unit="份" empty={filtered ? "没有符合筛选条件的合同。" : "暂无合同。"}>
+        {rows.map((row) => {
+          const start = row.start_date?.slice(0, 10);
+          const end = row.end_date?.slice(0, 10);
+          const lifecycle = start && end ? contractStatusOf(start, end) : null;
+          const planNames = contractPlanNames(row);
+          const amount = row.contract_amount_cents ?? row.amount_cents;
+          return <tr key={row.contract_id}>
+            <td><span className="table-cell-title" title={row.contract_no}>{row.contract_no}</span><small title={row.customer_name}>{row.customer_name || <span className="table-placeholder">—</span>}</small></td>
+            <td className="ops-mono" title={row.external_no || undefined}>{row.external_no || <span className="table-placeholder">—</span>}</td>
+            <td title={planNames || undefined}>{planNames || <span className="table-placeholder">{WORD_UNCONFIGURED}</span>}</td>
+            <td>{lifecycle ? <OpsStatus tone={lifecycle === "已到期" ? "warning" : contractStatusTone[lifecycle]}>{lifecycle}</OpsStatus> : <span className="table-placeholder">{WORD_UNCONFIGURED}</span>}
+              <small>{start || end ? `${start || "—"} 至 ${end || "—"}` : <span className="table-placeholder">—</span>}</small></td>
+            <td>{row.opened == null
+              ? row.opened_state === "error" || row.opened_state === "failed" ? <Tri tone="fail" text={WORD_FETCH_FAILED} /> : <span className="table-placeholder">—</span>
+              : <OpsStatus tone={row.opened ? "success" : "warning"}>{row.opened ? "已开通" : "未开通"}</OpsStatus>}</td>
+            <td className="settlement-ledger-number">{amount == null ? <span className="table-placeholder">—</span> : <span className="ops-money">{moneyFromCents(amount)}</span>}
+              <small>{row.service_months == null ? <span className="table-placeholder">—</span> : `服务期 ${row.service_months} 个月`}</small></td>
+            <td className="settlement-ledger-action"><Link className="ops-table-action" to={`${prefix}/contract/${encodeURIComponent(row.contract_id)}`} state={linkState}>详情<ArrowRight size={14} aria-hidden="true" /></Link></td>
+          </tr>;
+        })}
+      </PartyLedger>
+    </section>;
+  }
 
   return (
     <section className="ops-page reconcile-index page-fill">
@@ -854,7 +908,7 @@ export function PartyContractListPage({ kind }: { kind: "partner" | "operator" }
                 {rows.map((row) => (
                   <tr key={row.contract_id}>
                     <td className="ops-mono">{row.contract_no}</td>
-                    <td>{contractNameOf(row)}</td>
+                    <td>{contractPlanNames(row) || <Tri tone="missing" text={WORD_UNCONFIGURED} />}</td>
                     <td>{row.customer_name ?? <Tri tone="missing" text={WORD_NOT_PROVIDED} />}</td>
                     <td>{row.start_date ?? <span className="table-placeholder">—</span>} ~ {row.end_date ?? <span className="table-placeholder">—</span>}</td>
                     <td><OpsTag tone="neutral">{row.status}</OpsTag></td>

+ 1 - 25
web-scaffold/src/pages/SettlementRecordPages.tsx

@@ -19,13 +19,13 @@ import { MonthFilter } from "../components/ui/month-filter";
 import { ServerListPager } from "../components/ListPager";
 import { OpsDialog, OpsNotice, OpsStatus, OpsTableColumns, OpsTableEmpty, OpsTag, type OpsTone } from "../components/OperationsKit";
 import { RecordTabs } from "../components/RecordTabs";
+import { SettlementLedgerHead, useSettlementLedgerTable, type SettlementLedgerColumn } from "../components/SettlementLedger";
 import { useDemoIdentity } from "../lib/demo-session";
 import { entTeamGetList, operatorGetList, partnerGetList, reconExportDetail, reconExportList } from "../lib/api/bos";
 import type { BillDetailResult, HolderType, ReconBatchStatus, ReconcileStatus, ReconDetailResult } from "../lib/api/types";
 import type { StatusTone } from "../domain/statuses";
 import { WORD_FETCH_FAILED } from "../lib/api/lockedCopy";
 import { settleTextFromSnapshot } from "../lib/settle-text";
-import { useHorizontalOverflow } from "../lib/use-horizontal-overflow";
 import { detailBack, detailLinkState, partnerReconDetailPath, useDetailLinkState, type DetailLinkState } from "../lib/detail-navigation";
 import {
   lastClosedMonth, submitReconRerun,
@@ -256,8 +256,6 @@ function RerunDialog({ onClose }: { onClose: () => void }) {
 
 /* ── FN-05 对账清单(14.1) ─────────────────────────────────────── */
 
-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 },
@@ -273,28 +271,6 @@ const billColumns: readonly SettlementLedgerColumn[] = [
   { 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>

+ 69 - 0
web-scaffold/src/pages/__tests__/party-ledger-navigation.test.tsx

@@ -0,0 +1,69 @@
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { MemoryRouter, Route, Routes } from "react-router";
+import { afterEach, beforeEach, expect, it, vi } from "vitest";
+import { billGetList, contractGetList, reconGetList } from "../../lib/api/bos";
+import { OperatorBillDetailPage, OperatorReconPage, PartyContractListPage } from "../PartyViewPages";
+
+vi.mock("../../lib/api/bos", async (load) => ({
+  ...await load<typeof import("../../lib/api/bos")>(),
+  billGetList: vi.fn(),
+  contractGetList: vi.fn(),
+  reconGetList: vi.fn(),
+}));
+
+beforeEach(() => {
+  vi.stubGlobal("ResizeObserver", class { observe() {} disconnect() {} });
+});
+
+afterEach(() => {
+  cleanup();
+  vi.resetAllMocks();
+  vi.unstubAllGlobals();
+});
+
+it("运营商从批次打开同月账单,重置后仍能返回原对账清单", async () => {
+  vi.mocked(reconGetList).mockResolvedValue({
+    total: 1,
+    stats: { total_base_cents: 60000, total_cost_cents: 1000, total_share_cents: 12000 },
+    self_config: { recon_day: 8, pay_cycle: "monthly" },
+    reconciled_summary: null,
+    progress: null,
+    items: [{
+      batch_no: "RECON-001", holder_type: "operator", holder_id: "OP-1", holder_name: "运营商甲",
+      period: "2026-09", recon_date: "2026-10-08", trigger_type: "auto", detail_count: 1,
+      base_cents: 60000, share_cents: 12000, reconcile_status: "settled", status: "executed",
+      fail_reason: null, operator_user_id: null,
+    }],
+  });
+  vi.mocked(billGetList).mockResolvedValue({ items: [], total: 0, page_size: 20 });
+  render(<MemoryRouter initialEntries={["/bos/ov/recon"]}>
+    <Routes>
+      <Route path="/bos/ov/recon" element={<OperatorReconPage />} />
+      <Route path="/bos/ov/bill-detail" element={<OperatorBillDetailPage />} />
+    </Routes>
+  </MemoryRouter>);
+
+  expect(await screen.findByText("每月 8 日")).toBeTruthy();
+  expect(screen.getByText("月付")).toBeTruthy();
+  fireEvent.click(screen.getByRole("link", { name: "查看明细" }));
+  await waitFor(() => expect(billGetList).toHaveBeenLastCalledWith(expect.objectContaining({ period: "2026-09", keyword: "RECON-001", page: 0 })));
+  fireEvent.click(screen.getByRole("button", { name: "重置筛选" }));
+  await waitFor(() => expect(billGetList).toHaveBeenLastCalledWith(expect.objectContaining({ period: undefined, keyword: undefined, page: 0 })));
+  expect(screen.queryByRole("button", { name: "重置筛选" })).toBeNull();
+  fireEvent.click(screen.getByRole("link", { name: "返回本方对账清单" }));
+  expect(await screen.findByRole("heading", { name: "本方对账清单" })).toBeTruthy();
+});
+
+it("合伙人合同筛选由服务端分页处理,并能一次清除", async () => {
+  vi.mocked(contractGetList).mockResolvedValue({ items: [], total: 0 });
+  render(<MemoryRouter initialEntries={["/bos/pv/contract"]}>
+    <PartyContractListPage kind="partner" />
+  </MemoryRouter>);
+
+  fireEvent.change(screen.getByLabelText("合同状态筛选"), { target: { value: "effective" } });
+  fireEvent.click(screen.getByRole("button", { name: "快到期 30 天内" }));
+  await waitFor(() => expect(contractGetList).toHaveBeenLastCalledWith(expect.objectContaining({ status: "effective", expiring_within_days: 30, page: 0 })));
+  expect(await screen.findByText("没有符合筛选条件的合同。")).toBeTruthy();
+  fireEvent.click(screen.getByRole("button", { name: "重置筛选" }));
+  await waitFor(() => expect(contractGetList).toHaveBeenLastCalledWith(expect.objectContaining({ status: undefined, expiring_within_days: undefined, page: 0 })));
+});

+ 2 - 0
web-scaffold/src/styles/settlement-records.css

@@ -36,6 +36,7 @@
   grid-template-columns: minmax(0, 1.6fr) minmax(295px, 1fr);
   border-bottom: 1px solid var(--border-subtle);
 }
+.operator-recon-overview { border-bottom: 1px solid var(--border); }
 .team-recon-snapshot {
   display: grid;
   align-content: center;
@@ -256,6 +257,7 @@
   white-space: nowrap;
 }
 .settlement-ledger .table-cell-title { display: block; }
+.party-ledger td > small { margin-block-start: 3px; overflow: hidden; text-overflow: ellipsis; }
 .settlement-ledger-holder-type { margin-top: 3px; }
 .settlement-ledger .settlement-ledger-number { text-align: right; font-variant-numeric: tabular-nums; }
 .settlement-ledger .settlement-ledger-unit { color: var(--muted-foreground); font-size: var(--type-meta); }