对接文档重构:两种发货对接方式分开展示

- 左侧目录按分组展示:基础接口 / 发货链接模式 / 自建发货页模式 / 回调 / 附录
- 概述页发货对接方式对比表强化(适用场景/接口顺序/建议)
- 创建订单响应示例 data 统一为约定字段,补充 201/200 状态说明
- 对外响应字段 upstream_order 更名为 delivery(result_data 存储键兼容旧数据)
This commit is contained in:
yml2213
2026-08-03 14:48:30 +08:00
parent 4019b657c4
commit b7b9132242
4 changed files with 61 additions and 26 deletions
+39 -19
View File
@@ -19,15 +19,18 @@ const baseUrl =
const deliveryModes = [
{
mode: 'Web 发货页',
scene: '商户想要“只返回一个链接”,让用户直接打开平台页面填写 UID',
mode: '发货链接模式',
scene: '实现最简:下单后拿一个签名链接,直接跳转平台发货页,由买家在页面上绑定账号并提交',
interfaces: '/api/client/v1/orders/{order_no}/delivery-link',
steps: '下单 → 获取发货链接 → 链接给买家 → 平台页完成发货',
recommend: '商户无自建发货页、想最快上线时使用',
},
{
mode: '自建发货页',
scene: '商户自己有前端页面,在自己的系统里完成发货流程',
interfaces:
'/api/client/v1/orders/{order_no}/delivery\n/api/client/v1/orders/{order_no}/delivery/bind\n/api/client/v1/orders/{order_no}/delivery/submit',
mode: '自建发货页模式',
scene: '商户自己有前端页面,把发货流程嵌在自己的系统里(可预填下单时透传的账号/区服)',
interfaces: '/api/client/v1/orders/{order_no}/delivery\n/api/client/v1/orders/{order_no}/delivery/bind\n/api/client/v1/orders/{order_no}/delivery/submit',
steps: '下单 → 查询发货数据 → 发起绑定 → 提交发货',
recommend: '商户需要自定义发货交互(展示区服、预填账号)时使用',
},
]
@@ -48,6 +51,16 @@ interface TocGroup {
}
function buildToc(): TocGroup[] {
const tocItems = (eps: typeof endpoints) =>
eps.map((ep) => ({
id: `ep-${ep.key}`,
label: ep.title,
children: endpointSections.map((s) => ({
id: `ep-${ep.key}-${s.id}`,
label: s.label,
level: 3 as const,
})),
}))
return [
{
title: '开始',
@@ -57,16 +70,16 @@ function buildToc(): TocGroup[] {
],
},
{
title: '接口',
items: endpoints.map((ep) => ({
id: `ep-${ep.key}`,
label: ep.title,
children: endpointSections.map((s) => ({
id: `ep-${ep.key}-${s.id}`,
label: s.label,
level: 3 as const,
})),
})),
title: '基础接口',
items: tocItems(endpoints.filter((ep) => ep.group === 'basic')),
},
{
title: '发货链接模式',
items: tocItems(endpoints.filter((ep) => ep.group === 'delivery-link')),
},
{
title: '自建发货页模式',
items: tocItems(endpoints.filter((ep) => ep.group === 'delivery-self')),
},
{
title: '回调',
@@ -321,12 +334,12 @@ function OverviewSection() {
<li> API / API <Text code>AppKey</Text> <Text code>AppSecret</Text></li>
<li> <Text code>X-App-Key / X-Timestamp / X-Nonce / X-Sign</Text> </li>
<li> <Text code>sku</Text></li>
<li> <Text code>order_no</Text> </li>
<li> <Text code>order_no</Text> </li>
<li></li>
</ol>
}
/>
<Card className="api-docs__card" size="small" title="发货链路概览">
<Card className="api-docs__card" size="small" title="发货对接方式(二选一,先选好再看对应接口)">
<Table
className="api-docs__table"
size="small"
@@ -334,13 +347,20 @@ function OverviewSection() {
rowKey="mode"
dataSource={deliveryModes}
columns={[
{ title: '式', dataIndex: 'mode', width: 140 },
{ title: '式', dataIndex: 'mode', width: 130 },
{ title: '适用场景', dataIndex: 'scene' },
{
title: '接口顺序',
dataIndex: 'steps',
width: 250,
render: (v: string) => <pre className="api-docs__pre">{v}</pre>,
},
{
title: '相关接口',
dataIndex: 'interfaces',
render: (v: string) => <pre className="api-docs__pre">{v}</pre>,
},
{ title: '建议', dataIndex: 'recommend', width: 170 },
]}
/>
</Card>