统一订单单状态模型
This commit is contained in:
@@ -41,18 +41,12 @@ import type {
|
||||
WalletLedgerEntry,
|
||||
} from '../types'
|
||||
|
||||
const fulfillmentStatusMap: Record<string, { color: string; text: string }> = {
|
||||
pending: { color: 'orange', text: '待履约' },
|
||||
processing: { color: 'cyan', text: '履约中' },
|
||||
succeeded: { color: 'green', text: '已成功' },
|
||||
failed: { color: 'red', text: '已失败' },
|
||||
cancelled: { color: 'default', text: '已取消' },
|
||||
}
|
||||
|
||||
const paymentStatusMap: Record<string, { color: string; text: string }> = {
|
||||
const orderStatusMap: Record<string, { color: string; text: string }> = {
|
||||
pending: { color: 'orange', text: '待支付' },
|
||||
paid: { color: 'blue', text: '已支付' },
|
||||
refunded: { color: 'purple', text: '已退款' },
|
||||
paid: { color: 'blue', text: '待发货' },
|
||||
delivering: { color: 'cyan', text: '发货中' },
|
||||
delivered: { color: 'green', text: '已交付' },
|
||||
ship_failed: { color: 'red', text: '发货失败' },
|
||||
cancelled: { color: 'default', text: '已取消' },
|
||||
}
|
||||
|
||||
@@ -78,8 +72,8 @@ const eventOptions = [
|
||||
]
|
||||
|
||||
const testOrderStatusOptions = [
|
||||
{ value: 'pending', label: '已支付,可发货' },
|
||||
{ value: 'failed', label: '发货失败,可重试' },
|
||||
{ value: 'paid', label: '已支付,可发货' },
|
||||
{ value: 'ship_failed', label: '发货失败,可重试' },
|
||||
]
|
||||
|
||||
type MerchantCenterTab = 'products' | 'orders' | 'wallet' | 'api' | 'callbacks' | 'members'
|
||||
@@ -347,7 +341,7 @@ export default function MerchantCenter({ fixedTab, title = '商户中心' }: Mer
|
||||
testOrderForm.setFieldsValue({
|
||||
buyer_reference: '测试买家',
|
||||
note: '联调测试订单',
|
||||
fulfillment_status: 'pending',
|
||||
order_status: 'paid',
|
||||
})
|
||||
setTestOrderOpen(true)
|
||||
setTestOrderProductsLoading(true)
|
||||
@@ -374,7 +368,7 @@ export default function MerchantCenter({ fixedTab, title = '商户中心' }: Mer
|
||||
sku: values.sku,
|
||||
buyer_reference: values.buyer_reference,
|
||||
note: values.note,
|
||||
fulfillment_status: values.fulfillment_status,
|
||||
order_status: values.order_status,
|
||||
})
|
||||
setTestOrderOpen(false)
|
||||
setTestOrderResult(result)
|
||||
@@ -494,8 +488,7 @@ export default function MerchantCenter({ fixedTab, title = '商户中心' }: Mer
|
||||
{ title: '基础金额', dataIndex: 'base_amount', width: 88, render: money },
|
||||
{ title: '手续费', dataIndex: 'service_fee_amount', width: 82, render: money },
|
||||
{ title: '扣款合计', dataIndex: 'amount', width: 88, render: money },
|
||||
{ title: '支付', dataIndex: 'payment_status', width: 76, render: paymentStatusTag },
|
||||
{ title: '履约', dataIndex: 'fulfillment_status', width: 86, render: fulfillmentStatusTag },
|
||||
{ title: '状态', dataIndex: 'order_status', width: 92, render: orderStatusTag },
|
||||
{ title: '上游单号', dataIndex: 'provider_order_no', width: 120, ellipsis: true, render: (v) => v || '-' },
|
||||
{
|
||||
title: '链接有效期',
|
||||
@@ -791,7 +784,7 @@ export default function MerchantCenter({ fixedTab, title = '商户中心' }: Mer
|
||||
<Form.Item name="buyer_reference" label="买家名称" rules={[{ max: 128 }]}>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item name="fulfillment_status" label="可发货状态" rules={[{ required: true }]}>
|
||||
<Form.Item name="order_status" label="订单状态" rules={[{ required: true }]}>
|
||||
<Select options={testOrderStatusOptions} />
|
||||
</Form.Item>
|
||||
<Form.Item name="note" label="备注" rules={[{ max: 512 }]}>
|
||||
@@ -1004,14 +997,9 @@ function productOptionLabel(item: MerchantProduct) {
|
||||
return name === item.sku ? item.sku : `${name} / ${item.sku}`
|
||||
}
|
||||
|
||||
function paymentStatusTag(value: string) {
|
||||
const item = paymentStatusMap[value] || { color: 'default', text: value }
|
||||
return <Tag color={item.color}>{item.text}</Tag>
|
||||
}
|
||||
|
||||
function fulfillmentStatusTag(value: string) {
|
||||
const item = fulfillmentStatusMap[value] || { color: 'default', text: value }
|
||||
return <Tag color={item.color}>{item.text}</Tag>
|
||||
function orderStatusTag(value: string) {
|
||||
const item = orderStatusMap[value] || { color: 'default', text: value }
|
||||
return <Tag color={item.color}>{item.text}</Tag>
|
||||
}
|
||||
|
||||
function ledgerTypeTag(value: string) {
|
||||
|
||||
Reference in New Issue
Block a user