对接皮肤源头开放接口:查询、发货推送与 HMAC 签名鉴权

- 新增订单查询与发货结果推送开放接口,支持 can_ship 与幂等
- 鉴权采用 X-Api-Key + Timestamp + Nonce + HMAC-SHA256 签名
- 订单扩展发货字段与 ship_logs,管理端增加发货记录与开放文档页
This commit is contained in:
yml2213
2026-07-20 16:06:44 +08:00
parent 829bea309d
commit 89cdd32181
16 changed files with 1584 additions and 39 deletions
+29 -12
View File
@@ -18,7 +18,9 @@ import type { Order } from '../types'
const statusMap: Record<string, { color: string; text: string }> = {
pending: { color: 'orange', text: '待支付' },
paid: { color: 'blue', text: '已支付' },
delivering: { color: 'cyan', text: '发货中' },
delivered: { color: 'green', text: '已交付' },
ship_failed: { color: 'red', text: '发货失败' },
cancelled: { color: 'default', text: '已取消' },
}
@@ -59,29 +61,33 @@ export default function Orders() {
}
const columns: ColumnsType<Order> = [
{ title: '订单号', dataIndex: 'order_no', width: 200 },
{ title: '订单号', dataIndex: 'order_no', width: 190, ellipsis: true },
{
title: '皮肤',
dataIndex: ['skin', 'name'],
width: 140,
ellipsis: true,
render: (_, r) => r.skin?.name || `#${r.skin_id}`,
},
{
title: 'SKU',
width: 140,
ellipsis: true,
render: (_, r) => r.skin?.sku || '-',
},
{
title: '分销商',
dataIndex: ['distributor', 'nickname'],
width: 100,
ellipsis: true,
render: (_, r) => r.distributor?.nickname || r.distributor?.username || `#${r.distributor_id}`,
},
{ title: '买家', dataIndex: 'buyer_name', width: 100 },
{ title: '买家', dataIndex: 'buyer_name', width: 90, ellipsis: true },
{
title: '金额',
dataIndex: 'amount',
width: 100,
render: (v: number) => `¥${v.toFixed(2)}`,
},
{
title: '佣金',
dataIndex: 'commission_amt',
width: 100,
render: (v: number) => `¥${v.toFixed(2)}`,
width: 90,
render: (v: number) => `¥${Number(v ?? 0).toFixed(2)}`,
},
{
title: '状态',
@@ -92,10 +98,17 @@ export default function Orders() {
return <Tag color={s.color}>{s.text}</Tag>
},
},
{
title: '上游单号',
dataIndex: 'provider_order_no',
width: 120,
ellipsis: true,
render: (v?: string) => v || '-',
},
{
title: '时间',
dataIndex: 'created_at',
width: 170,
width: 160,
render: (v: string) => dayjs(v).format('YYYY-MM-DD HH:mm'),
},
]
@@ -117,7 +130,7 @@ export default function Orders() {
</Button>
</>
)}
{record.status === 'paid' && (
{(record.status === 'paid' || record.status === 'ship_failed' || record.status === 'delivering') && (
<Button type="link" size="small" onClick={() => changeStatus(record.id, 'delivered')}>
标记交付
</Button>
@@ -146,7 +159,9 @@ export default function Orders() {
options={[
{ value: 'pending', label: '待支付' },
{ value: 'paid', label: '已支付' },
{ value: 'delivering', label: '发货中' },
{ value: 'delivered', label: '已交付' },
{ value: 'ship_failed', label: '发货失败' },
{ value: 'cancelled', label: '已取消' },
]}
/>
@@ -161,6 +176,8 @@ export default function Orders() {
loading={loading}
columns={columns}
dataSource={list}
tableLayout="fixed"
scroll={{ x: 1100 }}
pagination={{
current: page,
pageSize: size,