优化采购入库的账户

This commit is contained in:
季圣华 2021-04-30 00:57:38 +08:00
parent abc1287b9e
commit 93a384dfdf
3 changed files with 25 additions and 6 deletions

View File

@ -544,4 +544,22 @@ export function removeByVal(arrylist, val) {
break;
}
}
}
/**
* 将数组单个金额中的数值转为负数
* @param arr
* @returns {Array}
*/
export function changeListFmtMinus(arr) {
var newArr = new Array();
for(var i=0; i<arr.length; i++) {
if(arr[i] < 0){
newArr.push((arr[i]-0).toString());
}
else {
newArr.push((0 - arr[i]).toString());
}
}
return newArr;
}

View File

@ -101,9 +101,9 @@
if(idList[1]) {this.model.twoAccountId = idList[1]-0}
if(idList[2]) {this.model.threeAccountId = idList[2]-0}
let moneyList = moneyStr.split(",")
if(moneyList[0]) {this.model.oneAccountPrice = moneyList[0]}
if(moneyList[1]) {this.model.twoAccountPrice = moneyList[1]}
if(moneyList[2]) {this.model.threeAccountPrice = moneyList[2]}
if(moneyList[0]) {this.model.oneAccountPrice = Math.abs(moneyList[0])}
if(moneyList[1]) {this.model.twoAccountPrice = Math.abs(moneyList[1])}
if(moneyList[2]) {this.model.threeAccountPrice = Math.abs(moneyList[2])}
}
this.visible = true;
this.$nextTick(() => {

View File

@ -123,7 +123,7 @@
import { FormTypes } from '@/utils/JEditableTableUtil'
import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
import { BillModalMixin } from '../mixins/BillModalMixin'
import { getMpListShort } from "@/utils/util"
import { getMpListShort, changeListFmtMinus} from "@/utils/util"
import JDate from '@/components/jeecg/JDate'
import Vue from 'vue'
export default {
@ -238,7 +238,8 @@
for(let item of detailArr){
totalPrice += item.allPrice-0
}
billMain.totalPrice = totalPrice
billMain.totalPrice = 0-totalPrice
billMain.changeAmount = 0-billMain.changeAmount
if(billMain.accountId === 0) {
billMain.accountId = ''
}
@ -254,7 +255,7 @@
},
manyAccountModalFormOk(idList, moneyList, allPrice) {
this.accountIdList = idList
this.accountMoneyList = moneyList
this.accountMoneyList = changeListFmtMinus(moneyList)
this.$nextTick(() => {
this.form.setFieldsValue({'changeAmount':allPrice})
});