Parcourir la source

增加检索条码

zhaohuanhuan il y a 1 an
Parent
commit
75d8c96cc1
1 fichiers modifiés avec 96 ajouts et 0 suppressions
  1. 96 0
      src/views/outbound/components/InputBarcode.vue

+ 96 - 0
src/views/outbound/components/InputBarcode.vue

@@ -0,0 +1,96 @@
+<template>
+  <div class="container-no-container">
+    <van-dialog v-model:show="barcodeTrueFalseBy"
+                :beforeClose="beforeClose"
+                title="检索条码"
+                show-cancel-button>
+      <van-field class="code-input"
+                 v-model="barcode"
+                 ref="barcodeRef"
+                 @keydown.enter="onKeydown"
+                 clearable
+                 placeholder="请扫描条码" />
+    </van-dialog>
+  </div>
+</template>
+<script setup lang="ts">
+import { computed, ref } from 'vue'
+import { showToast } from 'vant'
+  const store = useStore()
+  const warehouse = store.warehouse
+  import { useStore } from '@/store/modules/user'
+  const barcodeTrueFalseBy=ref(false)
+  const barcodeRef=ref(null)
+  const barcode=ref('');
+
+const show = async (code,type) => {
+    barcodeTrueFalseBy.value = true
+    barcode.value=code
+    setTimeout(()=>{
+      barcodeRef.value?.focus()
+    },200)
+  }
+  //输入拣货容器号
+  const emit = defineEmits()
+  const  beforeClose=  (action) =>
+    new Promise(async (resolve) => {
+      if (action === 'confirm') {
+        if (barcode.value == '') {
+          showToast('请扫描条码')
+          return resolve(false)
+        }
+        emit('setBarcode', barcode.value)
+      }
+      resolve(true)
+    });
+    const onKeydown=()=>{
+      setTimeout(()=>{
+        barcodeRef.value.blur()
+      },300)
+    }
+    defineExpose({show})
+</script>
+<style scoped lang="sass">
+   .container-no-container
+     .code-input
+       font-size: 22px
+       font-weight: bold
+       border-bottom: 2px solid #0077ff
+     .completion
+       text-align: right
+       font-size: 12px
+       padding: 5px 20px
+       cursor: pointer
+       text-decoration: underline
+     .container-list
+       max-height: 100px
+       font-size: 13px
+       font-weight: bold
+       display: flex
+       padding: 5px 20px
+       justify-content: space-between
+       flex-wrap: wrap
+       overflow: auto
+       .container-item
+         width: 50%
+         display: flex
+         justify-items: center
+         align-items: center
+         padding: 2px 0
+         cursor: pointer
+         text-decoration: underline
+         .container-item-line
+           width: 5px
+           height: 5px
+           background: #0077ff
+           border-radius: 50%
+           margin-right: 5px
+         .container-item-no
+           flex: 1
+           text-align: left
+
+
+
+
+
+</style>