diff --git a/apps/admin/src/main.ts b/apps/admin/src/main.ts
index 9dcd2e1..5b44bbd 100644
--- a/apps/admin/src/main.ts
+++ b/apps/admin/src/main.ts
@@ -11,7 +11,7 @@ export class AdminDashboard {
const { root, client } = this.options;
const [bookings, unread, brand, services] = await Promise.all([client.listAdminBookings(), client.getAdminUnreadCount(), client.getAdminBrand(), client.listServices()]);
this.bookings = bookings;
- root.innerHTML = `
品牌后台
未读订单:${unread.count}
`;
+ root.innerHTML = `品牌后台
未读订单:${unread.count}
`;
root.querySelector("#refresh")?.addEventListener("click", () => void this.load());
root.querySelector("#status")?.addEventListener("change", () => void this.filter());
root.querySelector("#save-brand")?.addEventListener("click", () => void this.saveBrand());
@@ -23,7 +23,7 @@ export class AdminDashboard {
private async filter(): Promise { const status = (this.options.root.querySelector("#status") as HTMLSelectElement).value as BookingStatus | ""; this.bookings = await this.options.client.listAdminBookings(status ? { status } : {}); const list = this.options.root.querySelector("#bookings"); if (list) list.innerHTML = this.listHtml(); }
private select(id: string | undefined): void { this.selected = this.bookings.find((item) => item.id === id); if (!this.selected) return; const detail = this.options.root.querySelector("#detail"); if (!detail) return; detail.innerHTML = `${this.selected.bookingNo}
客户:${this.selected.customerName}
`; detail.querySelector("#save")?.addEventListener("click", () => void this.save()); }
private async save(): Promise { if (!this.selected) return; const detail = this.options.root.querySelector("#detail")!; const status = (detail.querySelector("#detail-status") as HTMLSelectElement).value as BookingStatus; const note = (detail.querySelector("#note") as HTMLTextAreaElement).value; this.selected = await this.options.client.updateAdminBookingStatus(this.selected.id, status, note); await this.load(); }
- private async saveBrand(): Promise { const root = this.options.root; await this.options.client.updateAdminBrand({ name: (root.querySelector("#brand-name") as HTMLInputElement).value, description: (root.querySelector("#brand-description") as HTMLTextAreaElement).value, contactPhone: (root.querySelector("#brand-phone") as HTMLInputElement).value, contactWechat: (root.querySelector("#brand-wechat") as HTMLInputElement).value }); }
+ private async saveBrand(): Promise { const root = this.options.root; await this.options.client.updateAdminBrand({ templateKey: (root.querySelector("#brand-template") as HTMLSelectElement).value as "food" | "personal", name: (root.querySelector("#brand-name") as HTMLInputElement).value, description: (root.querySelector("#brand-description") as HTMLTextAreaElement).value, contactPhone: (root.querySelector("#brand-phone") as HTMLInputElement).value, contactWechat: (root.querySelector("#brand-wechat") as HTMLInputElement).value }); }
private async saveService(id: string | undefined): Promise { if (!id) return; const root = this.options.root; await this.options.client.updateAdminService(id, { name: (root.querySelector(`[data-service-name="${id}"]`) as HTMLInputElement).value, priceText: (root.querySelector(`[data-service-price="${id}"]`) as HTMLInputElement).value }); }
}