快速下单

This commit is contained in:
2026-08-13 09:50:06 +08:00
parent f3366cb2fa
commit 74edf76e72
13 changed files with 403 additions and 77 deletions
+60 -2
View File
@@ -2,7 +2,7 @@ openapi: 3.0.3
info:
title: 柏悦头程订单 API
description: 业务成功和失败均使用 HTTP 200;仅响应体 code 为字符串 "200" 时表示成功,其他 code 表示失败。
version: 1.5.0
version: 1.6.0
security:
- bearerAuth: []
paths:
@@ -171,6 +171,32 @@ paths:
schema: {$ref: '#/components/schemas/FirstLegOrderDraft'}
responses:
'200': {description: 成功或业务失败,按响应体 code 判断}
/api/merchant/v1/orders/first-leg/batch:
post:
summary: 批量创建头程订单草稿
description: >-
一次请求为多个外层行创建草稿;每个数组元素对应一张草稿,元素内 cargoes
对应该行的多个产品明细。每项独立处理,允许部分成功;草稿仅校验渠道、目的仓、SKU
和箱数,提交审核前再执行完整货物与提货资料校验。最多 50 项。
parameters:
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema:
type: array
minItems: 1
maxItems: 50
items: {$ref: '#/components/schemas/FirstLegBatchDraftItem'}
responses:
'200':
description: 批量处理完成;业务失败通过 items.errorCode 和 items.errorMessage 逐项返回
content:
application/json:
schema: {$ref: '#/components/schemas/FirstLegBatchDraftResponse'}
'400': {description: 请求数组为空、超过 50 项或幂等键缺失}
'403': {description: 需要 merchant:order:create 权限}
/api/merchant/v1/orders/first-leg/{id}/submit:
post:
summary: 提交订单
@@ -534,9 +560,41 @@ components:
description: >-
订单保存请求中的完整字段以服务端 FirstLegOrderSaveRequest 为准;pricingTaxMode
是新建和编辑订单的必填报价维度;历史存量订单的响应字段仍允许为空。
FirstLegBatchDraftItem:
type: object
required: [clientRowId, draft]
properties:
clientRowId:
type: string
maxLength: 128
description: 前端外层行标识;同一批次内必须唯一,用于幂等重试和结果关联
draft:
$ref: '#/components/schemas/FirstLegOrderDraft'
FirstLegBatchDraftResponse:
type: object
required: [total, succeeded, failed, items]
properties:
total: {type: integer, minimum: 0}
succeeded: {type: integer, minimum: 0}
failed: {type: integer, minimum: 0}
items:
type: array
items: {$ref: '#/components/schemas/FirstLegBatchDraftResult'}
FirstLegBatchDraftResult:
type: object
required: [index, success]
properties:
index: {type: integer, minimum: 0}
clientRowId: {type: string}
success: {type: boolean}
orderId: {type: string, pattern: '^[1-9][0-9]*$'}
orderNo: {type: string}
inboundCode: {type: string, pattern: '^RK-[A-Za-z0-9-]+$'}
errorCode: {type: string}
errorMessage: {type: string}
FirstLegOrderCargo:
type: object
required: [cargoName, packageType, packageCount, grossWeightKg, volumeCbm]
required: [skuNo, packageCount]
properties:
skuNo: {type: string, maxLength: 64}
cargoName: {type: string, maxLength: 128}