Commit 6f7164a4 authored by 我在何方's avatar 我在何方

新增收款单修复

parent bb224889
...@@ -376,7 +376,7 @@ ...@@ -376,7 +376,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.type !== 'total'">{{ scope.row.collectionAmount }}</span> <span v-if="scope.row.type !== 'total'">{{ scope.row.collectionAmount }}</span>
<div v-else> <div v-else>
<div v-for="itemAmount in scope.row.collectionAmount">{{$i18n.locale=='zh_CN'?(itemAmount?itemAmount.currencyNameZh:''):(itemAmount?itemAmount.currencyNameEn:'')}}: {{ itemAmount.amount||''}}</div> <div v-for="itemAmount in scope.row.collectionAmount">{{$i18n.locale=='zh_CN'?(itemAmount?itemAmount.currencyNameZh:''):(itemAmount?itemAmount.currencyNameEn:'')}}: {{ itemAmount?itemAmount.amount:''}}</div>
<!-- <div v-if="scope.row.collectionAmount[1]">{{ $t('人民币') }}: {{ scope.row.collectionAmount[1].toFixed(6) }}</div> <!-- <div v-if="scope.row.collectionAmount[1]">{{ $t('人民币') }}: {{ scope.row.collectionAmount[1].toFixed(6) }}</div>
<div v-if="scope.row.collectionAmount[2]">{{ $t('奈拉') }}: {{ scope.row.collectionAmount[2].toFixed(6) }}</div> <div v-if="scope.row.collectionAmount[2]">{{ $t('奈拉') }}: {{ scope.row.collectionAmount[2].toFixed(6) }}</div>
<div v-if="scope.row.collectionAmount[3]">{{ $t('西非法郎') }}: {{ scope.row.collectionAmount[3].toFixed(6) }}</div> --> <div v-if="scope.row.collectionAmount[3]">{{ $t('西非法郎') }}: {{ scope.row.collectionAmount[3].toFixed(6) }}</div> -->
...@@ -745,10 +745,18 @@ export default { ...@@ -745,10 +745,18 @@ export default {
isUpdate:false isUpdate:false
}; };
}, },
// activated(){ activated(){
// console.log(11) if (this.$route.query.id) {
// // this.getList(); this.flag = true
// }, this.id = this.$route.query.id;
this.getReceivableData()
}
console.log(this.$route.query.receiptId)
if (this.$route.query.receiptId && this.$route.query.receiptId !== '0') {
this.receiptId = this.$route.query.receiptId;
this.getReceivableInfo()
}
},
async created() { async created() {
getUserProfile().then(res => { getUserProfile().then(res => {
this.discountForm.author = res.data.username this.discountForm.author = res.data.username
...@@ -775,69 +783,11 @@ export default { ...@@ -775,69 +783,11 @@ export default {
if (that.$route.query.id) { if (that.$route.query.id) {
this.flag = true this.flag = true
this.id = this.$route.query.id; this.id = this.$route.query.id;
console.log(this.id) this.getReceivableData()
getReceiptInfoByIds({ id: this.id }).then(res => {
if(res.data.rateValidateDate) res.data.rateValidateDate = dayjs(res.data.rateValidateDate).format('YYYY-MM-DD HH:mm:ss')
this.form = Object.assign({}, this.form, res.data)
})
await getInvoicingItem({ id: this.id }).then(res => {
this.list = [...res.data]
this.list.map(v=>{
if(!v.taxPoint){
v.taxAmount = v.totalAmount
}
})
})
getReceiptAccountList({ id: this.id }).then(res => {
if (res.data.length > 0) {
// totalAmount
res.data = [...res.data, {
type: 'total',
writeOffAmount: res.data.reduce((total, currentValue) => NP.plus(total, currentValue.writeOffAmount || 0), 0),
collectionAmount: []
}]
}
this.$set(this.form, 'receiptAccountList', [...res.data])
this.$nextTick(() => {
// const dollarList = this.list.filter(v => v.currencyId === 1)
// const discountDollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
// const d = this.form.receiptAccountList.find(v => v.currencyId == 1)
// d && (d.discountTotal = discountDollar)
// const rmbList = this.list.filter(v => v.currencyId === 2)
// const discountRmb = rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
// const r = this.form.receiptAccountList.find(v => v.currencyId == 2)
// r && (r.discountTotal = discountRmb)
// const nairaList = this.list.filter(v => v.currencyId === 3)
// const discountNaira = nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
// const n = this.form.receiptAccountList.find(v => v.currencyId == 3)
// n && (n.discountTotal = discountNaira)
this.form.receiptAccountList.forEach((item, index) => {
this.rateChange(item, index)
});
this.calculation()
})
})
} }
if (that.$route.query.receiptId && that.$route.query.receiptId !== '0') { if (that.$route.query.receiptId && that.$route.query.receiptId !== '0') {
this.receiptId = this.$route.query.receiptId; this.receiptId = this.$route.query.receiptId;
getReceivableInfoByIds({ id: this.receiptId }).then(res => { this.getReceivableInfo()
this.list = [{...res.data}]
this.list.map(v=>{
if(!v.taxPoint){
v.taxAmount = v.totalAmount
}
})
this.calculation()
getOrder(res.data.orderId).then(response => {
// console.log(response.data)
if(response.data.customerId) this.$set(this.form,'customerId',response.data.customerId)
})
})
} }
// this.getList(); // this.getList();
...@@ -904,6 +854,69 @@ export default { ...@@ -904,6 +854,69 @@ export default {
} }
}, },
methods: { methods: {
getReceivableData(){
getReceiptInfoByIds({ id: this.id }).then(res => {
if(res.data.rateValidateDate) res.data.rateValidateDate = dayjs(res.data.rateValidateDate).format('YYYY-MM-DD HH:mm:ss')
this.form = Object.assign({}, this.form, res.data)
})
getInvoicingItem({ id: this.id }).then(res => {
this.list = [...res.data]
this.list.map(v=>{
if(!v.taxPoint){
v.taxAmount = v.totalAmount
}
})
})
getReceiptAccountList({ id: this.id }).then(res => {
if (res.data.length > 0) {
// totalAmount
res.data = [...res.data, {
type: 'total',
writeOffAmount: res.data.reduce((total, currentValue) => NP.plus(total, currentValue.writeOffAmount || 0), 0),
collectionAmount: []
}]
}
this.$set(this.form, 'receiptAccountList', [...res.data])
this.$nextTick(() => {
// const dollarList = this.list.filter(v => v.currencyId === 1)
// const discountDollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
// const d = this.form.receiptAccountList.find(v => v.currencyId == 1)
// d && (d.discountTotal = discountDollar)
// const rmbList = this.list.filter(v => v.currencyId === 2)
// const discountRmb = rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
// const r = this.form.receiptAccountList.find(v => v.currencyId == 2)
// r && (r.discountTotal = discountRmb)
// const nairaList = this.list.filter(v => v.currencyId === 3)
// const discountNaira = nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
// const n = this.form.receiptAccountList.find(v => v.currencyId == 3)
// n && (n.discountTotal = discountNaira)
this.form.receiptAccountList.forEach((item, index) => {
this.rateChange(item, index)
});
this.calculation()
})
})
},
getReceivableInfo(){
getReceivableInfoByIds({ id: this.receiptId }).then(res => {
this.list = [{...res.data}]
this.list.map(v=>{
if(!v.taxPoint){
v.taxAmount = v.totalAmount
}
})
this.calculation()
getOrder(res.data.orderId).then(response => {
// console.log(response.data)
if(response.data.customerId) this.$set(this.form,'customerId',response.data.customerId)
})
})
},
getCurrencyLabel(id){ getCurrencyLabel(id){
var label = this.currencyList.filter(item=>item.id == id) var label = this.currencyList.filter(item=>item.id == id)
if(label.length>0) return this.$i18n.locale=='zh_CN'?label[0].titleZh:label[0].titleEn if(label.length>0) return this.$i18n.locale=='zh_CN'?label[0].titleZh:label[0].titleEn
......
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