feat(rock): 未扫码绑定的使用中链接可释放回库存
历史残留绑定不再占住提货链接,退款后可以把还没扫上的库存分给下一单。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -327,6 +327,7 @@ export const rockApi = {
|
||||
listTokens: (params?: { page?: number; page_size?: number; status?: string; search?: string }) =>
|
||||
request.get('/platform/rock/tokens', { params }).then((r) => r.data.data as { list: RockTokenItem[]; total: number; page: number; page_size: number }),
|
||||
resetToken: (id: number) => request.post(`/platform/rock/tokens/${id}/reset`).then((r) => r.data.data),
|
||||
releaseToken: (id: number) => request.post(`/platform/rock/tokens/${id}/release`).then((r) => r.data.data),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -218,6 +218,18 @@ export default function PlatformRock() {
|
||||
}
|
||||
}
|
||||
|
||||
// 买家未扫码绑定时,把占用中的提货链接放回库存
|
||||
const handleReleaseToken = async (id: number) => {
|
||||
try {
|
||||
await rockApi.releaseToken(id)
|
||||
message.success('已释放回可用库存,该提货链接可以再次分配')
|
||||
loadData()
|
||||
loadTokens()
|
||||
} catch (e) {
|
||||
message.error('释放失败: ' + (e instanceof Error ? e.message : '未知错误'))
|
||||
}
|
||||
}
|
||||
|
||||
// 复制/生成发货凭证图片
|
||||
const handleCopyVoucher = async (record: RockTokenItem) => {
|
||||
setCopyingVoucherId(record.id)
|
||||
@@ -524,7 +536,7 @@ export default function PlatformRock() {
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 120,
|
||||
width: 140,
|
||||
fixed: 'right',
|
||||
render: (_, record) => {
|
||||
if (record.status === 'mismatch') {
|
||||
@@ -542,6 +554,21 @@ export default function PlatformRock() {
|
||||
</Popconfirm>
|
||||
)
|
||||
}
|
||||
if (record.status === 'using' && !record.bound_at && !record.actual_role_id) {
|
||||
return (
|
||||
<Popconfirm
|
||||
title="释放这条未绑定的提货链接?"
|
||||
description="仅在买家没有扫码绑定时可以释放。系统会先向上游确认;确认未绑定后,链接回到可用库存,可以分给下一单。请先确认该订单已退款。原发货页若仍打开,买家再次获取二维码会重新占用一条库存。"
|
||||
okText="确认释放"
|
||||
cancelText="取消"
|
||||
onConfirm={() => handleReleaseToken(record.id)}
|
||||
>
|
||||
<Button size="small" icon={<UndoOutlined />}>
|
||||
释放回库存
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
)
|
||||
}
|
||||
return <Text type="secondary">-</Text>
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user