✨ 完善付款申请多结算行、结算导入编辑与计费规则展示
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
export function isFreightFeeName(name) {
|
||||
const text = String(name || '');
|
||||
return text.includes('运费') || text.includes('运输费');
|
||||
}
|
||||
|
||||
/** 运输单价对应的运费计费类型。 */
|
||||
export function freightBillingType(row = {}) {
|
||||
const rule = row.billingRule || {};
|
||||
const rules = Array.isArray(rule.rules) ? rule.rules : [];
|
||||
const freightRule = rules.find(
|
||||
item => isFreightFeeName(item?.feeItem) || isFreightFeeName(item?.feeType)
|
||||
);
|
||||
return freightRule?.billingType || row.billingType || rule.billingType || '';
|
||||
}
|
||||
|
||||
export function isTierUnitPrice(row) {
|
||||
return freightBillingType(row) === '阶梯单价';
|
||||
}
|
||||
|
||||
export function isIntervalBilling(row) {
|
||||
const type = freightBillingType(row);
|
||||
return type === '区间单价' || (type.includes('区间') && type.includes('一口价'));
|
||||
}
|
||||
|
||||
/** 阶梯单价、区间单价、区间一口价的运输单价不开放手工调整。 */
|
||||
export function isUnitPriceAdjustable(row) {
|
||||
const type = freightBillingType(row);
|
||||
if (!type) return true;
|
||||
return !isTierUnitPrice(row) && !isIntervalBilling(row);
|
||||
}
|
||||
Reference in New Issue
Block a user