增加支付逻辑
This commit is contained in:
1 parent
4ac786aafb
commit
dfb2c91b8d
77 files changed
+6370
-45
No files matched your search
@@ -21,6 +21,8 @@ import {
|
||||
} from "lucide-react";
|
||||
import { billingUnitLabel, formatBillingAmount } from "@/lib/billing";
|
||||
import { parseAdminBillingPayload, parseMemberBillingPayload } from "@/lib/client/billing-api";
|
||||
import { WechatRecharge } from "@/components/wechat-recharge";
|
||||
import { AdminWechatPayments } from "@/components/admin-wechat-payments";
|
||||
import { groupedPriceRuleSections, priceCatalogBulkTarget, priceTierEditTarget, type PriceEditTarget } from "@/lib/client/billing-price-catalog";
|
||||
import { pulseFeedback, revealChildren, runScopedMotion } from "@/lib/ui/motion";
|
||||
import type { BillingAccountConfig, BillingParameterDimension, BillingParameterTier, BillingPriceRule, OrganizationWallet } from "@/lib/types";
|
||||
@@ -39,7 +41,7 @@ type LedgerEntry = {
|
||||
organizationId: string;
|
||||
accountId?: string;
|
||||
jobId?: string;
|
||||
kind: "recharge" | "charge" | "refund" | "adjustment";
|
||||
kind: "recharge" | "charge" | "refund" | "recharge_refund" | "adjustment";
|
||||
deltaFen: number;
|
||||
balanceAfterFen: number;
|
||||
description: string;
|
||||
@@ -76,7 +78,7 @@ type AdminPayload = {
|
||||
priceRules: BillingPriceRule[];
|
||||
};
|
||||
|
||||
type BillingTabId = "overview" | "ledger" | "pricing" | "balance" | "account";
|
||||
type BillingTabId = "overview" | "ledger" | "pricing" | "balance" | "account" | "wechat";
|
||||
|
||||
type BillingTabDefinition = {
|
||||
id: BillingTabId;
|
||||
@@ -129,6 +131,7 @@ export function BillingManager({ isSuperAdmin }: { isSuperAdmin: boolean }) {
|
||||
{ id: "overview", label: "概览" },
|
||||
{ id: "pricing", label: "价格与计费" },
|
||||
{ id: "balance", label: "余额与上账" },
|
||||
{ id: "wechat", label: "微信充值" },
|
||||
{ id: "account", label: "收款设置" }
|
||||
] : [
|
||||
{ id: "overview", label: "概览" },
|
||||
@@ -300,6 +303,7 @@ export function BillingManager({ isSuperAdmin }: { isSuperAdmin: boolean }) {
|
||||
{!isSuperAdmin && billing ? (
|
||||
<>
|
||||
{activeTab === "overview" ? <>
|
||||
<WechatRecharge organizationName={billing.organization.name} onPaid={() => void load()} />
|
||||
<LedgerSection entries={billing.ledger} limit={8} title="最近账务" action={<TabLink label="查看全部流水" onClick={() => setActiveTab("ledger")} />} />
|
||||
</> : null}
|
||||
{activeTab === "ledger" ? <LedgerSection entries={billing.ledger} title="账务流水" action={<span className="billing-section-count">最近 {Math.min(billing.ledger.length, 100)} 条</span>} /> : null}
|
||||
@@ -311,6 +315,7 @@ export function BillingManager({ isSuperAdmin }: { isSuperAdmin: boolean }) {
|
||||
{activeTab === "overview" ? <AdminOverview billing={billing} admin={admin} onChangeTab={setActiveTab} /> : null}
|
||||
{activeTab === "pricing" ? <PriceManagement admin={admin} saving={saving} onEdit={(rule, target) => setPriceEditState({ rule, target })} onBulkEdit={() => { setError(null); setBulkPriceEditOpen(true); }} /> : null}
|
||||
{activeTab === "balance" ? <BalanceManagement admin={admin} adjustmentDraft={adjustmentDraft} setAdjustmentDraft={setAdjustmentDraft} selectedOrganization={selectedAdjustmentOrganization} saving={saving} onSubmit={submitAdjustment} /> : null}
|
||||
{activeTab === "wechat" ? <AdminWechatPayments organizations={admin.organizations} onChanged={() => void load()} /> : null}
|
||||
{activeTab === "account" ? <AccountSettings account={admin.billingAccount} draft={accountDraft} editing={editingAccount} saving={saving} onEdit={() => setEditingAccount(true)} onCancel={() => { setEditingAccount(false); setAccountDraft({ ...emptyAccountDraft, ...admin.billingAccount }); }} onChange={(key, value) => setAccountDraft((current) => ({ ...current, [key]: value }))} onSubmit={saveBillingAccount} /> : null}
|
||||
</>
|
||||
) : null}
|
||||
|
||||
Reference in new issue
Block a user