# Store 前台购物流 E2E 验证报告

**验证时间：** 2026-05-10 00:03 UTC+12
**验证人：** 子 Agent（前台购物端到端验证）
**服务器：** 192.168.50.139:22022
**项目路径：** /data/sme-omnistore-p0-remediated-20260509

---

## 一、订单创建端到端验证

### 1.1 后端 CreateOrderIn 字段确认

CreateOrderIn.items 包含 CartItemIn: { product_id, qty, variant_id }，recv_name/phone/province/city/district/addr, pay_method, coupon_code, points_to_use, remark。

### 1.2 完整下单流程验证

| 步骤 | 接口 | 方法 | 结果 |
|------|------|------|------|
| 注册/登录 | /api/store/auth/register | POST | ✅ 创建 token (user_id=88) |
| 订单预览 | /api/store/orders/preview | POST | ✅ 返回 lines/subtotal/grand_total |
| 创建订单 | /api/store/orders | POST | ✅ 创建成功，返回 order_no |
| 订单列表 | /api/store/orders | GET | ✅ 返回 items_count, total, status |
| 订单详情 | /api/store/orders/{order_no} | GET | ✅ 返回 items、收货地址 |
| 模拟支付 | /api/store/orders/{order_no}/pay | POST | ✅ status → paid，积分+136 |
| 取消订单 | /api/store/orders/{order_no}/cancel | POST | ✅ status → cancelled |
| 确认收货 | /api/store/orders/{order_no}/confirm | POST | ✅ 仅 shipped 可操作，正确拒绝 paid 订单 |

### 1.3 variant_id 支持验证

- 后端 CreateOrderIn.items 包含 variant_id: Optional[int] ✅
- 后端 pricing_svc.PricingCartItem(product_id, variant_id, qty) ✅
- 前端 checkout/index.vue: payload.items 每项含 variant_id ✅
- cart.ts store: addItem 接受 variant_id，生成 key \${id}_\${variant_id ?? 0} ✅

### 1.4 运费计算

小计 < 99 元 → 运费 10 元；小计 ≥ 99 元 → 免运费 ✅ 后端正确计算

---

## 二、账户页订单列表验证

### 2.1 后端 API 字段

GET /api/store/orders 返回: { total, page, page_size, items: [{ id, order_no, status, total, created_at, items_count }] }

### 2.2 前端 _mapOrder 映射

Map: id, order_no, status, statusLabel, statusColor, total (Number(o.total??o.grand_total??0).toFixed(2)), itemCount (o.items_count??o.items?.length??0), rawItems (o.items??[]), created_at (split T) ✅

### 2.3 订单详情模态框

调用 GET /api/store/orders/{order_no}，展示 items、shipping_address ✅
状态颜色: pending→橙色, paid→蓝色, shipped→紫色, completed→绿色 ✅
去付款/确认收货/再次购买按钮均正常 ✅

---

## 三、收货地址完整 CRUD

| 操作 | 接口 | 方法 | 结果 |
|------|------|------|------|
| 列表 | /api/store/addresses | GET | ✅ AddressOut[] |
| 创建 | /api/store/addresses | POST | ✅ id=3, is_default 正确 |
| 更新 | /api/store/addresses/{id} | PUT | ✅ name 更新成功 |
| 删除 | /api/store/addresses/{id} | DELETE | ✅ 204 No Content |

checkout/index.vue: loadSavedAddresses() + applyAddr(addr) 填充表单 ✅

---

## 四、购物车页面验证

商品列表/variant显示/删除/数量修改/全选/删除选中/运费计算/跳转结算 ✅

---

## 五、wishlist.vue 验证

心愿单列表/全选多选加入购物车/单个加入/移除/清空(确认弹窗)/价格折扣标签/猜你喜欢/排序/localStorage持久化 ✅

---

## 六、最终构建验证

npm run build → ✨ Build complete! Σ Total size: 3.31 MB (769 kB gzip) ✅ 无 error

---

## 七、发现问题

### 问题 1：取消订单无前端入口（低优先级）
account/index.vue pending 订单只有"去付款"，缺少"取消订单"按钮。后端 cancel 接口功能正常。建议添加红色"取消订单"文字按钮。

### 问题 2：数据库无带 variant 的商品
所有商品 variant_options = null，无法真实测试 variant 下单。代码链路完整（前端传递→后端接受→扣库存），逻辑验证通过。

---

## 八、综合结论

| 模块 | 状态 |
|------|------|
| 订单创建（无 variant） | ✅ PASS |
| variant_id 支持链路 | ✅ PASS |
| 订单列表/详情/支付/取消/确认收货 | ✅ PASS |
| 收货地址 CRUD | ✅ PASS |
| checkout 地址选择 | ✅ PASS |
| 购物车页面 | ✅ PASS |
| wishlist.vue | ✅ PASS |
| 最终构建 | ✅ PASS |

总体结论：Store 前台购物流端到端链路全部通过，代码功能完整，构建成功。
