优化财务单据
This commit is contained in:
@@ -47,7 +47,7 @@ export const FinancialModalMixin = {
|
||||
}
|
||||
})
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({'billTime':getNowFormatDateTime()})
|
||||
this.form.setFieldsValue({'billTime':getNowFormatDateTime(), 'totalPrice': 0, 'discountMoney': 0, 'changeAmount': 0})
|
||||
})
|
||||
this.$nextTick(() => {
|
||||
getAccount({}).then((res)=>{
|
||||
@@ -147,25 +147,55 @@ export const FinancialModalMixin = {
|
||||
switch(column.key) {
|
||||
case "eachAmount":
|
||||
target.recalcAllStatisticsColumns()
|
||||
that.autoChangePrice(target)
|
||||
that.autoChangeAmount(target)
|
||||
break;
|
||||
}
|
||||
},
|
||||
//根据仓库和条码查询库存
|
||||
getStockByDepotBarCode(row, target){
|
||||
findStockByDepotAndBarCode({ depotId: row.depotId, barCode: row.barCode }).then((res) => {
|
||||
if (res && res.code === 200) {
|
||||
target.setValues([{rowKey: row.id, values: {stock: res.data.stock}}])
|
||||
target.recalcAllStatisticsColumns()
|
||||
}
|
||||
})
|
||||
},
|
||||
//改变优惠、本次付款、欠款的值
|
||||
autoChangePrice(target) {
|
||||
//改变本次欠款的值
|
||||
autoChangeAmount(target) {
|
||||
let allEachAmount = target.statisticsColumns.eachAmount-0
|
||||
let discountMoney = this.form.getFieldValue('discountMoney')-0
|
||||
let changeAmount = (allEachAmount-discountMoney).toFixed(2)
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({'changeAmount':allEachAmount})
|
||||
this.form.setFieldsValue({'totalPrice':allEachAmount, 'changeAmount':changeAmount})
|
||||
});
|
||||
},
|
||||
//改变优惠金额
|
||||
onKeyUpDiscountMoney(e) {
|
||||
const value = e.target.value-0
|
||||
let totalPrice = this.form.getFieldValue('totalPrice')-0
|
||||
let changeAmount = (totalPrice-value).toFixed(2)
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({'changeAmount':changeAmount})
|
||||
});
|
||||
},
|
||||
//选择欠款单据
|
||||
debtBillListOk(selectBillRows) {
|
||||
if(selectBillRows && selectBillRows.length>0) {
|
||||
this.requestSubTableDataEx(selectBillRows, this.accountTable);
|
||||
}
|
||||
},
|
||||
/** 查询某个tab的数据,给明细里面的金额赋值 */
|
||||
requestSubTableDataEx(selectBillRows, tab, success) {
|
||||
tab.loading = true
|
||||
let listEx = []
|
||||
let changeAmount = 0
|
||||
for(let i=0; i<selectBillRows.length; i++){
|
||||
let info = selectBillRows[i]
|
||||
info.billNumber = info.number
|
||||
info.needDebt = (info.discountLastMoney - info.changeAmount).toFixed(2)
|
||||
info.eachAmount = (info.discountLastMoney - info.changeAmount - info.finishDebt).toFixed(2);
|
||||
if(info.eachAmount != 0) {
|
||||
changeAmount += info.eachAmount-0
|
||||
listEx.push(info)
|
||||
}
|
||||
}
|
||||
tab.dataSource = listEx
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({'totalPrice':changeAmount, 'changeAmount':changeAmount})
|
||||
});
|
||||
typeof success === 'function' ? success(res) : ''
|
||||
tab.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user