统一发货口径并保护结果数据
This commit is contained in:
@@ -39,7 +39,7 @@ function AppRoutes() {
|
||||
<Route index element={<Dashboard />} />
|
||||
<Route path="merchant-center" element={<MerchantCenter />} />
|
||||
<Route path="merchant-products" element={<MerchantCenter fixedTab="products" title="商品" />} />
|
||||
<Route path="merchant-orders" element={<MerchantCenter fixedTab="orders" title="履约订单" />} />
|
||||
<Route path="merchant-orders" element={<MerchantCenter fixedTab="orders" title="发货订单" />} />
|
||||
<Route path="merchant-wallet" element={<MerchantCenter fixedTab="wallet" title="钱包" />} />
|
||||
<Route path="merchant-members" element={<MerchantCenter fixedTab="members" title="成员" />} />
|
||||
<Route path="merchant-callbacks" element={<MerchantCenter fixedTab="callbacks" title="回调" />} />
|
||||
|
||||
@@ -66,7 +66,7 @@ const adminSections: SidebarSection[] = [
|
||||
key: 'orders',
|
||||
label: '订单管理',
|
||||
icon: <OrderedListOutlined />,
|
||||
children: [{ key: 'fulfillment-orders', label: '履约订单', path: '/merchant-orders' }],
|
||||
children: [{ key: 'fulfillment-orders', label: '发货订单', path: '/merchant-orders' }],
|
||||
},
|
||||
{
|
||||
key: 'staff',
|
||||
@@ -110,7 +110,7 @@ const merchantSections: SidebarSection[] = [
|
||||
key: 'orders',
|
||||
label: '订单管理',
|
||||
icon: <OrderedListOutlined />,
|
||||
children: [{ key: 'fulfillment-orders', label: '履约订单', path: '/merchant-orders' }],
|
||||
children: [{ key: 'fulfillment-orders', label: '发货订单', path: '/merchant-orders' }],
|
||||
},
|
||||
{
|
||||
key: 'funds',
|
||||
|
||||
@@ -16,14 +16,14 @@ export const errorCodes: ParamSpec[] = [
|
||||
{ name: '500', type: 'int', desc: '服务端内部错误' },
|
||||
]
|
||||
|
||||
// 订单状态与可履约说明。
|
||||
// 订单状态与可发货说明。
|
||||
export const orderStatusTable: ParamSpec[] = [
|
||||
{ name: 'pending', type: 'order_status', desc: '待支付(当前无真实支付流程,仅预留)', example: 'can_fulfill=false' },
|
||||
{ name: 'paid', type: 'order_status', desc: '已支付/已扣款,可发货', example: 'can_fulfill=true' },
|
||||
{ name: 'delivering', type: 'order_status', desc: '发货中', example: 'can_fulfill=false' },
|
||||
{ name: 'delivered', type: 'order_status', desc: '已交付', example: 'can_fulfill=false' },
|
||||
{ name: 'ship_failed', type: 'order_status', desc: '发货失败,可重试', example: 'can_fulfill=true' },
|
||||
{ name: 'cancelled', type: 'order_status', desc: '已取消', example: 'can_fulfill=false' },
|
||||
{ name: 'pending', type: 'order_status', desc: '待支付(当前无真实支付流程,仅预留)', example: 'can_ship=false' },
|
||||
{ name: 'paid', type: 'order_status', desc: '已支付/已扣款,可发货', example: 'can_ship=true' },
|
||||
{ name: 'delivering', type: 'order_status', desc: '发货中', example: 'can_ship=false' },
|
||||
{ name: 'delivered', type: 'order_status', desc: '已交付', example: 'can_ship=false' },
|
||||
{ name: 'ship_failed', type: 'order_status', desc: '发货失败,可重试', example: 'can_ship=true' },
|
||||
{ name: 'cancelled', type: 'order_status', desc: '已取消', example: 'can_ship=false' },
|
||||
]
|
||||
|
||||
// 订单对象公共字段说明,下单/查询/取消响应共用。
|
||||
@@ -31,9 +31,9 @@ const orderFields: ParamSpec[] = [
|
||||
{ name: 'order_no', type: 'string', required: true, desc: '平台订单号' },
|
||||
{ name: 'client_order_no', type: 'string', required: true, desc: '调用方传入的幂等单号' },
|
||||
{ name: 'order_status', type: 'enum', desc: '订单状态,见「状态说明」' },
|
||||
{ name: 'can_fulfill', type: 'bool', desc: '是否允许履约器接单/发货' },
|
||||
{ name: 'cannot_fulfill_reason', type: 'string', desc: 'can_fulfill=false 时的原因' },
|
||||
{ name: 'product.sku', type: 'string', desc: '商品标识,履约以此为准' },
|
||||
{ name: 'can_ship', type: 'bool', desc: '是否允许发货' },
|
||||
{ name: 'cannot_ship_reason', type: 'string', desc: 'can_ship=false 时的原因' },
|
||||
{ name: 'product.sku', type: 'string', desc: '商品标识,发货以此为准' },
|
||||
{ name: 'product.name', type: 'string', desc: '商品展示名' },
|
||||
{ name: 'quantity', type: 'int', desc: '数量' },
|
||||
{ name: 'base_amount', type: 'int', desc: '商品基础金额(最小货币单位)' },
|
||||
@@ -47,7 +47,7 @@ const orderFields: ParamSpec[] = [
|
||||
{ name: 'provider_order_no', type: 'string', desc: '发货平台侧单号' },
|
||||
{ name: 'failure_reason', type: 'string', desc: '最近一次失败原因' },
|
||||
{ name: 'created_at', type: 'datetime', desc: '创建时间' },
|
||||
{ name: 'delivered_at', type: 'datetime', desc: '履约成功时间' },
|
||||
{ name: 'delivered_at', type: 'datetime', desc: '交付时间' },
|
||||
{ name: 'cancelled_at', type: 'datetime', desc: '取消时间' },
|
||||
]
|
||||
|
||||
@@ -58,8 +58,8 @@ const orderResponseExample = `{
|
||||
"order_no": "FO20260730000123",
|
||||
"client_order_no": "shop-10001",
|
||||
"order_status": "paid",
|
||||
"can_fulfill": true,
|
||||
"cannot_fulfill_reason": "",
|
||||
"can_ship": true,
|
||||
"cannot_ship_reason": "",
|
||||
"product": { "sku": "suit_pink_sheep", "name": "套装-糯粉咩咩" },
|
||||
"quantity": 1,
|
||||
"base_amount": 100,
|
||||
@@ -197,7 +197,7 @@ export const endpoints: EndpointSpec[] = [
|
||||
{ name: 'sku', type: 'string', required: true, desc: '商品标识,取自商品列表', example: 'suit_pink_sheep' },
|
||||
{ name: 'quantity', type: 'int', desc: '数量,默认 1', example: '1' },
|
||||
{ name: 'buyer_reference', type: 'string', desc: '买家标识/备注', example: 'buyer-001' },
|
||||
{ name: 'data', type: 'object', desc: '透传给履约器的业务数据(区服、账号等),原样存储并回显' },
|
||||
{ name: 'data', type: 'object', desc: '透传给发货流程的业务数据(区服、账号等),原样存储并回显' },
|
||||
],
|
||||
requestExample: `{
|
||||
"client_order_no": "shop-10001",
|
||||
@@ -215,7 +215,7 @@ export const endpoints: EndpointSpec[] = [
|
||||
"order_no": "FO20260730000123",
|
||||
"client_order_no": "shop-10001",
|
||||
"order_status": "paid",
|
||||
"can_fulfill": true
|
||||
"can_ship": true
|
||||
}
|
||||
}
|
||||
}`,
|
||||
@@ -339,7 +339,7 @@ export const endpoints: EndpointSpec[] = [
|
||||
method: 'POST',
|
||||
path: '/api/client/v1/orders/{order_no}/delivery/submit',
|
||||
title: '提交发货',
|
||||
summary: '提交发货到上游并进入履约中状态',
|
||||
summary: '提交发货到上游并进入发货中状态',
|
||||
scope: 'orders:write',
|
||||
pathParams: [{ name: 'order_no', type: 'string', required: true, desc: '平台订单号', example: 'FO20260730000123' }],
|
||||
bodyParams: [
|
||||
@@ -353,7 +353,7 @@ export const endpoints: EndpointSpec[] = [
|
||||
responseExample: deliverySubmitResponseExample,
|
||||
responseFields: [
|
||||
{ name: 'order_no', type: 'string', desc: '平台订单号' },
|
||||
{ name: 'status', type: 'string', desc: '提交后的履约状态' },
|
||||
{ name: 'status', type: 'string', desc: '提交后的订单状态' },
|
||||
{ name: 'message', type: 'string', desc: '处理结果说明' },
|
||||
{ name: 'provider_order_no', type: 'string', desc: '上游订单号' },
|
||||
{ name: 'game_account', type: 'object', desc: '上游绑定结果' },
|
||||
|
||||
@@ -27,7 +27,7 @@ import { formatDateTime } from '../utils/time'
|
||||
|
||||
const statusMap: Record<string, { color: string; text: string }> = {
|
||||
paid: { color: 'orange', text: '待发货' },
|
||||
delivering: { color: 'blue', text: '履约中' },
|
||||
delivering: { color: 'blue', text: '发货中' },
|
||||
delivered: { color: 'green', text: '已交付' },
|
||||
ship_failed: { color: 'red', text: '发货失败' },
|
||||
cancelled: { color: 'default', text: '已取消' },
|
||||
|
||||
@@ -61,13 +61,13 @@ const scopeOptions = [
|
||||
{ value: 'products:read', label: '商品读取' },
|
||||
{ value: 'orders:read', label: '订单读取' },
|
||||
{ value: 'orders:write', label: '订单写入' },
|
||||
{ value: 'fulfillment:read', label: '履约读取' },
|
||||
{ value: 'fulfillment:read', label: '发货读取' },
|
||||
{ value: 'wallet:read', label: '钱包读取' },
|
||||
]
|
||||
|
||||
const eventOptions = [
|
||||
{ value: 'order.created', label: '订单创建' },
|
||||
{ value: 'order.fulfillment.updated', label: '履约更新' },
|
||||
{ value: 'order.fulfillment.updated', label: '发货更新' },
|
||||
{ value: 'order.cancelled', label: '订单取消' },
|
||||
]
|
||||
|
||||
@@ -689,7 +689,7 @@ export default function MerchantCenter({ fixedTab, title = '商户中心' }: Mer
|
||||
|
||||
const tabItems = [
|
||||
{ key: 'products', label: '商品', disabled: !hasFeature('products'), children: productContent },
|
||||
{ key: 'orders', label: '履约订单', disabled: !hasFeature('orders'), children: orderContent },
|
||||
{ key: 'orders', label: '发货订单', disabled: !hasFeature('orders'), children: orderContent },
|
||||
{ key: 'wallet', label: '钱包', disabled: !hasFeature('wallet'), children: walletContent },
|
||||
{ key: 'api', label: 'API 密钥', disabled: !hasFeature('api'), children: apiKeyContent },
|
||||
{ key: 'callbacks', label: '回调', disabled: !hasFeature('callbacks'), children: callbackContent },
|
||||
@@ -765,7 +765,7 @@ export default function MerchantCenter({ fixedTab, title = '商户中心' }: Mer
|
||||
</Form.Item>
|
||||
)}
|
||||
</Space>
|
||||
<Form.Item name="fulfillment_config" label="履约配置">
|
||||
<Form.Item name="fulfillment_config" label="发货配置">
|
||||
<Input.TextArea rows={3} placeholder='{"provider":"manual"}' />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
|
||||
@@ -452,7 +452,7 @@ function EndpointSection({ spec }: { spec: EndpointSpec }) {
|
||||
function StatusSection() {
|
||||
return (
|
||||
<SectionWrap id="status" title="状态说明">
|
||||
<Card className="api-docs__card" size="small" title="订单状态 order_status 与 can_fulfill">
|
||||
<Card className="api-docs__card" size="small" title="订单状态 order_status 与 can_ship">
|
||||
<Table
|
||||
className="api-docs__table"
|
||||
size="small"
|
||||
@@ -462,11 +462,11 @@ function StatusSection() {
|
||||
columns={[
|
||||
{ title: '状态', dataIndex: 'name', width: 140, render: (v) => <Text code>{v}</Text> },
|
||||
{
|
||||
title: 'can_fulfill',
|
||||
title: 'can_ship',
|
||||
dataIndex: 'example',
|
||||
width: 160,
|
||||
render: (v: string) =>
|
||||
v === 'can_fulfill=true' ? <Tag color="green">true</Tag> : <Tag>false</Tag>,
|
||||
v === 'can_ship=true' ? <Tag color="green">true</Tag> : <Tag>false</Tag>,
|
||||
},
|
||||
{ title: '说明', dataIndex: 'desc' },
|
||||
]}
|
||||
|
||||
Reference in New Issue
Block a user