feat(hotel groups): add price, tags and publish status support
extend HotelGroup type with new fields including coverImage, priceAmount, priceUnit, tags and draft/published status. refactor admin utilities to separate hotel group and vehicle option handling, add proper payload normalization for hotel group submissions including syncing coverImage and image fields. update admin UI components to support hotel group-specific configurations, including default "起/晚" price unit, trimmed and limited tags, and publish status toggle. update admin documentation to reflect new hotel group API, split hotel groups docs from vehicle options, and document all new fields.
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
| `themes` | 主题甄选 | 首页主题卡片和跳转 |
|
||||
| `campaigns` | 特价优惠 | 首页特价优惠活动元信息 |
|
||||
| `routeSections` | 精选线路子分组 | 首页“精选线路”按运营任务新增分组,维护标题、副文案、启用状态和关联商品 |
|
||||
| `hotelGroups` | 特色酒店 | 首页“特色酒店”卡片,维护标题、描述、封面图、启用状态和排序 |
|
||||
| `hotelGroups` | 特色酒店 | 首页“特色酒店”卡片,维护标题、描述、价格、标签、封面图、启用状态和排序 |
|
||||
| `vehicleOptions` | 万趣用车 | 首页“万趣用车”卡片,维护标题、描述、封面图、启用状态和排序 |
|
||||
| `ctaBanners` | 更多服务 | 权益、管家、目的地和需求入口等更多服务卡片 |
|
||||
|
||||
@@ -171,6 +171,14 @@ type SiteCardItem = {
|
||||
updatedAt?: string;
|
||||
};
|
||||
|
||||
type HotelGroupItem = SiteCardItem & {
|
||||
coverImage?: string | null;
|
||||
priceAmount?: number | null;
|
||||
priceUnit?: string | null;
|
||||
tags?: string[];
|
||||
status?: "draft" | "published";
|
||||
};
|
||||
|
||||
type CtaBanner = {
|
||||
id: string;
|
||||
alt: string;
|
||||
@@ -194,7 +202,7 @@ type CtaBanner = {
|
||||
| `themes` | `label` | `image`、`targetType`、`targetValue`、`isActive`、`sortOrder` |
|
||||
| `campaigns` | `title`、`slug` | `description`、`coverImage`、`priceAmount`、`priceUnit`、`tags`、`status`、`startsAt`、`endsAt` |
|
||||
| `routeSections` | `title` | `subtitle`、`productIds`、`isActive`、`sortOrder` |
|
||||
| `hotelGroups` | `title` | `description`、`image`、`isActive`、`sortOrder` |
|
||||
| `hotelGroups` | `title` | `description`、`image`、`coverImage`、`priceAmount`、`priceUnit`、`tags`、`status`、`isActive`、`sortOrder` |
|
||||
| `vehicleOptions` | `title` | `description`、`image`、`isActive`、`sortOrder` |
|
||||
| `ctaBanners` | `alt`(服务标题) | `image`、`targetType`、`targetValue`、`isActive`、`sortOrder` |
|
||||
|
||||
@@ -518,36 +526,60 @@ PATCH /api/admin/site-config/routeSections/reorder
|
||||
- 同一商品不能出现在其他精选线路子分组;冲突时返回 `409 ROUTE_SECTION_PRODUCT_CONFLICT`。
|
||||
- `DELETE /api/admin/site-config/routeSections/:id` 删除分组配置并返回被删除 ID;只移除首页分组,不删除关联商品本体。
|
||||
|
||||
## 特色酒店和万趣用车 `hotelGroups` / `vehicleOptions` 专用契约
|
||||
## 特色酒店 `hotelGroups` 专用契约
|
||||
|
||||
`hotelGroups` 对应首页“特色酒店”卡片,`vehicleOptions` 对应首页“万趣用车”卡片。两者都是普通首页内容卡片,不维护商品详情和商品关联。
|
||||
`hotelGroups` 对应首页“特色酒店”卡片。它复用“特价优惠”的数据配置体验,支持新增、编辑、删除、排序,并维护标题、描述、价格、标签、封面图、启用状态;不维护商品详情和商品关联。
|
||||
|
||||
字段语义:
|
||||
|
||||
| 字段 | 类型 | 创建 | 更新 | 说明 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| `id` | `string` | 后端生成 | 不允许修改 | 卡片唯一 id |
|
||||
| `title` | `string` | 必填 | 可选 | 卡片标题,提交时 trim 后不能为空 |
|
||||
| `description` | `string \| null` | 可选 | 可选 | 卡片描述,空字符串可归一化为 `null` |
|
||||
| `image` | `string \| null` | 可选 | 可选 | 卡片封面图 OSS URL;上传仍走媒体接口 |
|
||||
| `isActive` | `boolean` | 可选 | 可选 | 用户侧是否展示;未传默认 `true` |
|
||||
| `sortOrder` | `number` | 可选 | 可选 | 展示顺序;未传时追加到模块末尾 |
|
||||
|
||||
两类模块均复用通用接口:
|
||||
| `id` | `string` | 后端生成 | 不允许修改 | 酒店卡片配置项 ID |
|
||||
| `title` | `string` | 必填 | 可选 | 酒店卡片标题,保存时去掉首尾空格,不能为空 |
|
||||
| `description` | `string \| null` | 可选 | 可选 | 酒店卡片描述,空字符串可归一为 `null` |
|
||||
| `image` | `string \| null` | 可选 | 可选 | 兼容旧字段;后端应与 `coverImage` 保持一致 |
|
||||
| `coverImage` | `string \| null` | 可选 | 可选 | 酒店封面图主字段,管理端上传组件写入该字段 |
|
||||
| `priceAmount` | `number \| null` | 可选 | 可选 | 价格数值 |
|
||||
| `priceUnit` | `string \| null` | 可选 | 可选 | 价格单位文案,默认建议 `起/晚` |
|
||||
| `tags` | `string[]` | 可选 | 可选 | 标签数组,最多 3 个,保存时去掉空标签 |
|
||||
| `status` | `"draft" \| "published"` | 可选 | 可选 | 发布状态;管理端“前台启用”开关同步维护该字段 |
|
||||
| `isActive` | `boolean` | 可选 | 可选 | 前台启用状态;Public API 只返回 `status="published"` 且 `isActive=true` 的项 |
|
||||
| `sortOrder` | `number` | 可选 | 可选 | 首页展示顺序 |
|
||||
|
||||
```http
|
||||
POST /api/admin/site-config/hotelGroups
|
||||
PATCH /api/admin/site-config/hotelGroups/:id
|
||||
DELETE /api/admin/site-config/hotelGroups/:id
|
||||
PATCH /api/admin/site-config/hotelGroups/reorder
|
||||
```
|
||||
|
||||
删除只删除首页酒店卡片配置,不删除任何商品、目的地或素材库资源。Public API 只返回 `published` 且启用项,并按 `sortOrder` 升序输出;无启用项时 MiniAPP 使用本地 `src/content.ts` 兜底内容。
|
||||
|
||||
## 万趣用车 `vehicleOptions` 专用契约
|
||||
|
||||
`vehicleOptions` 对应首页“万趣用车”卡片,仍是普通首页内容卡片,不维护商品详情和商品关联。
|
||||
|
||||
字段语义:
|
||||
|
||||
| 字段 | 类型 | 创建 | 更新 | 说明 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| `id` | `string` | 后端生成 | 不允许修改 | 用车卡片配置项 ID |
|
||||
| `title` | `string` | 必填 | 可选 | 卡片标题,保存时去掉首尾空格,不能为空 |
|
||||
| `description` | `string \| null` | 可选 | 可选 | 卡片描述,空字符串可归一为 `null` |
|
||||
| `image` | `string \| null` | 可选 | 可选 | 卡片封面图 URL |
|
||||
| `isActive` | `boolean` | 可选 | 可选 | 前台启用状态 |
|
||||
| `sortOrder` | `number` | 可选 | 可选 | 首页展示顺序 |
|
||||
| `createdAt` | `string` | 后端生成 | 后端维护 | ISO 时间字符串,可选返回 |
|
||||
| `updatedAt` | `string` | 后端生成 | 后端维护 | ISO 时间字符串,可选返回 |
|
||||
|
||||
```http
|
||||
POST /api/admin/site-config/vehicleOptions
|
||||
PATCH /api/admin/site-config/vehicleOptions/:id
|
||||
DELETE /api/admin/site-config/vehicleOptions/:id
|
||||
PATCH /api/admin/site-config/vehicleOptions/reorder
|
||||
```
|
||||
|
||||
删除只删除首页卡片配置,不删除任何商品、目的地或素材库资源。Public API 只返回启用项,并按 `sortOrder` 升序输出;无启用项时 MiniAPP 使用本地 `src/content.ts` 兜底内容。
|
||||
删除只删除首页用车卡片配置,不删除任何商品、目的地或素材库资源。Public API 只返回启用项,并按 `sortOrder` 升序输出;无启用项时 MiniAPP 使用本地 `src/content.ts` 兜底内容。
|
||||
|
||||
## 更多服务 `ctaBanners` 专用契约
|
||||
|
||||
@@ -596,7 +628,7 @@ type SiteConfig = {
|
||||
themes: ThemeCard[];
|
||||
campaigns: Campaign[];
|
||||
routeSections: RouteSection[];
|
||||
hotelGroups: SiteCardItem[];
|
||||
hotelGroups: HotelGroupItem[];
|
||||
vehicleOptions: SiteCardItem[];
|
||||
ctaBanners: CtaBanner[];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user