feat(cost-center): 支持删除第三方卡券商品
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
createAdminProduct,
|
||||
deleteAdminChannelMapping,
|
||||
deleteAdminProduct,
|
||||
deleteAdminVoucherProduct,
|
||||
getAdminChannelMappingDiagnostics,
|
||||
listAdminChannelMappings,
|
||||
listAdminProducts,
|
||||
@@ -416,4 +417,30 @@ router.post(
|
||||
}),
|
||||
)
|
||||
|
||||
router.delete(
|
||||
'/cost-center/voucher-products/:productId',
|
||||
requireAdminPermission('finance.config'),
|
||||
createJsonHandler((req) => deleteAdminVoucherProduct(idOf(req, 'productId')), {
|
||||
successMessage: '第三方卡券商品已处理',
|
||||
errorMessage: '删除第三方卡券商品失败',
|
||||
scope: '[admin/cost-center/voucher-products/:productId]',
|
||||
audit: (req, data) => {
|
||||
const result = data as {
|
||||
action?: string
|
||||
product?: { id?: number; canonicalSku?: string }
|
||||
}
|
||||
return {
|
||||
action:
|
||||
result.action === 'archived' ? 'voucher_product_archived' : 'voucher_product_deleted',
|
||||
targetType: 'product_catalog',
|
||||
targetId: String(result.product?.id || req.params.productId || ''),
|
||||
data: {
|
||||
canonicalSku: result.product?.canonicalSku || '',
|
||||
action: result.action || '',
|
||||
},
|
||||
}
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
export default router
|
||||
|
||||
Reference in New Issue
Block a user