feat(cost-center): 支持删除第三方卡券商品

This commit is contained in:
yml2213
2026-11-05 17:48:24 +08:00
parent f67f00a7a5
commit a6fbb43955
6 changed files with 285 additions and 19 deletions
@@ -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