#
whycq
2024-09-13 f9e93380e5192b35943769950c698c50b86febb6
pages/pakin/pakin.vue
@@ -8,7 +8,7 @@
         </view>
         <view class="item">
            <view class="code-decs">品番二维码:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="matnr" :focus="matFocus" @input="findMat()">
            <input type="text" placeholder=" 扫码 / 输入" v-model="matnr" :focus="matFocus" @input="findMat()" maxlength="600">
         </view>
      </view>
      <view class="mat-list-title">
@@ -61,7 +61,7 @@
      <!-- 底部操作按钮 -->
      <view class="buttom">
         <button size="mini" @click="reset('warn')">重置</button>
         <button size="mini" type="primary" @click="combConfirm('warn')">组托</button>
         <button size="mini" type="primary" @click="comb()">组托</button>
      </view>
      <!-- 弹窗 -->
      <!-- 修改数量 -->
@@ -130,6 +130,8 @@
</template>
<script>
   import {setCurrentDeviceAction} from '../../static/js/PresetsPda.js'
   import {initScan,startScan,stopScan} from '../../static/js/scanModule.js'
   export default {
      data() {
         return {
@@ -203,11 +205,32 @@
         },
         // 搜索物料
         findMat() {
            let that = this
            let _this = this
            initScan();
            startScan();
            let item = {}
            item['threeCode'] = that.matnr
            this.dataList.unshift(item)
            this.focuss()
            uni.$on("SCAN_CODE", ({code}) => {
               console.log(code);
               item['threeCode'] = code
               if (_this.dataList.length > 0) {
                  let add = false
                  for   (let k of _this.dataList) {
                     if (code == k.threeCode) {
                        add = false
                     } else {
                        add = true
                     }
                  }
                  if (add) {
                     _this.dataList.unshift(item)
                  }
               } else {
                  _this.dataList.unshift(item)
               }
               _this.focuss()
               // code就是扫码的结果 接下来写业务需求
            });
         },
         selectMat() {
            let that = this
@@ -451,4 +474,4 @@
      text-align: center;
      box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
   }
</style>
</style>