解耦接单与履约订单处理
This commit is contained in:
@@ -594,12 +594,21 @@ export function resolveMatchingProductRule(
|
||||
if (!matchesOptionalText(rule.platform, order.platform)) return false
|
||||
if (!matchesOptionalText(rule.shop_id, order.shop_id)) return false
|
||||
|
||||
const skuCode = String(item.sku_code || '')
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
const skuName = String(item.sku_name || '')
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
const snapshot = safeParseJson(item.item_snapshot_json)
|
||||
const skuCodes = [item.sku_code, snapshot.externalSkuCode, snapshot.externalItemId]
|
||||
.map((value) =>
|
||||
String(value || '')
|
||||
.trim()
|
||||
.toLowerCase(),
|
||||
)
|
||||
.filter(Boolean)
|
||||
const skuNames = [item.sku_name, snapshot.externalSkuName, snapshot.externalSkuNameNormalized]
|
||||
.map((value) =>
|
||||
String(value || '')
|
||||
.trim()
|
||||
.toLowerCase(),
|
||||
)
|
||||
.filter(Boolean)
|
||||
const ruleSkuCode = String(rule.sku_code || '')
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
@@ -607,16 +616,19 @@ export function resolveMatchingProductRule(
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
|
||||
if (ruleSkuCode && ruleSkuCode !== skuCode) {
|
||||
if (ruleSkuCode && !skuCodes.includes(ruleSkuCode)) {
|
||||
return false
|
||||
}
|
||||
if (!ruleProductName) {
|
||||
return Boolean(ruleSkuCode)
|
||||
}
|
||||
if (rule.match_type === 'exact') {
|
||||
return ruleProductName === skuName || ruleProductName === skuCode
|
||||
return skuNames.includes(ruleProductName) || skuCodes.includes(ruleProductName)
|
||||
}
|
||||
return skuName.includes(ruleProductName) || skuCode.includes(ruleProductName)
|
||||
return (
|
||||
skuNames.some((value) => value.includes(ruleProductName)) ||
|
||||
skuCodes.some((value) => value.includes(ruleProductName))
|
||||
)
|
||||
}) || null
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user