evri渠道附加费计算调整,应付列表查询性能优化

This commit is contained in:
liuminghui
2026-11-20 11:23:03 +08:00
parent 38dd783d21
commit e82a27bf5a
37 changed files with 914 additions and 160 deletions
@@ -7,7 +7,7 @@
<el-option v-for="item in available" :key="item.scId" :label="optionLabel(item)" :value="item.scId" />
</el-select>
<el-button type="primary" plain class="add" @click="addPicked">添加</el-button>
<p class="hint">从附加费配置里选择。长宽高、重量和邮编在配置里维护,这里只选用。</p>
<p class="hint">从附加费配置里选择。长宽高、体积、重量和邮编在配置里维护,这里只选用。</p>
</section>
<section class="chosen">
<div class="pane-title">已选附加费</div>
@@ -84,6 +84,19 @@ function valueText(row) {
return `${row.amount} ${row.currency || ''}`.trim()
}
function configMeasure(item) {
return {
lengthCm: item.lengthCm,
widthCm: item.widthCm,
heightCm: item.heightCm,
sizeType: item.sizeType,
volumeM3: item.volumeM3,
overWeightKg: item.overWeightKg,
extraWeightKg: item.extraWeightKg,
postcodeText: item.postcodeText || ''
}
}
function rowFromConfig(item) {
return {
scId: item.scId,
@@ -92,12 +105,7 @@ function rowFromConfig(item) {
amount: item.chargeValue,
currency: item.currency,
zoneName: item.blockTitle || '',
lengthCm: item.lengthCm,
widthCm: item.widthCm,
heightCm: item.heightCm,
overWeightKg: item.overWeightKg,
extraWeightKg: item.extraWeightKg,
postcodeText: item.postcodeText || ''
...configMeasure(item)
}
}
@@ -117,6 +125,12 @@ function removeRow(row) {
function conditionText(row) {
if (row.calcRule === 'SIZE') {
if (String(row.sizeType || '').trim().toUpperCase() === 'VOLUME') {
if (Number(row.volumeM3) > 0) {
return `体积超过 ${row.volumeM3} m³`
}
return '体积还没在附加费配置里填写'
}
if (Number(row.lengthCm) > 0 && Number(row.widthCm) > 0 && Number(row.heightCm) > 0) {
return `长 ${row.lengthCm} cm,宽 ${row.widthCm} cm,高 ${row.heightCm} cm`
}
@@ -164,12 +178,7 @@ async function open(row) {
amount: item.amount,
currency: item.currency,
zoneName: item.zoneName || '',
lengthCm: item.lengthCm,
widthCm: item.widthCm,
heightCm: item.heightCm,
overWeightKg: item.overWeightKg,
extraWeightKg: item.extraWeightKg,
postcodeText: item.postcodeText || ''
...configMeasure(item)
}))
} finally {
loading.value = false
@@ -29,6 +29,7 @@ const calcModeOptions = [
{ value: 'MANUAL', label: '暂不计费' },
{ value: 'ALWAYS', label: '每票都收' },
{ value: 'POSTCODE', label: '命中邮编' },
{ value: 'FEE_POSTCODE', label: '附加费邮编' },
{ value: 'ZONE', label: '命中分区' },
{ value: 'EXTRA_KG', label: '超重续收' },
{ value: 'WEIGHT', label: '超重' },
@@ -50,6 +51,8 @@ const blockSelectOptions = computed(() =>
const chargeType = computed(() => String(form.value.chargeType || '').toUpperCase())
const sizeKind = computed(() => String(form.value.sizeType || '').toUpperCase())
const schemas = computed(() => [
{
label: '附加费名称',
@@ -81,15 +84,26 @@ const schemas = computed(() => [
width: '100%',
rules: [{ required: true, message: '请选择计费方式', trigger: 'change' }]
},
{
label: '超尺寸类型',
prop: 'sizeType',
component: 'select',
placeholder: '请选择',
dict: 'bms_size_type',
span: 12,
width: '100%',
show: chargeType.value === 'SIZE',
rules: chargeType.value === 'SIZE' ? [{ required: true, message: '请选择超尺寸类型', trigger: 'change' }] : undefined
},
{
label: '长(cm)',
prop: 'lengthCm',
component: 'inputNumber',
span: 12,
width: '100%',
show: chargeType.value === 'SIZE',
show: chargeType.value === 'SIZE' && sizeKind.value === 'SIDE',
props: { min: 0, precision: 2, controls: false, align: 'left' },
rules: chargeType.value === 'SIZE' ? [{ required: true, message: '请填写长', trigger: 'blur' }] : undefined
rules: chargeType.value === 'SIZE' && sizeKind.value === 'SIDE' ? [{ required: true, message: '请填写长', trigger: 'blur' }] : undefined
},
{
label: '宽(cm)',
@@ -97,9 +111,9 @@ const schemas = computed(() => [
component: 'inputNumber',
span: 12,
width: '100%',
show: chargeType.value === 'SIZE',
show: chargeType.value === 'SIZE' && sizeKind.value === 'SIDE',
props: { min: 0, precision: 2, controls: false, align: 'left' },
rules: chargeType.value === 'SIZE' ? [{ required: true, message: '请填写宽', trigger: 'blur' }] : undefined
rules: chargeType.value === 'SIZE' && sizeKind.value === 'SIDE' ? [{ required: true, message: '请填写宽', trigger: 'blur' }] : undefined
},
{
label: '高(cm)',
@@ -107,9 +121,20 @@ const schemas = computed(() => [
component: 'inputNumber',
span: 12,
width: '100%',
show: chargeType.value === 'SIZE',
show: chargeType.value === 'SIZE' && sizeKind.value === 'SIDE',
props: { min: 0, precision: 2, controls: false, align: 'left' },
rules: chargeType.value === 'SIZE' ? [{ required: true, message: '请填写高', trigger: 'blur' }] : undefined
rules: chargeType.value === 'SIZE' && sizeKind.value === 'SIDE' ? [{ required: true, message: '请填写高', trigger: 'blur' }] : undefined
},
{
label: '体积值/m³',
prop: 'volumeM3',
component: 'inputNumber',
placeholder: '超过这个体积才收取',
span: 12,
width: '100%',
show: chargeType.value === 'SIZE' && sizeKind.value === 'VOLUME',
props: { min: 0, precision: 6, controls: false, align: 'left' },
rules: chargeType.value === 'SIZE' && sizeKind.value === 'VOLUME' ? [{ required: true, message: '请填写体积', trigger: 'blur' }] : undefined
},
{
label: '超过重量(kg)',
@@ -217,6 +242,8 @@ function emptyForm() {
countryCode: undefined,
blockTitle: undefined,
scNote: undefined,
sizeType: undefined,
volumeM3: undefined,
lengthCm: undefined,
widthCm: undefined,
heightCm: undefined,
@@ -327,6 +354,8 @@ watch(() => form.value.countryCode, (code, prev) => {
watch(() => form.value.chargeType, (type, prev) => {
if (suppressCountryWatch.value || !prev || type === prev) return
form.value.sizeType = undefined
form.value.volumeM3 = undefined
form.value.lengthCm = undefined
form.value.widthCm = undefined
form.value.heightCm = undefined
@@ -337,6 +366,19 @@ watch(() => form.value.chargeType, (type, prev) => {
nextTick(() => formRef.value?.clearValidate())
})
watch(() => form.value.sizeType, (type, prev) => {
if (suppressCountryWatch.value || !prev || type === prev) return
const code = String(type || '').toUpperCase()
if (code === 'VOLUME') {
form.value.lengthCm = undefined
form.value.widthCm = undefined
form.value.heightCm = undefined
} else if (code === 'SIDE') {
form.value.volumeM3 = undefined
}
nextTick(() => formRef.value?.clearValidate())
})
defineExpose({ open })
</script>
@@ -109,6 +109,7 @@ const chargeTypeLabelMap = {
MANUAL: '暂不计费',
ALWAYS: '每票都收',
POSTCODE: '命中邮编',
FEE_POSTCODE: '附加费邮编',
ZONE: '命中分区',
EXTRA_KG: '超重续收',
WEIGHT: '超重',
@@ -87,6 +87,7 @@ const calcModeLabelMap = {
MANUAL: '暂不计费',
ALWAYS: '每票都收',
POSTCODE: '命中邮编',
FEE_POSTCODE: '附加费邮编',
ZONE: '命中分区',
EXTRA_KG: '超重续收',
WEIGHT: '超重',
@@ -98,6 +99,8 @@ const columns = [
{ label: '附加费名称', prop: 'scName', align: 'center', minWidth: 140, showOverflowTooltip: true },
{ label: '费用类型', prop: 'feeType', align: 'center', width: 110, dict: 'bms_fee_type' },
{ label: '计费方式', prop: 'chargeType', align: 'center', width: 110 },
{ label: '超尺寸类型', prop: 'sizeType', align: 'center', width: 120, dict: 'bms_size_type' },
{ label: '体积(m³)', prop: 'volumeM3', align: 'center', width: 110 },
{ label: '计费数值', prop: 'chargeValue', align: 'center', width: 140 },
{ label: '取值方式', prop: 'roundMode', align: 'center', width: 110, dict: 'bms_round_mode' },
{ label: '适用国家', prop: 'countryCode', align: 'center', minWidth: 120, showOverflowTooltip: true },