Commit d0120cd2 by 李伟康

commit 增加节流

1 parent 94027e79
...@@ -239,7 +239,8 @@ export default { ...@@ -239,7 +239,8 @@ export default {
startDate: '', startDate: '',
endDate: '', endDate: '',
customerTag: '', customerTag: '',
backClass: '' backClass: '',
clickFlag: false
} }
}, },
mounted () { mounted () {
...@@ -291,7 +292,7 @@ export default { ...@@ -291,7 +292,7 @@ export default {
this.customerInfo.arrivalDate = e.detail.value this.customerInfo.arrivalDate = e.detail.value
}, },
async submit () { async submit () {
if (this.check) return if (this.check || this.clickFlag) return
try { try {
this.customerForm.map(e => { this.customerForm.map(e => {
e.error = false e.error = false
...@@ -310,6 +311,10 @@ export default { ...@@ -310,6 +311,10 @@ export default {
}) })
if (customerInfo.id) params.id = customerInfo.id if (customerInfo.id) params.id = customerInfo.id
params.customerTagName = params.customerTagName.replace(/|/g, ',') params.customerTagName = params.customerTagName.replace(/|/g, ',')
this.clickFlag = true
uni.showLoading({
mask: true
})
const res = await uni.$api.customerApi[targetApi](params), const res = await uni.$api.customerApi[targetApi](params),
_this = this _this = this
if (res) { if (res) {
...@@ -317,10 +322,13 @@ export default { ...@@ -317,10 +322,13 @@ export default {
if (res == '1') { if (res == '1') {
this.$refs.successRef.open() this.$refs.successRef.open()
setTimeout(() => { setTimeout(() => {
this.clickFlag = false
uni.hideLoading()
this.back() this.back()
this.$emit('refresh') this.$emit('refresh')
}, 1e3) }, 1e3)
} else uni.showModal({ } else {
uni.showModal({
content: '存在与该手机号相同的接待记录,系统将自动归类到已接待', content: '存在与该手机号相同的接待记录,系统将自动归类到已接待',
showCancel: false, showCancel: false,
confirmText: '确认', confirmText: '确认',
...@@ -332,11 +340,19 @@ export default { ...@@ -332,11 +340,19 @@ export default {
} }
} }
}) })
this.clickFlag = false
uni.hideLoading()
}
} else {
this.clickFlag = false
uni.hideLoading()
} }
} catch (error) { } catch (error) {
let index = this.customerForm.findIndex(e => e.key == error) let index = this.customerForm.findIndex(e => e.key == error)
this.customerForm[index].error = true 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!