Commit 1aa99a44 authored by 我在何方's avatar 我在何方

收款单bug修复

parent 960d6e05
...@@ -720,7 +720,10 @@ export default { ...@@ -720,7 +720,10 @@ export default {
loading1: false, loading1: false,
uploadFileUrl: process.env.VUE_APP_BASE_API + "/app-api/file/upload", // 上传的图片服务器地址 uploadFileUrl: process.env.VUE_APP_BASE_API + "/app-api/file/upload", // 上传的图片服务器地址
form: { form: {
receiptAccountList: [] receiptAccountList: [],
departmentId:'',
salesmanId:'',
salesmanName:''
}, },
creatorData: [], creatorData: [],
list: [], list: [],
...@@ -754,7 +757,9 @@ export default { ...@@ -754,7 +757,9 @@ export default {
currencyList: [], currencyList: [],
saveBtnLoading: false, saveBtnLoading: false,
discountVisible: false, discountVisible: false,
discountForm: {}, discountForm: {
author:''
},
selectListRow: {}, selectListRow: {},
selectListIndex: 0, selectListIndex: 0,
flag: false, flag: false,
...@@ -773,39 +778,43 @@ export default { ...@@ -773,39 +778,43 @@ export default {
userInfo:null userInfo:null
}; };
}, },
activated(){ async activated(){
if (this.$route.query.id) { let that = this;
this.flag = true await getUserProfile().then(res => that.userInfo = res.data)
this.id = this.$route.query.id; if (that.$route.query.id) {
this.getReceivableData() that.flag = true
that.id = that.$route.query.id;
that.getReceivableData()
}else{ }else{
this.discountForm.author = this.userInfo.username that.removeData()
this.form.departmentId = this.userInfo.deptId that.$set(that.form,'departmentId',that.userInfo.deptId)
this.form.salesmanId = this.userInfo.id that.$set(that.discountForm,'author',that.userInfo.nickname)
that.$set(that.form,'salesmanId',that.userInfo.id)
that.$set(that.form,'salesmanName',that.userInfo.nickname)
} }
if (this.$route.query.receiptId && this.$route.query.receiptId != 0) { if (that.$route.query.receiptId && that.$route.query.receiptId != 0) {
this.receiptId = this.$route.query.receiptId; that.receiptId = that.$route.query.receiptId;
this.getReceivableInfo() that.getReceivableInfo()
}else{ }else{
this.removeData() // that.removeData()
} }
if (this.$route.query.orderId) { if (that.$route.query.orderId) {
getReceivableByOrderId({orderId:this.$route.query.orderId}).then(response => { getReceivableByOrderId({orderId:that.$route.query.orderId}).then(response => {
this.list = [...response.data] that.list = [...response.data]
this.list.map(v=>{ that.list.map(v=>{
if(!v.taxPoint){ if(!v.taxPoint){
v.taxAmount = v.totalAmount v.taxAmount = v.totalAmount
} }
}) })
this.calculation() that.calculation()
getOrder(this.$route.query.orderId).then(response => { getOrder(that.$route.query.orderId).then(response => {
// console.log(response.data) // console.log(response.data)
if(response.data.customerId) this.$set(this.form,'customerId',response.data.customerId) if(response.data.customerId) that.$set(that.form,'customerId',response.data.customerId)
}) })
getDestCountryByOrderId({orderId:this.$route.query.orderId}).then(response => { getDestCountryByOrderId({orderId:that.$route.query.orderId}).then(response => {
// console.log(response.data) // console.log(response.data)
if(response.data) this.$set(this.queryParams,'destCountry',response.data) if(response.data) that.$set(that.queryParams,'destCountry',response.data)
}) })
}) })
} }
...@@ -856,9 +865,10 @@ export default { ...@@ -856,9 +865,10 @@ export default {
this.id = this.$route.query.id; this.id = this.$route.query.id;
this.getReceivableData() this.getReceivableData()
}else{ }else{
this.discountForm.author = this.userInfo.username this.discountForm.author = this.userInfo.nickname
this.form.departmentId = this.userInfo.deptId this.form.departmentId = this.userInfo.deptId
this.form.salesmanId = this.userInfo.id this.form.salesmanId = this.userInfo.id
this.$set(this.form,'salesmanName',this.userInfo.nickname)
} }
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;
...@@ -955,9 +965,10 @@ export default { ...@@ -955,9 +965,10 @@ export default {
getReceiptInfoByIds({ id: this.id }).then(res => { getReceiptInfoByIds({ id: this.id }).then(res => {
if(res.data.rateValidateDate) res.data.rateValidateDate = dayjs(res.data.rateValidateDate).format('YYYY-MM-DD HH:mm:ss') 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) this.form = Object.assign({}, this.form, res.data)
this.discountForm.author = this.userInfo.username this.discountForm.author = this.userInfo.nickname
if(!this.form.departmentId) this.form.departmentId = this.userInfo.deptId if(!this.form.departmentId) this.form.departmentId = this.userInfo.deptId
if(!this.form.salesmanId) this.form.salesmanId = this.userInfo.id if(!this.form.salesmanId) this.form.salesmanId = this.userInfo.id
if(!this.form.salesmanName) this.$set(this.form,'salesmanName',this.userInfo.nickname)
}) })
getInvoicingItem({ id: this.id }).then(res => { getInvoicingItem({ id: this.id }).then(res => {
this.list = [...res.data] this.list = [...res.data]
...@@ -1055,11 +1066,12 @@ export default { ...@@ -1055,11 +1066,12 @@ export default {
return '' return ''
}, },
writeOffRateChange(row, index) { writeOffRateChange(row, index) {
if(parseInt(row.writeOffRate)===0){ if(row.writeOffRate==0&&parseInt(row.writeOffRate)===0){
this.$modal.msgError(this.$t('汇率不能为0,请输入正确的汇率')); this.$modal.msgError(this.$t('汇率不能为0,请输入正确的汇率'));
} }
if(row.writeOffRate){ if(row.writeOffRate){
row.writeOffAmount = Math.round(NP.times(row.writeOffRate || 0, NP.minus(row.receivableAmount, row.discountTotal)))
row.writeOffAmount = Math.round(NP.times(row.writeOffRate || 0, NP.minus(row.receivableAmount, row.discountTotal||0)))
}else{ }else{
row.writeOffAmount = '' row.writeOffAmount = ''
} }
...@@ -1068,7 +1080,7 @@ export default { ...@@ -1068,7 +1080,7 @@ export default {
this.form.receiptAccountList[this.form.receiptAccountList.length -1].writeOffAmount = writeOffAmountTotal this.form.receiptAccountList[this.form.receiptAccountList.length -1].writeOffAmount = writeOffAmountTotal
}, },
rateChange(row, index) { rateChange(row, index) {
if(parseInt(row.collectionRate)===0){ if(row.collectionRate==0&&parseInt(row.collectionRate)===0){
this.$modal.msgError(this.$t('汇率不能为0,请输入正确的汇率')); this.$modal.msgError(this.$t('汇率不能为0,请输入正确的汇率'));
} }
if(row.collectionRate){ if(row.collectionRate){
...@@ -1446,11 +1458,20 @@ export default { ...@@ -1446,11 +1458,20 @@ export default {
// params.receiptAccountList.length = params.receiptAccountList.length - 1 // params.receiptAccountList.length = params.receiptAccountList.length - 1
var saveStatus = true var saveStatus = true
var writeStatus = true
var reatStatus = true
params.receiptAccountList.forEach(v => { params.receiptAccountList.forEach(v => {
if(v.type!='total'){ if(v.type!='total'){
if(!v.platformAccountId){ if(!v.platformAccountId){
saveStatus = false saveStatus = false
} }
if(!v.writeOffRate){
writeStatus = false
}
if(!v.collectionRate){
reatStatus = false
}
var bankname = this.bankData.filter(item=>item.id == v.platformAccountId) var bankname = this.bankData.filter(item=>item.id == v.platformAccountId)
if(bankname.length>0){ if(bankname.length>0){
v.platformAccountName = bankname[0].baAccountName v.platformAccountName = bankname[0].baAccountName
...@@ -1461,10 +1482,19 @@ export default { ...@@ -1461,10 +1482,19 @@ export default {
v.writeOffRate = Number(v.writeOffRate) v.writeOffRate = Number(v.writeOffRate)
} }
}) })
if(!writeStatus){
this.$modal.msgError(this.$t('核销基准币种汇率不能为0,请输入正确的汇率'));
return
}
if(!saveStatus){ if(!saveStatus){
this.$modal.msgError(this.$t('请添加收款账户')); this.$modal.msgError(this.$t('请添加收款账户'));
return return
} }
if(!reatStatus){
this.$modal.msgError(this.$t('期望收款汇率不能为0,请输入正确的汇率'));
return
}
delete params.receivableDetail delete params.receivableDetail
......
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