#
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 {
@@ -186,6 +188,7 @@
         // 托盘码有误重置
         barcodeFocuss() {
            let that = this;
            this.matFocus = false;
            that.barcodeFocus = false;
            setTimeout(() => {
               that.barcode = '';
@@ -194,7 +197,7 @@
         },
         // 商品光标清空重置
         focuss() {
            this.focus = false;
            this.matFocus = false;
            setTimeout(() => {
               this.matnr = '';
               this.matFocus = true;
@@ -202,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
@@ -379,8 +403,10 @@
         // 确认重置
         resetConfirm() {
            this.dataList = []
            this.barcode = ''
            this.messageText = "重置完成"
            this.messageToggle('success')
            this.barcodeFocuss()
         },
         // 取消重置
         resetClose() {
@@ -427,7 +453,7 @@
   .code-decs {
      width: 20vw;
      font-size: 18px;
      font-size: 14px;
      color: #303133;
   }
@@ -448,4 +474,4 @@
      text-align: center;
      box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
   }
</style>
</style>