fix: 收敛模板编辑发布契约并还原餐饮页面视觉

This commit is contained in:
que01 committed 2026-10-08 13:36:59 +08:00
1 parent 20bcb43534
commit f4061a24bd
102 files changed
+4510 -870

No files matched your search

@@ -1,6 +1,5 @@
import {
Button,
Card,
Form,
Input,
Modal,
@@ -47,6 +46,18 @@ export function ServicesPage() {
.flatMap((section) =>
section.fields.filter((field) => field.binding.startsWith("offering.config.")),
);
const offeringPageLabel =
workspace.data?.templateContent?.navigation.find((item) => item.page === "offerings")?.label ??
"业务展示页";
const detailPageLabel =
workspace.data?.templateContent?.navigation.find((item) => item.page === "detail")?.label ??
"详情页";
const detailSections = (workspace.data?.templateContent?.admin.sections ?? []).filter(
(section) => section.target === "offering" && section.page === "detail",
);
const hasTemplateDetailCopy = templateFields.some(
(field) => field.binding === "offering.config.details.background",
);
const saveOffering = useMutation({
mutationFn: (values: Record<string, unknown>) => {
const fields = Object.fromEntries(
@@ -129,15 +140,28 @@ export function ServicesPage() {
}}
>
<AdminPageHeader
title="业务提供项"
description="管理你向外提供的服务、产品、套餐和合作项目,让访客清楚知道如何与你合作。"
title="小程序内容:业务展示与详情"
description={`在「${offeringPageLabel}」管理访客能选择的服务、产品或案例;每项内容的补充资料会显示在对应的「${detailPageLabel}」。`}
extra={
<Button type="primary" onClick={() => beginOffering()}>
新增业务提供项
</Button>
}
/>
<Card title="公开业务提供项" extra={<Tag color="blue">小程序优先展示</Tag>}>
<section aria-label="业务提供项列表">
<Space wrap style={{ marginBottom: 16 }}>
<Typography.Title level={5} style={{ margin: 0 }}>
{offeringPageLabel}中的内容
</Typography.Title>
<Tag color="blue">已启用的项目会公开展示</Tag>
</Space>
{detailSections.length ? (
<Typography.Paragraph type="secondary">
编辑单项详情时,附加字段将用于:
{detailSections.map((section) => section.title).join("、")}
。列表中的名称、说明、价格和封面也会显示在业务展示页。
</Typography.Paragraph>
) : null}
<Table
scroll={{ x: 760 }}
rowKey="id"
@@ -211,7 +235,7 @@ export function ServicesPage() {
<MutationError error={saveOffering.error} />
<MutationError error={toggleOffering.error} />
<MutationError error={deleteOffering.error} />
</Card>
</section>
<Modal
open={offeringOpen}
title={editingOffering ? "编辑业务提供项" : "新增业务提供项"}
@@ -244,9 +268,11 @@ export function ServicesPage() {
<Form.Item name="summary" label="一句话说明">
<Input />
</Form.Item>
<Form.Item name="description" label="详细介绍">
<Input.TextArea rows={5} />
</Form.Item>
{!hasTemplateDetailCopy ? (
<Form.Item name="description" label="详细介绍">
<Input.TextArea rows={5} />
</Form.Item>
) : null}
<Form.Item name="priceText" label="价格展示">
<Input placeholder="例如:按现场评估报价 / ¥ 2,800 起" />
</Form.Item>