From e807bba1cba9738ce59f599e5c21b0a9b80d5866 Mon Sep 17 00:00:00 2001 From: que01 Date: Sat, 19 Sep 2026 12:38:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=8E=E5=8F=B0=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E8=A1=8C=E4=B8=9A=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/admin/src/main.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 }); } }