feat: 完善通用服务后台配置能力

This commit is contained in:
que01 committed 2026-09-19 16:50:32 +08:00
1 parent 60ca897574
commit d167b58a05
6 files changed
+46 -3

No files matched your search

+3 -1
View File
@@ -23,7 +23,7 @@ export interface BrandProfile {
contactWechat: string | null;
}
export type BrandUpdate = Partial<Omit<BrandProfile, "id">>;
export interface ServiceUpdate { name?: string; description?: string; coverUrl?: string; priceText?: string; priceAmount?: number; sortOrder?: number; bookingEnabled?: boolean; isEnabled?: boolean }
export interface ServiceUpdate { name?: string; description?: string; coverUrl?: string; priceText?: string; priceAmount?: number; sortOrder?: number; bookingEnabled?: boolean; isEnabled?: boolean; categoryKey?: string; config?: Record<string, unknown> }
export interface BookingItemInput { serviceId: string; quantity: number }
export interface CreateBookingInput {
@@ -109,6 +109,8 @@ export class ApiClient {
getAdminBrand(): Promise<BrandProfile> { return this.request("/admin/config/brand"); }
updateAdminBrand(body: BrandUpdate): Promise<BrandProfile> { return this.request("/admin/config/brand", { method: "PATCH", body }); }
updateAdminService(id: string, body: ServiceUpdate): Promise<PublicService> { return this.request(`/admin/config/services/${encodeURIComponent(id)}`, { method: "PATCH", body }); }
listAdminServices(): Promise<PublicService[]> { return this.request("/admin/config/services"); }
createAdminService(body: ServiceUpdate & { name: string; description: string }): Promise<PublicService> { return this.request("/admin/config/services", { method: "POST", body }); }
private async request<T>(path: string, options: { method?: string; body?: unknown } = {}): Promise<T> {
const headers: Record<string, string> = { accept: "application/json" };
if (options.body !== undefined) headers["content-type"] = "application/json";