优化采购入库和销售出库的关联单据调用的逻辑

This commit is contained in:
季圣华
2022-04-25 23:36:48 +08:00
parent d7afcc54e5
commit b75076a5d4
2 changed files with 24 additions and 16 deletions

View File

@@ -392,8 +392,7 @@
'organId': record.organId, 'organId': record.organId,
'linkNumber': record.number, 'linkNumber': record.number,
'remark': record.remark, 'remark': record.remark,
'discountLastMoney': record.totalPrice, 'discount': record.discount
'changeAmount': record.totalPrice
}) })
}); });
// 加载子表数据 // 加载子表数据
@@ -411,24 +410,29 @@
if(res && res.code === 200){ if(res && res.code === 200){
let list = res.data.rows let list = res.data.rows
let listEx = [] let listEx = []
let discountLastMoney = 0 let allTaxLastMoney = 0
for(let j=0; j<list.length; j++){ for(let j=0; j<list.length; j++){
let info = list[j]; let info = list[j];
if(info.preNumber) { if(info.preNumber) {
info.operNumber = info.preNumber - info.finishNumber info.operNumber = info.preNumber - info.finishNumber
info.allPrice = info.operNumber * info.unitPrice-0; info.allPrice = info.operNumber * info.unitPrice-0
discountLastMoney += info.allPrice
} }
info.taxMoney = 0 let taxRate = info.taxRate-0
info.taxLastMoney = info.allPrice info.taxMoney = (info.allPrice*taxRate/100).toFixed(2)-0
info.taxLastMoney = info.allPrice + info.taxMoney
allTaxLastMoney += info.taxLastMoney
listEx.push(info) listEx.push(info)
this.changeColumnShow(info) this.changeColumnShow(info)
} }
tab.dataSource = listEx tab.dataSource = listEx
//给优惠后金额重新赋值 //给优惠后金额重新赋值
if(discountLastMoney) { if(allTaxLastMoney) {
let discount = this.form.getFieldValue('discount')-0
let discountMoney = (discount*allTaxLastMoney/100).toFixed(2)-0
let discountLastMoney = allTaxLastMoney - discountMoney
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue({ this.form.setFieldsValue({
'discountMoney': discountMoney,
'discountLastMoney': discountLastMoney, 'discountLastMoney': discountLastMoney,
'changeAmount': discountLastMoney 'changeAmount': discountLastMoney
}) })

View File

@@ -398,8 +398,7 @@
'organId': record.organId, 'organId': record.organId,
'linkNumber': record.number, 'linkNumber': record.number,
'remark': record.remark, 'remark': record.remark,
'discountLastMoney': record.totalPrice, 'discount': record.discount
'changeAmount': record.totalPrice
}) })
}); });
// 加载子表数据 // 加载子表数据
@@ -417,24 +416,29 @@
if(res && res.code === 200){ if(res && res.code === 200){
let list = res.data.rows let list = res.data.rows
let listEx = [] let listEx = []
let discountLastMoney = 0 let allTaxLastMoney = 0
for(let j=0; j<list.length; j++){ for(let j=0; j<list.length; j++){
let info = list[j]; let info = list[j];
if(info.preNumber) { if(info.preNumber) {
info.operNumber = info.preNumber - info.finishNumber info.operNumber = info.preNumber - info.finishNumber
info.allPrice = info.operNumber * info.unitPrice-0; info.allPrice = info.operNumber * info.unitPrice-0
discountLastMoney += info.allPrice
} }
info.taxMoney = 0 let taxRate = info.taxRate-0
info.taxLastMoney = info.allPrice info.taxMoney = (info.allPrice*taxRate/100).toFixed(2)-0
info.taxLastMoney = info.allPrice + info.taxMoney
allTaxLastMoney += info.taxLastMoney
listEx.push(info) listEx.push(info)
this.changeColumnShow(info) this.changeColumnShow(info)
} }
tab.dataSource = listEx tab.dataSource = listEx
//给优惠后金额重新赋值 //给优惠后金额重新赋值
if(discountLastMoney) { if(allTaxLastMoney) {
let discount = this.form.getFieldValue('discount')-0
let discountMoney = (discount*allTaxLastMoney/100).toFixed(2)-0
let discountLastMoney = allTaxLastMoney - discountMoney
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue({ this.form.setFieldsValue({
'discountMoney': discountMoney,
'discountLastMoney': discountLastMoney, 'discountLastMoney': discountLastMoney,
'changeAmount': discountLastMoney 'changeAmount': discountLastMoney
}) })