|
|
@ -211,11 +211,12 @@ Page({ |
|
|
|
|
|
|
|
|
// 解析规格,提取类型(净重/毛重)和数值范围
|
|
|
// 解析规格,提取类型(净重/毛重)和数值范围
|
|
|
parseSpecification(spec) { |
|
|
parseSpecification(spec) { |
|
|
const weightMatch = spec.match(/(净重|毛重)(\d+)-(\d+)/); |
|
|
// 匹配 "净重X-Y" 或 "毛重X-Y" 格式
|
|
|
if (weightMatch) { |
|
|
const rangeMatch = spec.match(/(净重|毛重)(\d+)-(\d+)/); |
|
|
const type = weightMatch[1]; // 净重或毛重
|
|
|
if (rangeMatch) { |
|
|
const min = parseFloat(weightMatch[2]); |
|
|
const type = rangeMatch[1]; // 净重或毛重
|
|
|
const max = parseFloat(weightMatch[3]); |
|
|
const min = parseFloat(rangeMatch[2]); |
|
|
|
|
|
const max = parseFloat(rangeMatch[3]); |
|
|
const avg = (min + max) / 2; |
|
|
const avg = (min + max) / 2; |
|
|
return { |
|
|
return { |
|
|
type: type, |
|
|
type: type, |
|
|
@ -224,6 +225,33 @@ Page({ |
|
|
avg: avg |
|
|
avg: avg |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 匹配 "净重X+" 或 "毛重X+" 格式
|
|
|
|
|
|
const plusMatch = spec.match(/(净重|毛重)(\d+)\+/); |
|
|
|
|
|
if (plusMatch) { |
|
|
|
|
|
const type = plusMatch[1]; // 净重或毛重
|
|
|
|
|
|
const value = parseFloat(plusMatch[2]); |
|
|
|
|
|
return { |
|
|
|
|
|
type: type, |
|
|
|
|
|
min: value, |
|
|
|
|
|
max: value, |
|
|
|
|
|
avg: value |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 匹配 "净重X" 或 "毛重X" 格式
|
|
|
|
|
|
const singleMatch = spec.match(/(净重|毛重)(\d+)/); |
|
|
|
|
|
if (singleMatch) { |
|
|
|
|
|
const type = singleMatch[1]; // 净重或毛重
|
|
|
|
|
|
const value = parseFloat(singleMatch[2]); |
|
|
|
|
|
return { |
|
|
|
|
|
type: type, |
|
|
|
|
|
min: value, |
|
|
|
|
|
max: value, |
|
|
|
|
|
avg: value |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return null; |
|
|
return null; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|