Commit f20a0cee authored by dragondean@qq.com's avatar dragondean@qq.com

应收详情的bug

parent f795462d
...@@ -516,6 +516,7 @@ export default { ...@@ -516,6 +516,7 @@ export default {
}, },
WriteOffProportion(){ WriteOffProportion(){
let total = 0 let total = 0
if(!this.form.receiptAccountList) return 0
let amountTotal = this.form.receiptAccountList.find(item=>item.type=='total').writeOffAmount let amountTotal = this.form.receiptAccountList.find(item=>item.type=='total').writeOffAmount
this.detailed.forEach(item => { this.detailed.forEach(item => {
...@@ -609,23 +610,23 @@ export default { ...@@ -609,23 +610,23 @@ export default {
var n
// 收款总计 // 收款总计
var amountList =[] var amountList =[]
this.currencyList.forEach((item,index)=>{ this.currencyList.forEach((item,index)=>{
var nairaListByList = this.list.filter(v => v.currencyId === item.id) var nairaListByList = this.list.filter(v => v.currencyId === item.id)
if(nairaListByList.length>0){ if(nairaListByList.length>0){
var discountNaira = nairaListByList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0) var discountNaira = nairaListByList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
var n = res.data.find(v => v.currencyId == item.id) n = res.data.find(v => v.currencyId == item.id)
n && (n.discountTotal = discountNaira) n && (n.discountTotal = discountNaira)
} }
var dollarList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == item.id) var dollarList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == item.id)
if(dollarList.length>0){ if(dollarList.length>0){
var dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount), 0).toFixed(2) var dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount), 0).toFixed(2)
if(n.discountTotal&&n.discountTotal>0){ if(n && n.discountTotal&&n.discountTotal>0){
amountList.push({currencyName:item.titleZh,amount:(dollar-n.discountTotal).toFixed(2)}) amountList.push({currencyName:item.titleZh, currencyId: item.id, amount:(dollar-n.discountTotal).toFixed(2)})
}else{ }else{
amountList.push({currencyName:item.titleZh,amount:dollar}) amountList.push({currencyName:item.titleZh, currencyId: item.id, amount:dollar})
} }
} }
...@@ -910,6 +911,8 @@ export default { ...@@ -910,6 +911,8 @@ export default {
}, },
handleAddReceiptItem() { handleAddReceiptItem() {
this.surplusData = [] this.surplusData = []
// 已收
let recepted = [] let recepted = []
this.detailed.forEach(item => { this.detailed.forEach(item => {
...@@ -918,13 +921,19 @@ export default { ...@@ -918,13 +921,19 @@ export default {
}else recepted[item.currencyId] = NP.plus(recepted[item.currencyId], item.amount) }else recepted[item.currencyId] = NP.plus(recepted[item.currencyId], item.amount)
}) })
console.log('rece',recepted) console.log('rece',recepted)
// 应收
let collom = [] let collom = []
this.form.receiptAccountList.forEach(item => { /* this.form.receiptAccountList.forEach(item => {
if(item.type!='total'){ if(item.type!='total'){
if(!collom[item.currencyId]){ if(!collom[item.currencyId]){
collom[item.currencyId] = item.receivableAmount-item.discountTotal collom[item.currencyId] = item.receivableAmount-item.discountTotal
}else collom[item.currencyId] = NP.plus(collom[item.currencyId], item.receivableAmount) }else collom[item.currencyId] = NP.plus(collom[item.currencyId], item.receivableAmount)
} }
}) */
// 从期望收费金额中提取应收币种和金额
this.form.receiptAccountList.find(item => item.type == 'total').collectionAmount.forEach(item => {
collom[item.currencyId] = item.amount
}) })
console.log('collom',collom) console.log('collom',collom)
// if(recepted.length>collom.length){ // if(recepted.length>collom.length){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment