Merge branch 'main' into dev_match

This commit is contained in:
2026-11-06 10:14:43 +08:00
63 changed files with 7027 additions and 954 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
@@ -20,6 +20,7 @@ import {
retryPendingCarrierGroup,
switchChannelForOrderItems,
unlockChannel,
unlockPendingChannelGroup,
upsertChannelRule,
} from '../../services/fulfillment/channel-assign-service.js'
import {
@@ -86,6 +87,9 @@ router.get(
createJsonHandler(
(req) =>
listVoucherConsumeJobs({
keyword: String(req.query.keyword || ''),
provider: String(req.query.provider || ''),
channel: String(req.query.channel || ''),
status: String(req.query.status || ''),
page: Number(req.query.page),
pageSize: Number(req.query.pageSize),
@@ -135,6 +139,7 @@ router.get(
page: Number(req.query.page),
pageSize: Number(req.query.pageSize),
keyword: String(req.query.keyword || ''),
issueCategory: String(req.query.issueCategory || ''),
}),
{
successMessage: 'ok',
@@ -152,6 +157,7 @@ router.post(
deletePendingChannelGroup({
groupKey: String(bodyOf(req).groupKey || ''),
internalSku: String(bodyOf(req).internalSku || ''),
issueCategory: String(bodyOf(req).issueCategory || ''),
adminUserId: req.adminSession?.userId ?? null,
}),
{
@@ -200,6 +206,11 @@ router.post(
(req) =>
retryPendingCarrierGroup({
internalSku: String(bodyOf(req).internalSku || ''),
retryInactiveCarrier: bodyOf(req).retryInactiveCarrier === true,
includeLocked: bodyOf(req).includeLocked === true,
issueCodes: Array.isArray(bodyOf(req).issueCodes)
? bodyOf(req).issueCodes.map((value: unknown) => String(value || ''))
: [],
}),
{
successMessage: '履约载体重试完成',
@@ -215,6 +226,32 @@ router.post(
),
)
router.post(
'/fulfillment/pending/unlock',
requireAdminPermission('finance.config'),
createJsonHandler(
(req) => {
const body = bodyOf(req)
return unlockPendingChannelGroup({
groupKey: String(body.groupKey || ''),
internalSku: String(body.internalSku || ''),
issueCategory: String(body.issueCategory || ''),
})
},
{
successMessage: '运营锁定已解除',
errorMessage: '解除运营锁定失败',
scope: '[admin/fulfillment/pending/unlock]',
audit: (req, data) => ({
action: 'fulfillment.unlock_pending_group',
targetType: 'pending_group',
targetId: String(bodyOf(req).groupKey || bodyOf(req).internalSku || ''),
data: data as Record<string, unknown>,
}),
},
),
)
router.get(
'/fulfillment/internal-sku-mappings',
requireAdminPermission('finance.view'),
@@ -314,6 +351,7 @@ router.post(
internalSku: String(body.internalSku || ''),
mappedInternalSku: String(body.mappedInternalSku || ''),
channel,
issueCategory: String(body.issueCategory || ''),
adminUserId,
note,
})