Refactor surcharge management by replacing PrcPriceSetVersionSurcharge with PrcSurchargeRel, introducing price type handling (PRODUCT, SALES, REDLINE) and updating related services, mappers, and front-end components. Enhance validation and error messaging for price type and detail ID requirements. Update database schema to support new relationships and constraints.
This commit is contained in:
@@ -301,8 +301,7 @@ export function surchargeScopeLabel(s) {
|
||||
|
||||
/**
|
||||
* 产品关联附加费(prc_surcharge_rel)是否作用于该明细行
|
||||
* 与后端 snapshotVersionSurcharges 的过滤口径保持一致:
|
||||
* 国家三字码一致 + 产品级(detailId 空)直接命中,明细级需 productCountryId 相同
|
||||
* 产品关联:国家 + productCountryId;SALES:detailId=psdId
|
||||
*/
|
||||
export function surchargeAppliesToRow(rel, row) {
|
||||
if (!rel || !row) return false
|
||||
@@ -310,6 +309,14 @@ export function surchargeAppliesToRow(rel, row) {
|
||||
&& String(rel.countryCode).toUpperCase() !== String(row.countryCode).toUpperCase()) {
|
||||
return false
|
||||
}
|
||||
// SALES rel: detail_id = psd_id
|
||||
if (rel.priceType === 'SALES') {
|
||||
if (rel.detailId != null && row.psdId != null) {
|
||||
return Number(rel.detailId) === Number(row.psdId)
|
||||
}
|
||||
return true
|
||||
}
|
||||
// PRODUCT / REDLINE: product_country detail or product-level
|
||||
if (rel.detailId == null) return true
|
||||
return row.productCountryId != null && Number(rel.detailId) === Number(row.productCountryId)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user