✨ 合同结算币种联动计费与运单计价单位,并完善合同与派车交互
结算币种驱动计费单价单位及运单/计划/总单计价单位;同步合同编号预览、部门前缀配置、派车备注与查看弹窗等交互优化。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1083,7 +1083,7 @@
|
||||
@visible-change="visible => visible && loadTaskFeeUnitOptions()"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in taskFeeUnitOptions"
|
||||
v-for="item in taskFeeUnitSelectOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
@@ -1416,7 +1416,7 @@
|
||||
@visible-change="visible => visible && loadTaskFeeUnitOptions()"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in taskFeeUnitOptions"
|
||||
v-for="item in taskFeeUnitSelectOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
@@ -3642,6 +3642,12 @@ import { addressTypeOptions } from '@/option/base/common-address';
|
||||
import { packageOptions } from '@/option/business/common';
|
||||
import { formatUpdateUserName } from '@/utils/audit';
|
||||
import { getToken, isAdministrator } from '@/utils/auth';
|
||||
import {
|
||||
currencyUnit,
|
||||
mapFeeUnitOptions,
|
||||
remapPriceUnitCurrency,
|
||||
resolvePriceUnitByQuantityUnit,
|
||||
} from '@/utils/currency';
|
||||
import { formatContractOptionLabel } from '@/utils/contract';
|
||||
import { wgs84ToGcj02 } from '@/utils/coordinate';
|
||||
import { openImportDialog } from '@/utils/import-excel';
|
||||
@@ -4185,6 +4191,8 @@ export default {
|
||||
},
|
||||
selectionList: [],
|
||||
attachmentUploadMode: false,
|
||||
/** 复制来源运单业务状态(表单字段 addDisplay:false,提交时需显式带回) */
|
||||
copySourceBusinessStatus: '',
|
||||
standaloneFormKey: '',
|
||||
// 实例所属路由的路径快照:用于判断当前 $route 是否还是「本实例自己的路由」。
|
||||
// 必须在 data 里初始化,不能放 created —— Vue 的 Options API 执行顺序是
|
||||
@@ -4581,6 +4589,12 @@ export default {
|
||||
if (!currency) return '';
|
||||
return this.currencyRemark(currency);
|
||||
},
|
||||
taskFeeUnitSelectOptions() {
|
||||
return mapFeeUnitOptions(this.taskFeeUnitOptions, this.taskFreightCurrency || 'RMB');
|
||||
},
|
||||
defaultPriceUnit() {
|
||||
return `${currencyUnit(this.taskFreightCurrency || 'RMB')}/吨`;
|
||||
},
|
||||
isAdmin() {
|
||||
return isAdministrator(this.userInfo);
|
||||
},
|
||||
@@ -5175,7 +5189,7 @@ export default {
|
||||
quantity: goods.quantity ?? goods.cargoQuantity ?? goods.goodsQuantity ?? '',
|
||||
quantityUnit: goods.quantityUnit || goods.goodsQuantityUnit || goods.unit || '吨',
|
||||
unitPrice: goods.unitPrice,
|
||||
priceUnit: goods.priceUnit || '元/吨',
|
||||
priceUnit: goods.priceUnit || this.defaultPriceUnit,
|
||||
});
|
||||
},
|
||||
canOperation(operation, row) {
|
||||
@@ -6477,6 +6491,18 @@ export default {
|
||||
if (isAddMode) {
|
||||
delete submitRow.id;
|
||||
delete submitRow.waybillNo;
|
||||
// 复制提交:状态列未进表单,Avue 可能不带回;显式保留原运单业务状态(含已完成)
|
||||
const copyId = this.$route.query.copyId || '';
|
||||
if (copyId && !saveAsDraft) {
|
||||
const copiedStatus =
|
||||
this.form?.businessStatus ||
|
||||
this.copySourceBusinessStatus ||
|
||||
submitRow.businessStatus ||
|
||||
'';
|
||||
if (copiedStatus) {
|
||||
submitRow.businessStatus = copiedStatus;
|
||||
}
|
||||
}
|
||||
}
|
||||
const skipValidation = saveAsDraft && this.config.skipDraftValidation === true;
|
||||
if (
|
||||
@@ -6596,7 +6622,29 @@ export default {
|
||||
selected?.currency ||
|
||||
this.form.settlementCurrency ||
|
||||
'RMB';
|
||||
this.taskFreightCurrency = this.normalizeFreightCurrency(value);
|
||||
const nextCurrency = this.normalizeFreightCurrency(value);
|
||||
const previousCurrency = this.taskFreightCurrency;
|
||||
this.taskFreightCurrency = nextCurrency;
|
||||
if (previousCurrency && previousCurrency !== nextCurrency) {
|
||||
this.remapWaybillPriceUnits(nextCurrency);
|
||||
}
|
||||
},
|
||||
remapWaybillPriceUnits(currency) {
|
||||
if (this.form.priceUnit) {
|
||||
this.form.priceUnit = remapPriceUnitCurrency(this.form.priceUnit, currency);
|
||||
}
|
||||
(this.transportCargoRows || []).forEach(cargo => {
|
||||
if (cargo.priceUnit) {
|
||||
cargo.priceUnit = remapPriceUnitCurrency(cargo.priceUnit, currency);
|
||||
}
|
||||
});
|
||||
(this.taskFreightGroups || []).forEach(group => {
|
||||
(group.rows || []).forEach(row => {
|
||||
if (row.priceUnit) {
|
||||
row.priceUnit = remapPriceUnitCurrency(row.priceUnit, currency);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
loadFreightCurrencyOptions() {
|
||||
if (this.freightCurrencyOptions.length || this.freightCurrencyLoading) {
|
||||
@@ -6880,6 +6928,8 @@ export default {
|
||||
if (type === 'add' && copyId) {
|
||||
this.api.getDetail(copyId).then(res => {
|
||||
const sourceData = res.data.data || {};
|
||||
// 原运单业务状态(如 completed)提交时需原样带回并生成应收应付
|
||||
this.copySourceBusinessStatus = sourceData.businessStatus || '';
|
||||
// 清除不应该复制的字段(业务状态与原运单保持一致)
|
||||
delete sourceData.id;
|
||||
delete sourceData.code;
|
||||
@@ -6901,14 +6951,18 @@ export default {
|
||||
delete sourceData.updateUserName;
|
||||
|
||||
this.applyFormDetail(sourceData);
|
||||
// 标记为手工创建;业务状态沿用原运单
|
||||
// 标记为手工创建;业务状态沿用原运单(含已完成)
|
||||
this.form.dataSource = '手工创建';
|
||||
if (this.copySourceBusinessStatus) {
|
||||
this.form.businessStatus = this.copySourceBusinessStatus;
|
||||
}
|
||||
done();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (type === 'add') {
|
||||
this.copySourceBusinessStatus = '';
|
||||
this.form = {
|
||||
...(this.config.defaultForm || {}),
|
||||
};
|
||||
@@ -7382,7 +7436,7 @@ export default {
|
||||
if (this.isSentinelMinusOne(this.form[prop])) this.form[prop] = '';
|
||||
});
|
||||
this.form.priceUnit =
|
||||
this.form.priceUnit || taskInfo.priceUnit || goodsInfo.priceUnit || '元/吨';
|
||||
this.form.priceUnit || taskInfo.priceUnit || goodsInfo.priceUnit || this.defaultPriceUnit;
|
||||
this.form.otherFeeTotal = this.normalizeOptionalAmount(
|
||||
this.form.otherFeeTotal || taskInfo.otherFeeTotal || goodsInfo.otherFeeTotal || ''
|
||||
);
|
||||
@@ -8095,7 +8149,7 @@ export default {
|
||||
if (index === 0 && !cargo.unitPrice && this.form.unitPrice) {
|
||||
cargo.unitPrice = this.form.unitPrice;
|
||||
}
|
||||
cargo.priceUnit = cargo.priceUnit || this.form.priceUnit || '元/吨';
|
||||
cargo.priceUnit = cargo.priceUnit || this.form.priceUnit || this.defaultPriceUnit;
|
||||
if (this.isBillingFieldEmpty(cargo.freightAmount)) {
|
||||
cargo.freightAmount = this.normalizeOptionalAmount(
|
||||
freightItems[index]?.freightAmount ?? ''
|
||||
@@ -8477,7 +8531,7 @@ export default {
|
||||
},
|
||||
addTransportCargoRow(index = -1, row = {}) {
|
||||
const nextRow = this.normalizeTransportCargoRow({
|
||||
priceUnit: this.form.priceUnit || '元/吨',
|
||||
priceUnit: this.form.priceUnit || this.defaultPriceUnit,
|
||||
...row,
|
||||
});
|
||||
if (
|
||||
@@ -8524,12 +8578,9 @@ export default {
|
||||
this.syncTransportCargoJson();
|
||||
},
|
||||
resolvePriceUnitByQuantityUnit(quantityUnit) {
|
||||
return (
|
||||
{
|
||||
吨: '元/吨',
|
||||
方: '元/立方',
|
||||
件: '元/件',
|
||||
}[String(quantityUnit || '').trim()] || ''
|
||||
return resolvePriceUnitByQuantityUnit(
|
||||
quantityUnit,
|
||||
this.taskFreightCurrency || this.form.settlementCurrency || 'RMB'
|
||||
);
|
||||
},
|
||||
handleTransportCargoQuantityUnitChange(quantityUnit) {
|
||||
|
||||
Reference in New Issue
Block a user