feat(admin): 租户页加「共享计费」开关(每租户)

TenantRow 带 shared_billing;选定租户成员区上方加共享计费开关(PUT
/admin/tenants/:id/shared-billing):开=成员消耗计本租户池、关=各计个人池。
live 验证:公司A 开关随真实状态回显为勾选。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Blizzard
2026-07-08 10:56:21 +08:00
parent b98cf3c718
commit b388915fff
2 changed files with 25 additions and 1 deletions
+9
View File
@@ -447,6 +447,7 @@ export interface TenantRow {
plan: string;
status: string;
credit_balance_micro: number;
shared_billing: boolean;
members: number;
}
export interface Member {
@@ -500,3 +501,11 @@ export async function removeMember(tenantId: string, uid: string): Promise<void>
throw new Error(d.error ?? `remove member failed: ${res.status}`);
}
}
export async function setSharedBilling(tenantId: string, on: boolean): Promise<void> {
const res = guard(await fetch(`${ADMIN}/tenants/${tenantId}/shared-billing`, { method: "PUT", headers: authHeaders(true), body: JSON.stringify({ shared_billing: on }) }));
if (!res.ok) {
const d = (await res.json().catch(() => ({}))) as { error?: string };
throw new Error(d.error ?? `set shared billing failed: ${res.status}`);
}
}