优化采购入库的账户

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

@@ -545,3 +545,21 @@ export function removeByVal(arrylist, val) {
} }
} }
} }
/**
* 将数组单个金额中的数值转为负数
* @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[1]) {this.model.twoAccountId = idList[1]-0}
if(idList[2]) {this.model.threeAccountId = idList[2]-0} if(idList[2]) {this.model.threeAccountId = idList[2]-0}
let moneyList = moneyStr.split(",") let moneyList = moneyStr.split(",")
if(moneyList[0]) {this.model.oneAccountPrice = moneyList[0]} if(moneyList[0]) {this.model.oneAccountPrice = Math.abs(moneyList[0])}
if(moneyList[1]) {this.model.twoAccountPrice = moneyList[1]} if(moneyList[1]) {this.model.twoAccountPrice = Math.abs(moneyList[1])}
if(moneyList[2]) {this.model.threeAccountPrice = moneyList[2]} if(moneyList[2]) {this.model.threeAccountPrice = Math.abs(moneyList[2])}
} }
this.visible = true; this.visible = true;
this.$nextTick(() => { this.$nextTick(() => {

View File

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