feat(order): 自动计算总代出货金额并优化表单初始化逻辑
- 将总代出货金额字段设为只读,并自动填充计算结果 - 新增 totalConfigAmount 计算属性,用于汇总软硬件及维护产品总价- 表单初始化时深拷贝订单数据以避免引用问题-优化付款方式相关选项的加载与回显逻辑,确保原始值正确恢复 - 在产品信息变更后自动更新总代出货金额字段dev_1.0.0
parent
3f4004c349
commit
1edda375a8
|
|
@ -90,7 +90,7 @@
|
|||
<el-col :span="(form.processTemplate=='1' ||(form.processTemplate!='1' &&( form.orderStatus=='1'||form.orderStatus=='2')))?8:16"
|
||||
>
|
||||
<el-form-item label="总代出货金额" prop="shipmentAmount">
|
||||
<el-input v-model="form.shipmentAmount" placeholder="请输入金额"/>
|
||||
<el-input v-model="form.shipmentAmount" placeholder="自动计算" readonly/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
|
|
@ -544,6 +544,19 @@ export default {
|
|||
return null;
|
||||
}
|
||||
return this.groupedContractFiles[this.activeContractVersionTab].bakFile;
|
||||
},
|
||||
totalConfigAmount() {
|
||||
let total = 0;
|
||||
if (this.form.softwareProjectProductInfoList) {
|
||||
total += this.form.softwareProjectProductInfoList.reduce((sum, item) => sum + (item.allPrice || 0), 0);
|
||||
}
|
||||
if (this.form.hardwareProjectProductInfoList) {
|
||||
total += this.form.hardwareProjectProductInfoList.reduce((sum, item) => sum + (item.allPrice || 0), 0);
|
||||
}
|
||||
if (this.form.maintenanceProjectProductInfoList) {
|
||||
total += this.form.maintenanceProjectProductInfoList.reduce((sum, item) => sum + (item.allPrice || 0), 0);
|
||||
}
|
||||
return total;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -608,7 +621,9 @@ export default {
|
|||
this.reset();
|
||||
if (this.isEdit) {
|
||||
getOrder(this.orderId).then(response => {
|
||||
this.form = response.data.projectOrderInfo;
|
||||
|
||||
this.form = {...response.data.projectOrderInfo};
|
||||
|
||||
this.isProjectSelected = true;
|
||||
// 兼容版本号为空的情况
|
||||
if (!this.form.versionCode) {
|
||||
|
|
@ -652,8 +667,25 @@ export default {
|
|||
}
|
||||
// 手动触发联动
|
||||
this.handleBgChange(this.form.bgProperty);
|
||||
// 先调用 handleChannelChange 设置 paymentMethodOptions
|
||||
this.handleChannelChange(this.form.orderChannel);
|
||||
this.handlePaymentMethodChange(this.form.paymentMethod);
|
||||
// 存储原始的付款方式、付款比例和付款条件
|
||||
const originalPaymentMethod = response.data.projectOrderInfo.paymentMethod;
|
||||
const originalPaymentRatio = response.data.projectOrderInfo.paymentRatio;
|
||||
const originalPaymentDescription = response.data.projectOrderInfo.paymentDescription;
|
||||
|
||||
// 重新设置付款方式,并触发其change事件以更新付款条件描述
|
||||
if (originalPaymentMethod) {
|
||||
this.form.paymentMethod = originalPaymentMethod;
|
||||
this.handlePaymentMethodChange(originalPaymentMethod);
|
||||
}
|
||||
// 恢复原始的付款比例和付款条件,以防被 handlePaymentMethodChange 覆盖
|
||||
if (originalPaymentRatio !== null) {
|
||||
this.form.paymentRatio = originalPaymentRatio;
|
||||
}
|
||||
if (originalPaymentDescription) {
|
||||
this.form.paymentDescription = originalPaymentDescription;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 设置新增时的默认值
|
||||
|
|
@ -987,6 +1019,7 @@ export default {
|
|||
this.form.softwareProjectProductInfoList = productData.softwareProjectProductInfoList;
|
||||
this.form.hardwareProjectProductInfoList = productData.hardwareProjectProductInfoList;
|
||||
this.form.maintenanceProjectProductInfoList = productData.maintenanceProjectProductInfoList;
|
||||
this.form.shipmentAmount = this.totalConfigAmount; // Update shipmentAmount
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue