Browse Source

面单扫码修复

GGDemo 1 month ago
parent
commit
5e9d0e039a
2 changed files with 17 additions and 7 deletions
  1. 13 6
      src/pages/warehouseScan/warehouseScan.vue
  2. 4 1
      src/pages/weigh/weigh.vue

+ 13 - 6
src/pages/warehouseScan/warehouseScan.vue

@@ -1,7 +1,7 @@
 <template>
   <view class="container">
     <uni-forms
-      ref="valiForm"
+      ref="valiFormRef"
       label-align="right"
       :label-width="80"
       :rules="rules"
@@ -71,6 +71,7 @@ import {
 import { checkPermission } from '@/utils'
 import { warehouseScan } from '@/services/warehouseScan'
 
+const valiFormRef = ref()
 const loading = ref(false)
 const hidePage = ref(false)
 const focusType = ref(true)
@@ -128,15 +129,23 @@ const setfocus = () => {
 
 const onsubmit = async () => {
   st && clearTimeout(st)
+
+  const valiRes: any = await valiFormRef.value.validate()
+  if (!valiRes) {
+    return
+  }
+
   loading.value = true
 
   const res = await warehouseScan({
     order_code: valiFormData.value.order_code,
   })
+  console.log('res---', res)
+
   loading.value = false
-  if (res.data.code == 1) {
+  if (res.code == 1) {
     messageType.value = 'success'
-    messageText.value = res.data.msg
+    messageText.value = res.msg
     messageRef.value.open()
 
     // const historyItem = {
@@ -150,7 +159,7 @@ const onsubmit = async () => {
     // getHistory()
   } else {
     messageType.value = 'error'
-    messageText.value = res.data.msg
+    messageText.value = res.msg
     messageRef.value.open()
     // const historyItem = {
     //   order_code: valiFormData.value.order_code,
@@ -172,7 +181,6 @@ const onsubmit = async () => {
 //   warehouseLogHistory.value = uni.getStorageSync('warehouseLogHistory') || []
 // }
 const keypress = (e: any) => {
-  console.log(e, '按键码')
   // 102  左侧    103  右侧   104  中间按键
   if (e.keyCode === 102 || e.keyCode === 103 || e.keyCode === 104) {
     //这里按键成功
@@ -255,7 +263,6 @@ onNavigationBarButtonTap((event) => {
     height: 35px;
     width: 50%;
     margin-left: 10px;
-    font-size: 16rpx;
   }
 
   .uni-icons {

+ 4 - 1
src/pages/weigh/weigh.vue

@@ -508,7 +508,6 @@ const _checkWaybillGoods = async () => {
   loading.value = true
   const res = await checkWaybillGoods(valiFormData.orderNum)
   console.log('res---', res)
-  loading.value = false
   if (res.code === 1) {
     if (res.data.is_goods_empty) {
       alertDialog.value.open()
@@ -519,6 +518,7 @@ const _checkWaybillGoods = async () => {
     messageType.value = 'error'
     messageText.value = res.msg
     message.value.open()
+    loading.value = false
   }
 }
 
@@ -615,10 +615,12 @@ const scanOutstock = async () => {
       // console.log('有打印面单')
       selectPrinter.value = sendToPeinter.value.length > 0 ? printers.value[0].value : 0
       printerDialog.value.open()
+      loading.value = false
     } else {
       st = setTimeout(() => {
         reset()
         st && clearTimeout(st)
+        loading.value = false
       }, 700)
     }
   } else {
@@ -640,6 +642,7 @@ const scanOutstock = async () => {
     st = setTimeout(() => {
       reset()
       st && clearTimeout(st)
+      loading.value = false
     }, 700)
   }
 }