pull/1/head
张同海 2 years ago
parent 2f7ed5ff60
commit ee1e1cd6e2

@ -1055,7 +1055,6 @@ export default {
let kgs = 0
let cbm = 0
this.bookingDetails.ctnInputs.forEach(item => {
console.log(item)
if (parseFloat(item.pkgs)) {
pkgs = pkgs + parseFloat(item.pkgs)
}
@ -1066,74 +1065,97 @@ export default {
cbm = cbm + parseFloat(item.cbm)
}
})
let that = this
let confirm = text => {
this.$confirm({
title: `${text}不一致,是否继续?`,
okText: '是',
okType: 'danger',
cancelText: '否',
onOk() {
const _data = JSON.parse(JSON.stringify(that.bookingDetails))
delete _data.hbList
BookingOrderAddOrUpdate(_data)
.then(res => {
if (res.success) {
that.$message.success('保存成功')
if (that.isAdd) {
that.isCopy = false
that.isAdd = false
that.$router.replace({
name: 'BookingDetail',
query: {
id: res.data,
type: that.bookingDetails.carrierid,
noOpenTab: true,
mblno: that.bookingDetails.mblno
}
})
} else if (that.$route.query.mblno === that.bookingDetails.mblno) {
that.isCopy = false
that.isAdd = false
console.log('1.1 == 保存成功 - 不切换路由 ==', that.id)
// that.init()
that.checkSaveFun({ type: 'hbList', hasChange: false })
that.checkSaveFun({ type: 'details', hasChange: false })
} else {
that.isCopy = false
that.isAdd = false
// console.log('1.2 == - ==', that.id)
that.$router.replace({
name: 'BookingDetail',
query: {
id: that.id,
type: that.bookingDetails.carrierid,
noOpenTab: true,
mblno: that.bookingDetails.mblno
}
})
}
// that.init()
that.$forceUpdate()
} else {
if (typeof res.message === 'string') {
that.$message.error(res.message)
} else {
that.$message.error('保存失败')
}
}
})
.catch(err => {
console.log(err)
})
},
onCancel() {
return false
},
class: 'test'
})
}
let WText = ''
if (parseFloat(pkgs) != parseFloat(this.bookingDetails.pkgs)) {
console.log(parseFloat(pkgs), parseFloat(this.bookingDetails.pkgs))
this.$message.error('保存失败,件数不一致')
return false
if (WText) {
WText = `${WText},件数`
} else {
WText = `件数`
}
}
if (parseFloat(kgs) != parseFloat(this.bookingDetails.kgs)) {
console.log(parseFloat(kgs), parseFloat(this.bookingDetails.kgs))
this.$message.error('保存失败,重量不一致')
return false
if (WText) {
WText = `${WText},重量`
} else {
WText = `重量`
}
}
if (parseFloat(cbm) != parseFloat(this.bookingDetails.cbm)) {
console.log(parseFloat(cbm), parseFloat(this.bookingDetails.cbm))
this.$message.error('保存失败,尺码不一致')
return false
if (WText) {
WText = `${WText},尺码`
} else {
WText = `尺码`
}
}
confirm(WText)
// - end
const _data = JSON.parse(JSON.stringify(this.bookingDetails))
delete _data.hbList
BookingOrderAddOrUpdate(_data)
.then(res => {
if (res.success) {
this.$message.success('保存成功')
if (this.isAdd) {
this.isCopy = false
this.isAdd = false
this.$router.replace({
name: 'BookingDetail',
query: {
id: res.data,
type: this.bookingDetails.carrierid,
noOpenTab: true,
mblno: this.bookingDetails.mblno
}
})
} else if (this.$route.query.mblno === this.bookingDetails.mblno) {
this.isCopy = false
this.isAdd = false
console.log('1.1 == 保存成功 - 不切换路由 ==', this.id)
// this.init()
this.checkSaveFun({ type: 'hbList', hasChange: false })
this.checkSaveFun({ type: 'details', hasChange: false })
} else {
this.isCopy = false
this.isAdd = false
// console.log('1.2 == - ==', this.id)
this.$router.replace({
name: 'BookingDetail',
query: {
id: this.id,
type: this.bookingDetails.carrierid,
noOpenTab: true,
mblno: this.bookingDetails.mblno
}
})
}
// this.init()
this.$forceUpdate()
} else {
if (typeof res.message === 'string') {
this.$message.error(res.message)
} else {
this.$message.error('保存失败')
}
}
})
.catch(err => {
console.log(err)
})
},
bookingOrderAdd() {
@ -1214,7 +1236,6 @@ export default {
let kgs = 0
let cbm = 0
this.bookingDetails.ctnInputs.forEach(item => {
console.log(item)
if (parseFloat(item.pkgs)) {
pkgs = pkgs + parseFloat(item.pkgs)
}
@ -1225,52 +1246,96 @@ export default {
cbm = cbm + parseFloat(item.cbm)
}
})
let that = this
let confirm = text => {
this.$confirm({
title: `${text}不一致,是否继续?`,
okText: '是',
okType: 'danger',
cancelText: '否',
onOk() {
const _data = JSON.parse(JSON.stringify(that.bookingDetails))
delete _data.hbList
BookingOrderAddOrUpdate(_data)
.then(res => {
if (res.success) {
that.$message.success('保存成功')
if (that.isAdd) {
that.isCopy = false
that.isAdd = false
that.$router.replace({
name: 'BookingDetail',
query: {
id: res.data,
type: that.bookingDetails.carrierid,
noOpenTab: true,
mblno: that.bookingDetails.mblno
}
})
} else if (that.$route.query.mblno === that.bookingDetails.mblno) {
that.isCopy = false
that.isAdd = false
console.log('1.1 == 保存成功 - 不切换路由 ==', that.id)
// that.init()
that.checkSaveFun({ type: 'hbList', hasChange: false })
that.checkSaveFun({ type: 'details', hasChange: false })
} else {
that.isCopy = false
that.isAdd = false
// console.log('1.2 == - ==', that.id)
that.$router.replace({
name: 'BookingDetail',
query: {
id: that.id,
type: that.bookingDetails.carrierid,
noOpenTab: true,
mblno: that.bookingDetails.mblno
}
})
}
// that.init()
that.$forceUpdate()
} else {
if (typeof res.message === 'string') {
that.$message.error(res.message)
} else {
that.$message.error('保存失败')
}
}
})
.catch(err => {
console.log(err)
})
},
onCancel() {
return false
},
class: 'test'
})
}
let WText = ''
if (parseFloat(pkgs) != parseFloat(this.bookingDetails.pkgs)) {
console.log(parseFloat(pkgs), parseFloat(this.bookingDetails.pkgs))
this.$message.error('保存失败,件数不一致')
return false
if (WText) {
WText = `${WText},件数`
} else {
WText = `件数`
}
}
if (parseFloat(kgs) != parseFloat(this.bookingDetails.kgs)) {
console.log(parseFloat(kgs), parseFloat(this.bookingDetails.kgs))
this.$message.error('保存失败,重量不一致')
return false
if (WText) {
WText = `${WText},重量`
} else {
WText = `重量`
}
}
if (parseFloat(cbm) != parseFloat(this.bookingDetails.cbm)) {
console.log(parseFloat(cbm), parseFloat(this.bookingDetails.cbm))
this.$message.error('保存失败,尺码不一致')
return false
if (WText) {
WText = `${WText},尺码`
} else {
WText = `尺码`
}
}
// - end
const _data = JSON.parse(JSON.stringify(this.bookingDetails))
delete _data.hbList
BookingOrderAddOrUpdate(_data)
.then(res => {
if (res.success) {
this.isAdd = false
this.id = res.data
this.$message.success('保存成功')
// this.bookingDetails = JSON.parse(JSON.stringify(initDetail))
this.$router.replace({
name: 'BookingDetail',
query: {
id: res.data,
type: this.bookingDetails.carrierid,
noOpenTab: true,
mblno: this.bookingDetails.mblno
}
})
this.$forceUpdate()
} else {
if (typeof res.message === 'string') {
this.$message.error(res.message)
} else {
this.$message.error('保存失败')
}
}
})
.catch(err => {
console.log(err)
})
confirm(WText)
},
spliceMorefun(str) {

Loading…
Cancel
Save