feat(fulfillment): 支持删除待分类和强制删除渠道规则
This commit is contained in:
@@ -42,7 +42,7 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { useState } from 'react'
|
||||
|
||||
import {
|
||||
deleteAdminManualConfig,
|
||||
deleteAdminManualSku,
|
||||
fetchAdminManualPlatforms,
|
||||
fetchAdminManualSkuOverview,
|
||||
fetchAdminManualSkus,
|
||||
@@ -161,13 +161,17 @@ export function ManualSkuConfigPanel() {
|
||||
})
|
||||
|
||||
const deleteMutation = useMutation({
|
||||
mutationFn: (skuKey: string) => deleteAdminManualConfig(skuKey),
|
||||
onSuccess: () => {
|
||||
message.success('配置已删除')
|
||||
mutationFn: (skuKey: string) => deleteAdminManualSku(skuKey),
|
||||
onSuccess: (response) => {
|
||||
message.success(
|
||||
`人工分类已移除;${response.data.affectedItems} 个订单项已退回待分类,原始订单保留`,
|
||||
)
|
||||
void queryClient.invalidateQueries({ queryKey: ['admin-cost-center-manual-skus'] })
|
||||
void queryClient.invalidateQueries({
|
||||
queryKey: ['admin-cost-center-manual-skus-overview'],
|
||||
})
|
||||
void queryClient.invalidateQueries({ queryKey: ['fulfillment-rules'] })
|
||||
void queryClient.invalidateQueries({ queryKey: ['fulfillment-pending'] })
|
||||
},
|
||||
onError: (error) => {
|
||||
message.error(error instanceof Error ? error.message : '删除失败')
|
||||
@@ -259,24 +263,24 @@ export function ManualSkuConfigPanel() {
|
||||
{
|
||||
title: '操作',
|
||||
key: 'actions',
|
||||
width: 130,
|
||||
width: 150,
|
||||
fixed: 'right',
|
||||
render: (_, row) => (
|
||||
<Space size={4}>
|
||||
<Button size="small" icon={<EditOutlined />} onClick={() => openConfig(row)}>
|
||||
{row.configured ? '编辑' : '配置'}
|
||||
</Button>
|
||||
{row.configured ? (
|
||||
<Popconfirm
|
||||
title="删除该 SKU 的配置?"
|
||||
description="删除后该 SKU 回到未配置状态,已回填的订单项不再带配置。"
|
||||
okText="删除"
|
||||
cancelText="取消"
|
||||
onConfirm={() => deleteMutation.mutate(row.skuKey)}
|
||||
>
|
||||
<Button size="small" danger icon={<DeleteOutlined />} />
|
||||
</Popconfirm>
|
||||
) : null}
|
||||
<Popconfirm
|
||||
title="移除该人工分类?"
|
||||
description="会删除人工登记与配置、撤销人工渠道规则、清除已生成的人工成本快照,并把关联订单项退回待分类;原始订单不会删除。"
|
||||
okText="确认移除"
|
||||
cancelText="取消"
|
||||
onConfirm={() => deleteMutation.mutate(row.skuKey)}
|
||||
>
|
||||
<Button size="small" danger icon={<DeleteOutlined />}>
|
||||
移除
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user