# 用户使用流程图 — 商城交易 ```mermaid flowchart TD %% ============ 颜色定义 ============ classDef actor fill:#e1f5fe,stroke:#0288d1,stroke-width:2px classDef action fill:#fff3e0,stroke:#f57c00,stroke-width:1px classDef system fill:#e8f5e9,stroke:#388e3c,stroke-width:1px classDef decision fill:#fce4ec,stroke:#d32f2f,stroke-width:1px classDef role fill:#f3e5f5,stroke:#7b1fa2,stroke-width:1px classDef endpoint fill:#f5f5f5,stroke:#616161,stroke-width:1px,shape:box subgraph 商品浏览 A1(("用户")) --> A2[获取商品分类 /category/tree] A2 --> A3[查看分类商品 /category/products] A3 --> A4[获取商品列表 /list] A4 --> A5[获取商品详情 /detail] A5 --> A6[获取规格映射 /spec/map] end subgraph 购物车 A6 --> B1[添加购物车 /cart/add] B1 --> B2[获取购物车列表 /cart/list] B2 --> B3[更新购物车 /cart/update] B3 --> B4[移除商品 /cart/remove] B4 --> B5[获取购物车数量 /cart/count] end subgraph 下单支付 B5 --> C1[创建订单 /product/order/create] C1 --> C2[支付 /product/order/pay] C2 --> C3[支付回调 /product/order/notify] C3 --> C4[处理支付成功 /handlePaymentSuccess] end subgraph 订单管理 C4 --> D1[获取我的订单 /my] D1 --> D2[订单数量统计 /my/counts] D2 --> D3[订单详情 /detail] D3 --> D4{订单状态} D4 -->|待发货| D5[取消订单 /cancel] D4 -->|已发货| D6[确认收货 /confirm] D4 -->|待退款| D7[申请退款 /refund/apply] end subgraph 商家发货 D6 --> E1[商家发货 /ship] E1 --> E2[查询物流 /logistics/query] end subgraph 售后 D7 --> F1[创建售后 /after-sales/create] F1 --> F2[售后列表 /after-sales/list] F2 --> F3[售后详情 /after-sales/detail] end subgraph 评价 D6 --> G1[发表评价 /review/order] G1 --> G2[评价详情 /review/order/detail] G2 --> G3[评价状态 /review/order/status] end R1(("👤 用户")):::actor R2(("🏪 商家")):::role R3(("💳 支付")):::system A1 -.- R1 E1 -.- R2 C2 -.- R3 ``` ## 端点明细 | 端点 | 说明 | |------|------| | `/api/product/list` | 商品列表 | | `/api/product/detail` | 商品详情 | | `/api/product/create` | 创建商品(商家) | | `/api/product/update` | 更新商品 | | `/api/product/my` | 我的商品 | | `/api/product/shelve` | 上下架 | | `/api/product/images/update` | 更新图片 | | `/api/product/spec/map` | 规格映射 | | `/api/product/order/create` | 创建订单 | | `/api/product/order/pay` | 支付 | | `/api/product/order/cancel` | 取消订单 | | `/api/product/order/my` | 我的订单 | | `/api/product/order/my/counts` | 订单数量统计 | | `/api/product/order/detail` | 订单详情 | | `/api/product/order/vendor` | 商家订单 | | `/api/product/order/confirm` | 确认收货 | | `/api/product/order/ship` | 发货 | | `/api/product/order/refund/apply` | 申请退款 | | `/api/product/order/handlePaymentSuccess` | 处理支付成功 | | `/api/product/order/notify` | 支付回调 | | `/api/product/order/activity/audit` | 活动审核 | | `/api/product/order/activity/sign-in` | 活动签到 | | `/api/product/order/activity/complete` | 活动完成 | | `/api/product/order/activity/provision` | 活动供应 | | `/api/product/order/activity/qr-image` | 活动二维码 | | `/api/cart/add` | 添加购物车 | | `/api/cart/list` | 购物车列表 | | `/api/cart/update` | 更新购物车 | | `/api/cart/remove` | 移除商品 | | `/api/cart/count` | 购物车数量 | | `/api/shop/category/tree` | 分类树 | | `/api/shop/category/products` | 分类商品 | | `/api/shop/after-sales/create` | 创建售后 | | `/api/shop/after-sales/list` | 售后列表 | | `/api/shop/after-sales/detail` | 售后详情 | | `/api/shop/logistics/query` | 查询物流 | | `/api/review/order` | 发表评价 | | `/api/review/order/detail` | 评价详情 | | `/api/review/order/status` | 评价状态 |