|
@@ -38,7 +38,7 @@
|
|
|
@submit="handleFormSubmit"
|
|
|
@reset-change="handleFormReset"
|
|
|
/>
|
|
|
-
|
|
|
+
|
|
|
<!-- 物料明细区域 -->
|
|
|
<div class="material-detail-section">
|
|
|
<material-detail-table
|
|
@@ -74,14 +74,14 @@ import MaterialDetailTable from './material-detail-table.vue'
|
|
|
export default {
|
|
|
name: 'OrderForm',
|
|
|
mixins: [orderFormMixin],
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 组件注册
|
|
|
*/
|
|
|
components: {
|
|
|
MaterialDetailTable
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 组件数据
|
|
|
*/
|
|
@@ -251,7 +251,7 @@ export default {
|
|
|
// 调用mixin中的方法来正确处理导入物料(设置数据来源和删除权限)
|
|
|
// mixin中的方法会直接更新this.materialDetails并显示成功消息
|
|
|
orderFormMixin.methods.handleMaterialImport.call(this, importedMaterials)
|
|
|
-
|
|
|
+
|
|
|
// 重新计算订单总金额
|
|
|
this.calculateOrderTotal()
|
|
|
},
|
|
@@ -267,7 +267,7 @@ export default {
|
|
|
if (index >= 0 && index < this.materialDetails.length) {
|
|
|
this.$set(this.materialDetails, index, { ...row })
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 无论索引是否有效,都重新计算订单总金额
|
|
|
this.calculateOrderTotal()
|
|
|
},
|
|
@@ -282,17 +282,17 @@ export default {
|
|
|
const totalAmount = this.materialDetails.reduce((sum, item) => {
|
|
|
return sum + (Number(item.totalAmount) || 0)
|
|
|
}, 0)
|
|
|
-
|
|
|
+
|
|
|
// 计算订单总数量
|
|
|
const totalQuantity = this.materialDetails.reduce((sum, item) => {
|
|
|
return sum + (Number(item.orderQuantity) || 0)
|
|
|
}, 0)
|
|
|
-
|
|
|
+
|
|
|
// 计算总税额
|
|
|
const totalTaxAmount = this.materialDetails.reduce((sum, item) => {
|
|
|
return sum + (Number(item.taxAmount) || 0)
|
|
|
}, 0)
|
|
|
-
|
|
|
+
|
|
|
// 更新表单中的总金额、总数量和税额字段
|
|
|
if (this.formData) {
|
|
|
this.$set(this.formData, 'totalAmount', Math.round(totalAmount * 100) / 100)
|