Files
ircloud-assistant/skills/irun-yidianhuo/order.md

96 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 订单查询接口
## 订单列表
```
POST https://openapi.77ircloud.com/order-aggregation/organizations/orders/search
```
**Header:** `access_token: {token}` + `Content-Type: application/json`
**Body 参数:**
```json
{
"pageNum": 1,
"pageSize": 10,
"withDetails": true
}
```
**关键参数说明:**
| 参数 | 类型 | 说明 |
|------|------|------|
| `withDetails` | boolean | **⚠️ 重要**true=返回 `orderDetails`商品明细false=不返回 |
| `pageNum` | int | 页码 |
| `pageSize` | int | 每页数量建议不超过100 |
**⚠️ 注意:`orderStatus` 参数会导致 500 错误!** 正确做法:先拉全量订单,在返回结果中用 `orderStatus` 字段过滤。
**订单状态枚举值(从数据中观测):**
- `ORDER_AUDIT_PENDING` — 待订单审核7条测试数据
- `FINANCE_AUDIT_PENDING` — 待财务审核
- `AUDITED` — 已审核34条测试数据
- `FINISHED` — 已完成9条测试数据
- `CANCELLED` — 已作废
**返回字段(重要!)**
- 订单列表在 `data.items`(不是 `data.list`
- 分页信息:`data.totalCount``data.currentPage``data.totalPage`
**返回示例(已审核订单):**
```json
{
"id": 2374359742917152,
"orderCode": "CA000000-260309-79705",
"buyer": {"id": 2139500795701856, "name": "粥大师店(南宁)"},
"orderStatus": "ORDER_AUDIT_PENDING",
"paymentStatus": "UN_PAID",
"createTime": 1774344996000
}
```
**`withDetails: true` 时返回的 `orderDetails` 结构:**
```json
{
"id": 2385059802414657,
"orderCode": "CA000000-260324-95463",
"productSku": 2116792188293408,
"productSpu": 2116792188162336,
"productCode": "101-030-0008",
"productName": "霜火菓子(柿子+花生)",
"type": "NORMAL",
"purchaseNumbers": 2.0,
"unitName": "包",
"salePrice": 9.3,
"subtotal": 18.6
}
```
**关键字段:**
- `productSku`: 商品 SKU ID用于关联库存
- `purchaseNumbers`: 购买数量(判断是否 > 2 的依据)
- `productName`: 商品名称
---
## 订单审核
```
PUT https://openapi.77ircloud.com/order-aggregation/organizations/orders/order-audit
```
**Header:** `access_token: {token}` + `Content-Type: application/json`
**Body**
```json
{"ids": [2374359742917152]}
```
**返回:**
```json
{"code": 200, "message": "操作成功"}
```
**⚠️ 注意:** 部分订单(如客户结算模式为"先款后货"需要先付款才能审核API会返回 525 错误码和具体原因,此时该订单无法自动审核。