2 コミット 65a0eac5f0 ... 69df75a0a2

作者 SHA1 メッセージ 日付
  zhaohuanhuan 69df75a0a2 Merge branch 'refs/heads/zhaohuanhuan_组合商品唯一码' into testing 6 日 前
  zhaohuanhuan 6a942e24c2 宝时丰收-唯一码扫描组合商品处理 6 日 前

+ 18 - 7
src/views/inbound/takeDelivery/components/UniqueCodeInput.vue

@@ -9,7 +9,7 @@
       <div>
         <div class="unique-code-type">
           <div class="tips">{{ tag }}</div>
-          <div>
+          <div v-if="!isCombineMode">
             <div :class="newCheckAllType?'unique-v-active':'unique-v-no-active'"  @click="onCheckAllType"> <van-icon name="exchange" /> 条码校验</div>
 <!--            <van-button type="primary" size="mini" :plain="!newCheckAllType" @click="onCheckAllType" icon="exchange"  >条码校验</van-button>-->
           </div>
@@ -17,7 +17,7 @@
         <div v-if="combineSetCount > 0" class="combine-set-info">
           组合{{ combineSetCount }}套 | 唯一码{{ containerList.length }}/{{ searchCount }}
         </div>
-        <div class="unique-input-list" v-if="newCheckAllType">
+        <div class="unique-input-list" v-if="newCheckAllType && !isCombineMode">
           <div class="unique-input-list-left">商品条码:</div>
           <div class="unique-input-list-right">
             <van-field class="code-input"
@@ -69,7 +69,7 @@
   </div>
 </template>
 <script setup>
-import { computed, ref } from 'vue'
+import { computed, nextTick, ref } from 'vue'
 import { showNotify } from 'vant'
 import { scanError, scanSuccess } from '@/utils/android'
 import { barcodeToUpperCase } from '@/utils/dataType.js'
@@ -90,12 +90,14 @@ const props = defineProps({
   searchCount: [String, Number],
   asnInfo:Object,
   checkAllType:Boolean,
-  /** 组合商品收货套数,大于 0 时在弹窗内展示 */
+  /** 组合商品收货套数 */
   combineSetCount: { type: Number, default: 0 },
   /** 组合外箱码获取内件码 */
   resolvePanpassCodes: { type: Function, default: undefined },
 })
-const scanInputType=props.checkAllType?'barcode':'unique'
+const isCombineMode = computed(() => Number(props.combineSetCount) > 0)
+const getDefaultCheckAllType = () => !isCombineMode.value && !!props.checkAllType
+const scanInputType = getDefaultCheckAllType() ? 'barcode' : 'unique'
 const uniqueCodeScanType=ref(scanInputType)
 // 定义自定义的 emit
 const emit = defineEmits(['update:scanType', 'update:uniqueCodeList', 'setUniqueCode','update:checkAllType'])
@@ -108,11 +110,19 @@ const show = async (code, desc, tips, uniqueRule) => {
     tag.value = tips
   }
   uniqueRuleMap.value = uniqueRule
+  newCheckAllType.value = getDefaultCheckAllType()
+  uniqueCodeScanType.value = newCheckAllType.value ? 'barcode' : 'unique'
+  uniqueBarcode.value = ''
+  uniqueCode.value = ''
   uniqueCodeTrueFalseBy.value = true
+  await nextTick()
+  if (newCheckAllType.value) uniqueBarcodeRef.value?.focus()
+  else uniqueCodeRef.value?.focus()
 }
-const newCheckAllType=ref(props.checkAllType)
+const newCheckAllType = ref(getDefaultCheckAllType())
 // 切换校验类型
 const onCheckAllType=()=>{
+  if (isCombineMode.value) return
   newCheckAllType.value = !newCheckAllType.value
   uniqueCodeScanType.value = newCheckAllType.value ? 'barcode' : 'unique';
   localStorage.setItem('checkAllType',newCheckAllType.value)
@@ -121,12 +131,13 @@ const onCheckAllType=()=>{
 const refocusAfterUniqueInput = () => {
   uniqueBarcode.value = ''
   uniqueCode.value = ''
-  if (newCheckAllType.value) uniqueBarcodeRef.value?.focus()
+  if (newCheckAllType.value && !isCombineMode.value) uniqueBarcodeRef.value?.focus()
   else uniqueCodeRef.value?.focus()
 }
 
 //商品条码验证
 const uniqueBarcodeChange=()=>{
+  if (isCombineMode.value) return true
   if(newCheckAllType.value){
     if (props.resolvePanpassCodes) return true
     if(!uniqueBarcode.value){