From 3dcc31d717a915487e821d0c51a3c9a368aa002f Mon Sep 17 00:00:00 2001 From: que01 Date: Sat, 19 Sep 2026 18:26:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8E=A5=E5=85=A5=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E5=92=A8=E8=AF=A2=E8=AE=B0=E5=BD=95=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/admin/src/main.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/admin/src/main.tsx b/apps/admin/src/main.tsx index b0de915..0154965 100644 --- a/apps/admin/src/main.tsx +++ b/apps/admin/src/main.tsx @@ -1,7 +1,7 @@ import React, { useState } from "react"; import { createRoot } from "react-dom/client"; import { QueryClient, QueryClientProvider, useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; -import { App, Button, Card, Form, Input, Layout, Menu, Select, Space, Typography, message, Table, Tag, Popconfirm, Modal } from "antd"; +import { App, Button, Card, Form, Input, Layout, Menu, Select, Space, Typography, message, Table, Tag, Popconfirm, Modal, Badge } from "antd"; import { ApiClient } from "@personal-brand/api-client"; import type { BrandProfile, PublicService, TrustContent, TrustContentInput } from "@personal-brand/api-client"; import "antd/dist/reset.css"; @@ -44,7 +44,19 @@ function ServicesPage() { return open()}>新增服务}>{value} }, { title: "价格展示", dataIndex: "priceText" }, { title: "状态", dataIndex: "isEnabled", render: (value) => value ? "已上架" : "已下架" }, { title: "操作", render: (_: unknown, item: PublicService) => }]} /> { setModalOpen(false); setEditing(null); form.resetFields(); }} onOk={() => form.submit()} confirmLoading={save.isPending}>
save.mutate(values)}>
; } -function Dashboard() { const [page, setPage] = useState("brand"); return 个人品牌 setPage(key)} items={[{ key: "brand", label: "品牌信任" }, { key: "trust", label: "信任内容" }, { key: "services", label: "服务与合作" }, { key: "inquiries", label: "咨询记录" }]} />品牌管理后台{page === "brand" ? : page === "trust" ? : page === "services" ? : 该模块正在接入通用配置接口。}; } +const bookingStatusOptions = ["received", "contacting", "confirmed", "completed", "cancelled"] as const; +const bookingStatusLabels: Record = { received: "待处理", contacting: "沟通中", confirmed: "已确认", completed: "已完成", cancelled: "已取消" }; + +function InquiriesPage() { + const client = api(); const queryClientHook = useQueryClient(); + const [status, setStatus] = useState(); + const query = useQuery({ queryKey: ["admin-bookings", status], queryFn: () => client.listAdminBookings(status ? { status: status as never } : {}) }); + const update = useMutation({ mutationFn: ({ id, nextStatus, note }: { id: string; nextStatus: never; note?: string }) => client.updateAdminBookingStatus(id, nextStatus, note), onSuccess: () => { message.success("咨询状态已更新"); void queryClientHook.invalidateQueries({ queryKey: ["admin-bookings"] }); } }); + const markRead = useMutation({ mutationFn: (id: string) => client.markAdminBookingRead(id), onSuccess: () => void queryClientHook.invalidateQueries({ queryKey: ["admin-bookings"] }) }); + return
item.requestType === "inquiry" ? "品牌咨询" : item.requestType === "private_chef" ? "定制服务" : "服务预约" }, { title: "联系人", dataIndex: "customerName" }, { title: "提交时间", dataIndex: "createdAt", render: (value: string) => new Date(value).toLocaleString("zh-CN") }, { title: "状态", dataIndex: "status", render: (value: string) => {bookingStatusLabels[value] ?? value} }, { title: "操作", render: (_: unknown, item: AdminBooking) =>