vr-shopxo-plugin/docs/PHASE2_PLAN.md

79 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# Phase 2 — 计划与当前状态
> 版本v3.0 | 日期2026-04-20 | 状态:实现准备就绪
> 关联 Issue#13
> 关联文档:`docs/VR_GOODS_CONFIG_SPEC.md`v3.0 JSON 格式,已确认)
---
## ⚠️ v3.0 核心变更摘要
- 新增 `template_snapshot` 字段(发布时从 `vr_seat_templates.seat_map` 读取并存储)
- `selected_sections` 保持对象格式 `{ room_id: ["A","B"] }`
- `spec_base_id_map` 不入库GetGoodsViewData 从 `goods_spec_base.extends->seat_key` 动态构建
- 现有前端编辑体验**完全不受影响**(前端只提交选择项)
完整规格见 `docs/VR_GOODS_CONFIG_SPEC.md`
---
## 一、vr_goods_config v3.0 结构(已确认)
```json
{
"version": 3.0,
"template_id": 4,
"selected_rooms": ["room_id_xxx"],
"selected_sections": { "room_id_xxx": ["A", "B"] },
"sessions": [{ "start": "15:00", "end": "16:59" }],
"template_snapshot": {
"venue": { ... },
"rooms": [{ "id": "...", "name": "...", "map": [...], "sections": [...], "seats": {...} }]
}
}
```
详细字段说明见 `docs/VR_GOODS_CONFIG_SPEC.md` 第一章。
---
## 二、实现顺序Issue #13
### Step 1AdminGoodsSaveHandle — 保存时填充 template_snapshot
`save_thing_end` 时机BatchGenerate 之前:
1.`template_id` 读取 `vr_seat_templates.seat_map`(最新数据)
2.`selected_rooms` 过滤(只存用户选中的房间)
3. 填充 `config.template_snapshot`
### Step 2BatchGenerate — 写入 extends
insertGetId 中加入 `extends.seat_key = roomId_rowLabel_colNum`
### Step 3GetGoodsViewData — 重写
-`vr_goods_config[0]`,透传 `template_snapshot`
-`goods_spec_base.extends` 动态构建 `spec_base_id_map`
- `selected_sections` 适配对象格式
- `goods_spec_data` 按场次聚合
### Step 4ticket_detail.html JS — seatKey 格式
```javascript
// 改为带 roomId
var seatKey = seat.roomId + '_' + seat.rowLabel + '_' + seat.colNum;
var specBaseId = self.specBaseIdMap[seatKey] || 0;
```
---
## 三、Phase 2 当前状态
| 任务 | 状态 |
|------|------|
| 模板渲染 | ✅ 正常 |
| 票务 footer | ✅ 已精简 |
| Issue #13 实现v3.0 落地) | ⚠️ 待动手 |
| 核销 API | ❌ 未开始 |
| 后台 4 控制器联调 | ❌ 未开始 |