diff --git a/src/pages/picking/outbound/code-outbound.vue b/src/pages/picking/outbound/code-outbound.vue index 44ddb91..6765edc 100644 --- a/src/pages/picking/outbound/code-outbound.vue +++ b/src/pages/picking/outbound/code-outbound.vue @@ -147,6 +147,7 @@ import ScanQrCode from '@/pages/devicesSearch/ScanQrCode.vue' import ScanQrCodeBox from '@/pages/devicesSearch/ScanQrCodeBox.vue' // const query = defineProps() // 获取上级页面传递的路由参数 // const queryParams = JSON.parse(query.queryParams) +const loading = ref(false) const scanQrCodeRef = ref(null) const scanQrCodeRefBox = ref(null) const queryParams = ref({}) @@ -262,6 +263,15 @@ const onHandleOutbound = async () => { }) return } + if (loading.value) { + uni.showToast({ + title: '请勿重复提交!', + icon: 'none', + }) + return + } + uni.showLoading() + loading.value = true // 解构所需要的数据 const { typeId, parentId, publishTask } = queryParams.value // 组装出库参数 @@ -281,17 +291,24 @@ const onHandleOutbound = async () => { } }) console.log('mmmmmmmmmmmmmmmm', paramsList) - const res = await setOutboundNumAPI({ leaseOutDetailsList: paramsList }) - if (res.code === 200) { - uni.showToast({ - title: '出库成功!', - icon: 'none', - }) - getCodeDetailData( - queryParams.value.id, - queryParams.value.publishTask, - queryParams.value.typeId, - ) //获取详情 + try { + const res = await setOutboundNumAPI({ leaseOutDetailsList: paramsList }) + loading.value = false + uni.hideLoading() + if (res.code === 200) { + uni.showToast({ + title: '出库成功!', + icon: 'none', + }) + getCodeDetailData( + queryParams.value.id, + queryParams.value.publishTask, + queryParams.value.typeId, + ) //获取详情 + } + } catch (error) { + console.log('🚀 ~ onHandleOutbound ~ error:', error) + loading.value = false } } diff --git a/src/pages/picking/outbound/details.vue b/src/pages/picking/outbound/details.vue index 5d0386f..a0792e7 100644 --- a/src/pages/picking/outbound/details.vue +++ b/src/pages/picking/outbound/details.vue @@ -132,7 +132,7 @@ onLoad((options) => { } // leaseApplyInfo.value.publishTask = options.publishTask console.log('🚀 ~ onLoad ~ options:', options) - getOutboundDetailsData() + // getOutboundDetailsData() }) onShow(() => { getOutboundDetailsData() diff --git a/src/pages/picking/outbound/num-outbound.vue b/src/pages/picking/outbound/num-outbound.vue index debcbce..b207b4d 100644 --- a/src/pages/picking/outbound/num-outbound.vue +++ b/src/pages/picking/outbound/num-outbound.vue @@ -48,6 +48,7 @@ import { computed, ref } from 'vue' import { setOutboundNumAPI } from '@/services/picking/outbound.js' import { onLoad } from '@dcloudio/uni-app' +const loading = ref(false) const formData = ref({}) const outboundNum = ref(0) // const query = defineProps() // 获取上级页面传递的路由参数 @@ -108,6 +109,16 @@ const onHandleOutbound = async () => { return } + if (loading.value) { + uni.showToast({ + title: '请勿重复提交!', + icon: 'none', + }) + return + } + uni.showLoading() + loading.value = true + // 解构所需要的数据 const { maTypeName, typeName, preNum, alNum, id, typeId, parentId, manageType } = queryParams.value @@ -126,21 +137,28 @@ const onHandleOutbound = async () => { publishTask:queryParams.value.publishTask, } console.log('出库参数', params) - const res = await setOutboundNumAPI({ leaseOutDetailsList: [params] }) - console.log('出库结果', res) + try { + const res = await setOutboundNumAPI({ leaseOutDetailsList: [params] }) + console.log('出库结果', res) + loading.value = false + uni.hideLoading() - if (res.code === 200) { - uni.showToast({ - title: '出库成功!', - icon: 'none', - }) - setTimeout(() => { - // 返回上一个页面 - uni.navigateBack({ - delta: 1, - success() {}, + if (res.code === 200) { + uni.showToast({ + title: '出库成功!', + icon: 'none', }) - }, 500) + setTimeout(() => { + // 返回上一个页面 + uni.navigateBack({ + delta: 1, + success() {}, + }) + }, 500) + } + } catch (error) { + console.log('🚀 ~ onHandleOutbound ~ error:', error) + loading.value = false } }