调整 合同
This commit is contained in:
@@ -229,32 +229,38 @@
|
||||
</div></template
|
||||
></el-table-column
|
||||
>
|
||||
<el-table-column label="保底计费重量" width="240"
|
||||
<el-table-column width="240"
|
||||
><template #header
|
||||
><span class="billing-plan-editor__column-title"
|
||||
>保底计费重量<el-tooltip content="实际计量值小于保底数值时按保底计费" placement="top"
|
||||
><el-icon class="billing-plan-editor__default-tip"><InfoFilled /></el-icon></el-tooltip></span></template
|
||||
><template #default="{ row }"
|
||||
><div v-if="readonly && usesRangeMinimum(row)" class="limit-list">
|
||||
<span v-for="(item, rangeIndex) in getRanges(row)" :key="rangeIndex">{{
|
||||
displayValue(item.minimumBillingWeight)
|
||||
rangeIndex === 0
|
||||
? displayValue(item.minimumBillingWeight || row.minimumBillingWeight)
|
||||
: ''
|
||||
}}</span>
|
||||
</div>
|
||||
<span v-else-if="readonly">{{ displayValue(row.minimumBillingWeight) }}</span>
|
||||
<div v-else-if="usesRangeMinimum(row)" class="limit-list">
|
||||
<el-input
|
||||
v-for="(item, rangeIndex) in getRanges(row)"
|
||||
:key="rangeIndex"
|
||||
v-model="item.minimumBillingWeight"
|
||||
:disabled="!canEditMinimum(row)"
|
||||
:placeholder="canEditMinimum(row) ? '请输入保底计费重量' : '无需配置'"
|
||||
@input="value => rangeMinimumInput(row, rangeIndex, value)"
|
||||
/>
|
||||
<template v-for="(item, rangeIndex) in getRanges(row)" :key="rangeIndex">
|
||||
<el-input
|
||||
v-if="rangeIndex === 0"
|
||||
v-model="item.minimumBillingWeight"
|
||||
:disabled="!canEditMinimum(row)"
|
||||
:placeholder="canEditMinimum(row) ? '请输入' : '无需配置'"
|
||||
@input="value => rangeMinimumInput(row, rangeIndex, value)"
|
||||
/>
|
||||
<div v-else class="limit-placeholder" />
|
||||
</template>
|
||||
</div>
|
||||
<el-input
|
||||
v-else
|
||||
v-model="row.minimumBillingWeight"
|
||||
:disabled="!canEditMinimum(row)"
|
||||
:placeholder="
|
||||
canEditMinimum(row)
|
||||
? '实际计量值小于保底数值时按保底计费'
|
||||
: '仅按重量、按吨·公里可填写'
|
||||
canEditMinimum(row) ? '请输入' : '仅按重量、按吨·公里可填写'
|
||||
"
|
||||
@input="value => decimalInput(row, 'minimumBillingWeight', value)" /></template
|
||||
></el-table-column>
|
||||
@@ -297,9 +303,6 @@
|
||||
<el-descriptions-item label="目的地">{{
|
||||
displayValue(matchForm.destination)
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="运输方式">{{
|
||||
transportModeLabel(matchForm.transportMode)
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="货物类型">{{
|
||||
displayValue(matchForm.cargoType)
|
||||
}}</el-descriptions-item>
|
||||
@@ -334,21 +337,6 @@
|
||||
@visible-change="v => v && ensureRegions()"
|
||||
@change="v => matchRegionChange('destination', v)" /></el-form-item
|
||||
></el-col>
|
||||
<el-col :span="12"
|
||||
><el-form-item label="运输方式"
|
||||
><el-select
|
||||
v-model="matchForm.transportMode"
|
||||
:loading="transportModeLoading"
|
||||
:disabled="readonly"
|
||||
placeholder="请选择运输方式"
|
||||
clearable
|
||||
filterable
|
||||
><el-option
|
||||
v-for="item in transportModeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value" /></el-select></el-form-item
|
||||
></el-col>
|
||||
<el-col :span="12"
|
||||
><el-form-item label="货物类型"
|
||||
><el-cascader
|
||||
@@ -560,30 +548,24 @@ export default {
|
||||
return next;
|
||||
},
|
||||
normalizeRanges(row) {
|
||||
const ranges = Array.isArray(row.limitRanges)
|
||||
? row.limitRanges
|
||||
.map(item => ({
|
||||
lowerLimit: item?.lowerLimit ?? '',
|
||||
upperLimit: item?.upperLimit ?? '',
|
||||
unitPrice:
|
||||
item?.unitPrice === undefined || item?.unitPrice === ''
|
||||
? row.unitPrice ?? ''
|
||||
: item.unitPrice,
|
||||
minimumBillingWeight:
|
||||
item?.minimumBillingWeight === undefined || item?.minimumBillingWeight === ''
|
||||
? this.usesRangeMinimum(row)
|
||||
? row.minimumBillingWeight ?? ''
|
||||
: ''
|
||||
: item.minimumBillingWeight,
|
||||
}))
|
||||
.filter(
|
||||
item =>
|
||||
item.lowerLimit !== '' ||
|
||||
item.upperLimit !== '' ||
|
||||
item.unitPrice !== '' ||
|
||||
item.minimumBillingWeight !== ''
|
||||
)
|
||||
: [];
|
||||
const rawRanges = Array.isArray(row.limitRanges) ? row.limitRanges : [];
|
||||
const ranges = rawRanges
|
||||
.map((item, index) => ({
|
||||
lowerLimit: item?.lowerLimit ?? '',
|
||||
upperLimit: item?.upperLimit ?? '',
|
||||
unitPrice:
|
||||
item?.unitPrice === undefined || item?.unitPrice === ''
|
||||
? row.unitPrice ?? ''
|
||||
: item.unitPrice,
|
||||
minimumBillingWeight: this.resolveRangeMinimum(row, item, index),
|
||||
}))
|
||||
.filter(
|
||||
item =>
|
||||
item.lowerLimit !== '' ||
|
||||
item.upperLimit !== '' ||
|
||||
item.unitPrice !== '' ||
|
||||
item.minimumBillingWeight !== ''
|
||||
);
|
||||
if (
|
||||
!ranges.length &&
|
||||
(row.lowerLimit !== '' ||
|
||||
@@ -598,9 +580,23 @@ export default {
|
||||
minimumBillingWeight: this.usesRangeMinimum(row) ? row.minimumBillingWeight ?? '' : '',
|
||||
});
|
||||
return ranges.length
|
||||
? ranges
|
||||
? ranges.map((item, index) => ({
|
||||
...item,
|
||||
minimumBillingWeight: this.usesRangeMinimum(row)
|
||||
? index === 0
|
||||
? item.minimumBillingWeight
|
||||
: ''
|
||||
: '',
|
||||
}))
|
||||
: [{ lowerLimit: '', upperLimit: '', unitPrice: '', minimumBillingWeight: '' }];
|
||||
},
|
||||
resolveRangeMinimum(row, item, index) {
|
||||
if (!this.usesRangeMinimum(row) || index !== 0) return '';
|
||||
if (item?.minimumBillingWeight !== undefined && item?.minimumBillingWeight !== '') {
|
||||
return item.minimumBillingWeight;
|
||||
}
|
||||
return row.minimumBillingWeight ?? '';
|
||||
},
|
||||
syncLegacyLimit(row) {
|
||||
const first = row.limitRanges?.[0] || {};
|
||||
row.lowerLimit = first.lowerLimit ?? '';
|
||||
@@ -803,11 +799,16 @@ export default {
|
||||
if (index === 0) row.unitPrice = target.value;
|
||||
},
|
||||
rangeMinimumInput(row, index, value) {
|
||||
if (index !== 0) return;
|
||||
row.limitRanges = this.getRanges(row);
|
||||
const target = { value };
|
||||
this.decimalInput(target, 'value', value);
|
||||
row.limitRanges[index].minimumBillingWeight = target.value;
|
||||
if (index === 0) row.minimumBillingWeight = target.value;
|
||||
row.limitRanges[0].minimumBillingWeight = target.value;
|
||||
row.minimumBillingWeight = target.value;
|
||||
row.limitRanges = row.limitRanges.map((item, rangeIndex) => ({
|
||||
...item,
|
||||
minimumBillingWeight: rangeIndex === 0 ? target.value : '',
|
||||
}));
|
||||
},
|
||||
addRule() {
|
||||
this.draft.rules.push(defaultRule());
|
||||
@@ -929,15 +930,22 @@ export default {
|
||||
plan.transportModeLabel = transportMode?.label || plan.transportMode;
|
||||
plan.rules = plan.rules.map(rule => {
|
||||
const ranges = this.canEditLimit(rule) ? this.getRanges(rule) : [];
|
||||
const normalizedRanges = ranges.map((item, rangeIndex) => ({
|
||||
...item,
|
||||
minimumBillingWeight:
|
||||
this.usesRangeMinimum(rule) && rangeIndex === 0 ? item.minimumBillingWeight || '' : '',
|
||||
}));
|
||||
return {
|
||||
...rule,
|
||||
unitPrice: this.usesRangeUnitPrice(rule) ? ranges[0]?.unitPrice || '' : rule.unitPrice,
|
||||
limitRanges: ranges,
|
||||
lowerLimit: ranges[0]?.lowerLimit || '',
|
||||
upperLimit: ranges[0]?.upperLimit || '',
|
||||
unitPrice: this.usesRangeUnitPrice(rule)
|
||||
? normalizedRanges[0]?.unitPrice || ''
|
||||
: rule.unitPrice,
|
||||
limitRanges: normalizedRanges,
|
||||
lowerLimit: normalizedRanges[0]?.lowerLimit || '',
|
||||
upperLimit: normalizedRanges[0]?.upperLimit || '',
|
||||
minimumBillingWeight: this.canEditMinimum(rule)
|
||||
? this.usesRangeMinimum(rule)
|
||||
? ranges[0]?.minimumBillingWeight || ''
|
||||
? normalizedRanges[0]?.minimumBillingWeight || ''
|
||||
: rule.minimumBillingWeight
|
||||
: '',
|
||||
};
|
||||
@@ -950,9 +958,6 @@ export default {
|
||||
this.matchIndex = index;
|
||||
this.matchForm = { ...defaultRule().matchCondition, ...(row.matchCondition || {}) };
|
||||
this.matchVisible = true;
|
||||
this.ensureTransportModes().then(() => {
|
||||
this.matchForm.transportMode = this.normalizeTransportMode(this.matchForm.transportMode);
|
||||
});
|
||||
this.ensureRegions();
|
||||
this.ensureCargo().then(() => {
|
||||
const path = this.resolveCargoPath(this.matchForm);
|
||||
@@ -977,21 +982,6 @@ export default {
|
||||
});
|
||||
return this.transportModeRequest;
|
||||
},
|
||||
normalizeTransportMode(value) {
|
||||
const transportMode = String(value || '').trim();
|
||||
if (!transportMode) return '';
|
||||
const option = this.transportModeOptions.find(item => {
|
||||
const optionValue = String(item.value || '').trim();
|
||||
const optionLabel = String(item.label || '').trim();
|
||||
return (
|
||||
optionValue === transportMode ||
|
||||
optionLabel === transportMode ||
|
||||
optionLabel.includes(transportMode) ||
|
||||
transportMode.includes(optionLabel)
|
||||
);
|
||||
});
|
||||
return option?.value || transportMode;
|
||||
},
|
||||
ensureRegions() {
|
||||
if (this.regionOptions.length) return Promise.resolve(this.regionOptions);
|
||||
if (this.regionRequest) return this.regionRequest;
|
||||
@@ -1214,6 +1204,11 @@ export default {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.billing-plan-editor__column-title {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.limit-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -1229,4 +1224,8 @@ export default {
|
||||
.limit-row .el-input {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.limit-placeholder {
|
||||
height: 32px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user