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

收款单bug修复

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