feat(cost-center): 卡券商品创建即生成渠道规则,补齐成本项预设
- 新建 tpv: 商品时自动写 third_party_voucher 规则,避免新卡券 SKU 停在待分类 - 成本项预设新增「第三方卡券采购成本」
This commit is contained in:
@@ -16,6 +16,7 @@ import { nowIso } from '../../utils/time.js'
|
||||
import { normalizeMatchText, normalizeSkuSeriesEquivalence } from '../product-match/normalize.js'
|
||||
import { resolveSkuNameQuantity } from '../product-match/pricing.js'
|
||||
import { setAdminAffiliateProductPrice } from './affiliate-product-service.js'
|
||||
import { ensureVoucherRuleForSku } from '../fulfillment/channel-assign-service.js'
|
||||
import { syncAdminWorkProductRulePrice } from '../worker-platform/admin-worker-catalog-service.js'
|
||||
import {
|
||||
AFFILIATE_TASK_AGG_JOIN,
|
||||
@@ -345,6 +346,10 @@ export async function createAdminProduct(payload: JsonObject, _session: AdminSes
|
||||
errorCode: 'cost_product_sku_exists',
|
||||
})
|
||||
}
|
||||
// 卡券没有载体证据,创建商品时顺手把渠道规则补上,避免新 SKU 停在待分类。
|
||||
if (canonicalSku.startsWith('tpv:')) {
|
||||
await ensureVoucherRuleForSku(canonicalSku.slice(4))
|
||||
}
|
||||
return { product: mapProduct(inserted) }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user