diff --git a/src/pages/back/backCodeAdd.vue b/src/pages/back/backCodeAdd.vue index 3fe9a6a..5ef9acc 100644 --- a/src/pages/back/backCodeAdd.vue +++ b/src/pages/back/backCodeAdd.vue @@ -127,6 +127,7 @@ const qrCode = ref('') //二维码 const maInfo = ref({}) //二维码 const scanQrCodeRef = ref(null) const remark = ref('') +const isSubmit = ref(false) // 二维码扫码 @@ -249,26 +250,36 @@ const submitCode = () => { remark: remark.value, }, ] - let param = { - backApplyInfo: info, - backApplyDetailsList: detail, + try { + if (isSubmit.value) return + isSubmit.value = true + uni.showLoading({ title: '提交中...', mask: true }) + let param = { + backApplyInfo: info, + backApplyDetailsList: detail, + } + insertBack(param) + .then((res) => { + console.log(res) + if (res.code == 200) { + uni.showToast({ title: '新增成功', icon: 'none' }) + uni.navigateTo({ url: `/pages/back/index` }) + // uni.navigateBack({ + // delta: 1, // 返回到已存在的页面 + // }) + } else { + uni.showToast({ title: res.msg, icon: 'none' }) + } + }) + .catch((error) => { + console.log(error) + }) + } catch (error) { + console.log('🚀 ~ submitCode ~ error:', error) + } finally { + isSubmit.value = false + uni.hideLoading() } - insertBack(param) - .then((res) => { - console.log(res) - if (res.code == 200) { - uni.showToast({ title: '新增成功', icon: 'none' }) - uni.navigateTo({ url: `/pages/back/index` }) - // uni.navigateBack({ - // delta: 1, // 返回到已存在的页面 - // }) - } else { - uni.showToast({ title: res.msg, icon: 'none' }) - } - }) - .catch((error) => { - console.log(error) - }) } }