Commit d0120cd2 by 李伟康

commit 增加节流

1 parent 94027e79
......@@ -239,7 +239,8 @@ export default {
startDate: '',
endDate: '',
customerTag: '',
backClass: ''
backClass: '',
clickFlag: false
}
},
mounted () {
......@@ -291,7 +292,7 @@ export default {
this.customerInfo.arrivalDate = e.detail.value
},
async submit () {
if (this.check) return
if (this.check || this.clickFlag) return
try {
this.customerForm.map(e => {
e.error = false
......@@ -310,6 +311,10 @@ export default {
})
if (customerInfo.id) params.id = customerInfo.id
params.customerTagName = params.customerTagName.replace(/|/g, ',')
this.clickFlag = true
uni.showLoading({
mask: true
})
const res = await uni.$api.customerApi[targetApi](params),
_this = this
if (res) {
......@@ -317,26 +322,37 @@ export default {
if (res == '1') {
this.$refs.successRef.open()
setTimeout(() => {
this.clickFlag = false
uni.hideLoading()
this.back()
this.$emit('refresh')
}, 1e3)
} else uni.showModal({
content: '存在与该手机号相同的接待记录,系统将自动归类到已接待',
showCancel: false,
confirmText: '确认',
confirmColor: '#347BFF',
success (res) {
if (res.confirm) {
_this.back()
_this.$emit('refresh')
} else {
uni.showModal({
content: '存在与该手机号相同的接待记录,系统将自动归类到已接待',
showCancel: false,
confirmText: '确认',
confirmColor: '#347BFF',
success (res) {
if (res.confirm) {
_this.back()
_this.$emit('refresh')
}
}
}
})
})
this.clickFlag = false
uni.hideLoading()
}
} else {
this.clickFlag = false
uni.hideLoading()
}
} catch (error) {
let index = this.customerForm.findIndex(e => e.key == error)
this.customerForm[index].error = true
this.clickFlag = false
uni.hideLoading()
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!