# Contracts: 订单列表接口 三个新列表接口,统一返回 `{ records, total, page, size }` 格式。 ## 1. 用户端订单列表 **Endpoint**: `GET /system/userOrder/orderList` **Auth**: 用户 token (Header) ### 请求参数 | 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | page | int | 是 | 页码,从1开始 | | size | int | 是 | 每页条数 | | tab | String | 是 | unpaid / active / completed / cancelled / refund | | type | String | 否 | 0外送 / 1自取 / 2堂食,不传查所有 | ### Tab 查询条件 | tab | 条件 | |-----|------| | unpaid | `payStatus=0 AND type=0` | | active | `state IN (0,1,2) AND afterSaleStatus=0 AND (payStatus=1 OR type IN (1,2))` | | completed | `state=3 AND afterSaleStatus=0` | | cancelled | `state=4 AND afterSaleStatus=0` | | refund | `afterSaleStatus > 0` | ### 响应格式 ```json { "code": 200, "msg": "操作成功", "data": { "records": [{ /* PosOrder 全字段 + shanghu + store + shaddress + user + food + parentRemarks */ }], "total": 100, "page": 1, "size": 10 } } ``` --- ## 2. 商家端订单列表 **Endpoint**: `GET /system/orderShOprate/orderList` **Auth**: 商家 token (Header) ### 请求参数 | 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | page | int | 是 | 页码 | | size | int | 是 | 每页条数 | | tab | String | 是 | pending / preparing / ready / completed / cancelled / refund | | mdId | String | 是 | 门店ID | | type | String | 否 | 订单类型筛选 | ### Tab 查询条件 | tab | 条件 | |-----|------| | pending | `state=0 AND (payStatus=1 OR type IN (1,2)) AND mdId=?` | | preparing | `state=1 AND mdId=?` | | ready | `state=2 AND afterSaleStatus=0 AND mdId=?` | | completed | `state=3 AND afterSaleStatus=0 AND mdId=?` | | cancelled | `state=4 AND afterSaleStatus=0 AND mdId=?` | | refund | `afterSaleStatus > 0 AND mdId=?` | --- ## 3. 骑手端订单列表 **Endpoint**: `GET /system/orderQsOprate/orderList` **Auth**: 骑手 token (Header,JwtUtil.getusid 即 qsId) ### 请求参数 | 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | page | int | 是 | 页码 | | size | int | 是 | 每页条数 | | tab | String | 是 | newTask / toPickup / delivering / completed / cancelled / refund | | longitude | BigDecimal | 条件必填 | newTask Tab 必填 | | latitude | BigDecimal | 条件必填 | newTask Tab 必填 | ### Tab 查询条件 | tab | 条件 | 排序 | |-----|------|------| | newTask | `type=0 AND deliveryStatus=0 AND state=2 AND afterSaleStatus=0` | 距离 ASC | | toPickup | `deliveryStatus=1 AND qsId=当前骑手 AND afterSaleStatus=0` | 时间 ASC | | delivering | `deliveryStatus=2 AND qsId=当前骑手 AND afterSaleStatus=0` | 时间 ASC | | completed | `state=3 AND afterSaleStatus=0 AND qsId=当前骑手` | 时间 DESC | | cancelled | `state=4 AND qsId=当前骑手 AND afterSaleStatus=0` | 时间 DESC | | refund | `afterSaleStatus > 0 AND qsId=当前骑手` | 时间 DESC | --- ## 商家操作接口改造 ### 接单 **Endpoint**: 现有 `PosOrderShOprateController` 接单方法 **变更**: `state` 从 0 改为 1 ### 出餐 **Endpoint**: 现有 `dispatchOrder()` **变更**: - `state` 从 1 改为 2 - 外送订单:额外设置 `deliveryStatus=0` - 自取/堂食:只改 `state=2` ### 完成(自取/堂食) **Endpoint**: 新增方法 **变更**: `state` 从 2 改为 3,`payStatus` 从 0 改为 1 ## 骑手操作接口改造 ### 接单 acceptOrder **变更**: 校验 `type=0 AND afterSaleStatus=0`,设置 `deliveryStatus=1` ### 取餐 pickupOrder **变更**: 校验 `type=0 AND afterSaleStatus=0`,设置 `deliveryStatus=2` ### 送达 deliverOrder **变更**: 设置 `deliveryStatus=3`,同时设置 `state=3` ## 订单创建改造 **Endpoint**: 现有 `UserOrderController.createOrder()` **变更**: - 所有类型:`state=0`、`afterSaleStatus=0`、`deliveryStatus=NULL` - 外送到付(type=0, payType=1):`payStatus=1` - 自取/堂食现金(type=1/2):`payStatus=0` - 在线支付:`payStatus=0`