Jelajahi Sumber

style(web): 运营商与合伙人共用对账统计卡片

sy 3 hari lalu
induk
melakukan
e0370d3699

+ 36 - 37
web-scaffold/src/pages/PartyViewPages.tsx

@@ -191,6 +191,30 @@ function usePartyListReturn() {
   return { location, saved, stateFor };
 }
 
+function ReconOverview({ title, month, reconDay, payCycle, settlementRule, children }: {
+  title: string;
+  month: string;
+  reconDay: string;
+  payCycle: string;
+  settlementRule?: ReactNode;
+  children: ReactNode;
+}) {
+  return <div className="team-recon-overview">
+    <section className="team-recon-snapshot" aria-label={title}>
+      <header>
+        <h2>{title}</h2>
+        <span><CalendarDays size={13} aria-hidden="true" />{month || ALL_PERIODS_LABEL}</span>
+      </header>
+      <dl className="team-recon-amounts">{children}</dl>
+    </section>
+    <dl className="team-recon-config" aria-label="本方对账配置">
+      <div><dt>本方对账日</dt><dd>{reconDay}</dd></div>
+      <div><dt>付款周期</dt><dd>{payCycle}</dd></div>
+      {settlementRule != null && <div><dt>{CARD1_TITLE}</dt><dd>{settlementRule}</dd></div>}
+    </dl>
+  </div>;
+}
+
 function PartyReconMergedPage({ kind }: { kind: "partner" | "team" }) {
   const teamView = kind === "team";
   const title = kind === "partner" ? "本运营区域对账" : "本方对账";
@@ -301,23 +325,10 @@ function PartyReconMergedPage({ kind }: { kind: "partner" | "team" }) {
       {wiring && <p className="ops-import-note" role="status">{VIEW_WIRING_NOTE}</p>}
 
       <div className="ops-list-shell team-recon-filters">
-        {showLedger && <div className="team-recon-overview">
-          <section className="team-recon-snapshot" aria-labelledby="team-recon-snapshot-title">
-            <header>
-              <h2 id="team-recon-snapshot-title">{CARD_SNAPSHOT_TITLE}</h2>
-              <span><CalendarDays size={13} aria-hidden="true" />{month || ALL_PERIODS_LABEL}</span>
-            </header>
-            <dl className="team-recon-amounts">
-              <div><dt>当前筛选分成合计</dt><dd className={wiring || data?.share_sum == null ? "is-unavailable" : undefined}>{shareTotal}</dd></div>
-              <div><dt>本方全部分成合计</dt><dd className={wiring || data?.share_sum_all == null ? "is-unavailable" : undefined}>{wiring ? BACKEND_NOT_WIRED : moneyCell(data?.share_sum_all ?? null)}</dd></div>
-            </dl>
-          </section>
-          <dl className="team-recon-config" aria-label="本方对账配置">
-            <div><dt>本方对账日</dt><dd>{reconDay}</dd></div>
-            <div><dt>付款周期</dt><dd>{payCycle}</dd></div>
-            <div><dt>{CARD1_TITLE}</dt><dd>{settlementRule}</dd></div>
-          </dl>
-        </div>}
+        {showLedger && <ReconOverview title={CARD_SNAPSHOT_TITLE} month={month} reconDay={reconDay} payCycle={payCycle} settlementRule={settlementRule}>
+          <div><dt>当前筛选分成合计</dt><dd className={wiring || data?.share_sum == null ? "is-unavailable" : undefined}>{shareTotal}</dd></div>
+          <div><dt>本方全部分成合计</dt><dd className={wiring || data?.share_sum_all == null ? "is-unavailable" : undefined}>{wiring ? BACKEND_NOT_WIRED : moneyCell(data?.share_sum_all ?? null)}</dd></div>
+        </ReconOverview>}
         {filters}
       </div>
       {fetchState.loading && !data && !fail && <p className="ops-list-shell team-recon-loading" role="status">正在读取对账数据…</p>}
@@ -545,26 +556,14 @@ export function OperatorReconPage() {
       <h1>对账清单</h1>
       <PageIntro>按账期核对本方出账进度、分成金额和批次明细。</PageIntro>
     </div></header>
-    {!fetchState.fail && <section className="ops-list-shell operator-recon-overview" aria-label="本方对账概况" aria-busy={fetchState.loading}>
-      <dl className="operator-recon-metrics">
-        <div className="operator-recon-share">
-          <dt>本方分成合计 <span className="operator-recon-period"><CalendarDays size={13} aria-hidden="true" />{month || ALL_PERIODS_LABEL}</span></dt>
-          <dd className={share == null || fetchState.loading ? "is-unavailable" : undefined}>{fetchState.loading ? "—" : moneyCell(share)}</dd>
-        </div>
-        <div>
-          <dt>对账批次</dt>
-          <dd>{fetchState.loading ? "—" : data?.total.toLocaleString("zh-CN")}{!fetchState.loading && data && <small>批</small>}</dd>
-        </div>
-        <div>
-          <dt>本方对账日</dt>
-          <dd>{!data ? "—" : config?.recon_day != null ? `每月 ${config.recon_day} 日` : VIEW_CONFIG_UNSET}</dd>
-        </div>
-        <div>
-          <dt>付款周期</dt>
-          <dd>{!data ? "—" : config?.pay_cycle ? label(PAY_CYCLE, config.pay_cycle) : VIEW_DEFAULT_PAY_CYCLE}</dd>
-        </div>
-      </dl>
-    </section>}
+    {!fetchState.fail && <div className="ops-list-shell" aria-busy={fetchState.loading}>
+      <ReconOverview title="本方对账概况" month={month}
+        reconDay={!data ? "—" : config?.recon_day != null ? `每月 ${config.recon_day} 日` : VIEW_CONFIG_UNSET}
+        payCycle={!data ? "—" : config?.pay_cycle ? label(PAY_CYCLE, config.pay_cycle) : VIEW_DEFAULT_PAY_CYCLE}>
+        <div><dt>当前筛选分成合计</dt><dd className={share == null || fetchState.loading ? "is-unavailable" : undefined}>{fetchState.loading ? "—" : moneyCell(share)}</dd></div>
+        <div><dt>对账批次</dt><dd>{fetchState.loading || !data ? "—" : `${data.total.toLocaleString("zh-CN")} 批`}</dd></div>
+      </ReconOverview>
+    </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) => {

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

@@ -36,47 +36,6 @@
   grid-template-columns: minmax(0, 1.6fr) minmax(295px, 1fr);
   border-bottom: 1px solid var(--border-subtle);
 }
-.operator-recon-overview { container-type: inline-size; }
-.operator-recon-metrics {
-  display: grid;
-  grid-template-columns: minmax(0, 1.65fr) repeat(3, minmax(0, 1fr));
-  gap: 1px;
-  margin: 0;
-  background: var(--border-subtle);
-}
-.operator-recon-metrics > div {
-  display: grid;
-  align-content: start;
-  gap: 8px;
-  padding: 16px clamp(14px, 1.5vw, 24px);
-  background: var(--card);
-}
-.operator-recon-metrics dt {
-  display: flex;
-  align-items: center;
-  flex-wrap: wrap;
-  gap: 4px 12px;
-  color: var(--text-secondary);
-  font-size: var(--type-support);
-}
-.operator-recon-metrics dd {
-  margin: 0;
-  color: var(--foreground);
-  font-size: var(--type-section);
-  line-height: 1.35;
-  font-weight: 500;
-  font-variant-numeric: tabular-nums;
-  overflow-wrap: anywhere;
-}
-.operator-recon-metrics dd small { margin-inline-start: 4px; color: var(--muted-foreground); font-size: var(--type-meta); }
-.operator-recon-metrics .operator-recon-share { background: var(--primary-soft); }
-.operator-recon-share dd { min-height: clamp(30px, 2.36vw, 38px); color: var(--primary-soft-foreground); font-size: clamp(22px, 1.75vw, 28px); font-weight: 600; }
-.operator-recon-share .is-unavailable { color: var(--muted-foreground); font-size: var(--type-support); }
-.operator-recon-period { display: inline-flex; align-items: center; gap: 4px; color: var(--text-secondary); font-size: var(--type-meta); }
-@container (max-width: 660px) {
-  .operator-recon-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
-  .operator-recon-metrics > div { gap: 4px; padding: 12px 14px; }
-}
 .team-recon-snapshot {
   display: grid;
   align-content: center;