#
whycq
2022-06-21 16945499e9e1c870e21fc0bd05b2daae56bc3a29
pages/basics/pakin.vue
@@ -8,8 +8,8 @@
            </view>
            <view class="square-content">
               <view class="content-input">
                  <input v-model="barcode" type="text" placeholder="扫码 / 输入" maxlength="8"
                  :focus="barcodeFocus" @focus="nextInput">
                  <input v-model="barcode" type="text" placeholder="扫码 / 输入" maxlength="10"
                  :focus="barcodeFocus" @input="barcodeInput">
                  <uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons>
               </view>
            </view>
@@ -116,13 +116,12 @@
            rowNum:'',
         }
      },
      // onLoad() {
      //    // #ifdef APP
      //    setInterval(()=>{
      //       uni.hideKeyboard()
      //    },20)
      //    // #endif
      // },
      onShow() {
         setTimeout(()=>{
            this.focuss()
         }, 100);
      },
      mounted(){
         const UIP = uni.getStorageSync('UIP');
         this.baseIP = UIP;
@@ -130,17 +129,36 @@
         this.basePORT = UPORT
      },
      methods: {
         nextInput() {
            if (this.barcode.length == 8) {
         // barcode input 事件
         barcodeInput() {
            var len = this.barcode.length
            if (len != 8) {
               uni.showToast({title: '托盘码有误请重试', icon: "none", position: 'top'});
               this.barcodeFocuss()
               return;
            }
            if (len == 8) {
               this.focuss()
            }
         },
         // 托盘码有误重置
         barcodeFocuss() {
            // #ifdef APP
            let that = this;
            that.barcodeFocus = false;
            setTimeout(()=>{
               that.barcode = '';
               that.barcodeFocus = true;
            }, 100);
            // #endif
         },
         // 商品光标清空重置
         focuss() {
            // #ifdef APP
            let that = this;
            that.focus = false;
            setTimeout(()=>{
               that.matnrId = '';
               that.matnr = '';
               that.focus = true;
            }, 100);
            // #endif
@@ -148,7 +166,7 @@
         resst() {
            this.matList = []
            this.barcode = ''
            this.matnr = ''
            this.focuss()
            uni.vibrateShort();
         },
         removeBarcode() {
@@ -227,11 +245,12 @@
                     that.matnr = data.data
                     that.findMat(that.matnr)
                   },
                 },
                 success: function(res) {
               },
               success: function(res) {
                   // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的
                   res.eventChannel.emit('acceptDataFromOpenerPage', {baseIP:that.baseIP, basePORT:that.basePORT })
                 }
               },
            });
            that.matnr = ''
         },
@@ -250,24 +269,26 @@
                  let res = result.data
                  if (res.code === 200 && res.data) {
                     that.matData = res.data
                     that.matnr = ''
                     uni.navigateTo({
                        url: "matQuery",
                        events: {
                            // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                            matList: function(data) {
                              that.matList.push(data.data)
                              console.log(that.matList)
                            },
                          },
                          success: function(res) {
                            // 通过eventChannel向被打开页面传送数据
                            res.eventChannel.emit('matData', { data: that.matData })
                          }
                           },
                        },
                        success: function(res) {
                           // 通过eventChannel向被打开页面传送数据
                           res.eventChannel.emit('matData', { data: that.matData })
                        },
                     });
                  }
                  
               }
            });
         },
      
         change(e) {