|
@@ -20,6 +20,7 @@
|
|
|
*/
|
|
*/
|
|
|
import { Children, useCallback, useEffect, useRef, useState, type ReactNode } from "react";
|
|
import { Children, useCallback, useEffect, useRef, useState, type ReactNode } from "react";
|
|
|
import { PageIntro } from "../components/PageIntro";
|
|
import { PageIntro } from "../components/PageIntro";
|
|
|
|
|
+import { ContractLedgerAmountCell } from "../components/ContractLedgerAmountCell";
|
|
|
import { SettlementLedgerHead, useSettlementLedgerTable, type SettlementLedgerColumn } from "../components/SettlementLedger";
|
|
import { SettlementLedgerHead, useSettlementLedgerTable, type SettlementLedgerColumn } from "../components/SettlementLedger";
|
|
|
import { ArrowDown, ArrowLeft, ArrowRight, CalendarClock, CalendarDays, Download, Info, Search, X } from "lucide-react";
|
|
import { ArrowDown, ArrowLeft, ArrowRight, CalendarClock, CalendarDays, Download, Info, Search, X } from "lucide-react";
|
|
|
import { Link, useLocation, useParams, useSearchParams } from "react-router";
|
|
import { Link, useLocation, useParams, useSearchParams } from "react-router";
|
|
@@ -54,7 +55,7 @@ import type {
|
|
|
} from "../lib/api/types";
|
|
} from "../lib/api/types";
|
|
|
import { WORD_FETCH_FAILED, WORD_NOT_PROVIDED, WORD_UNCONFIGURED } from "../lib/api/lockedCopy";
|
|
import { WORD_FETCH_FAILED, WORD_NOT_PROVIDED, WORD_UNCONFIGURED } from "../lib/api/lockedCopy";
|
|
|
import { ACCT_STATUS, PAY_CYCLE, 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 { contractFromRow, contractStatusOf, contractStatusTone } from "../lib/contract-demo";
|
|
|
import { EXPIRING_SOON_DAYS } from "../lib/expiring-soon";
|
|
import { EXPIRING_SOON_DAYS } from "../lib/expiring-soon";
|
|
|
import { settleTextFromSnapshot } from "../lib/settle-text";
|
|
import { settleTextFromSnapshot } from "../lib/settle-text";
|
|
|
import { lastClosedMonth } from "../lib/recon";
|
|
import { lastClosedMonth } from "../lib/recon";
|
|
@@ -787,7 +788,6 @@ export function PartyContractListPage({ kind }: { kind: "partner" | "operator" }
|
|
|
const end = row.end_date?.slice(0, 10);
|
|
const end = row.end_date?.slice(0, 10);
|
|
|
const lifecycle = start && end ? contractStatusOf(start, end) : null;
|
|
const lifecycle = start && end ? contractStatusOf(start, end) : null;
|
|
|
const planNames = contractPlanNames(row);
|
|
const planNames = contractPlanNames(row);
|
|
|
- const amount = row.contract_amount_cents ?? row.amount_cents;
|
|
|
|
|
return <tr key={row.contract_id}>
|
|
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><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 className="ops-mono" title={row.external_no || undefined}>{row.external_no || <span className="table-placeholder">—</span>}</td>
|
|
@@ -797,8 +797,7 @@ export function PartyContractListPage({ kind }: { kind: "partner" | "operator" }
|
|
|
<td>{row.opened == null
|
|
<td>{row.opened == null
|
|
|
? row.opened_state === "error" || row.opened_state === "failed" ? <Tri tone="fail" text={WORD_FETCH_FAILED} /> : <span className="table-placeholder">—</span>
|
|
? 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>
|
|
: <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>
|
|
|
|
|
|
|
+ <ContractLedgerAmountCell contract={contractFromRow(row)} />
|
|
|
<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>
|
|
<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>;
|
|
</tr>;
|
|
|
})}
|
|
})}
|