#
Your Name
2022-08-16 0cdc24ed926ec628d932027fd4aa7af8d0e5ae86
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="10"
                  :focus="barcodeFocus" @input="barcodeInput">
                  <input v-model="barcode" type="text" placeholder="扫码 / 输入"
                  :focus="barcodeFocus" @input="barcodeInput()" placeholder-style="line-height:  85rpx;">
                  <uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons>
               </view>
            </view>
@@ -24,7 +24,7 @@
            <view class="square-content">
               <view class="content-input-btn">
                  <input v-model="matnr" type="text" placeholder="扫码 / 输入" @input="findMat()"
                  :focus="focus">
                  :focus="focus" placeholder-style="line-height:  85rpx;">
                  <uni-icons type="closeempty" size="20" color="#dadada" @click="removeMatnr()"></uni-icons>
               </view>
               <view class="content-btn">
@@ -116,6 +116,7 @@
   export default {
      data() {
         return {
            commonUrl:null,
            barcode: '',
            barcodeFocus:true,
            focus:false,
@@ -146,30 +147,39 @@
         this.baseIP = UIP;
         const UPORT = uni.getStorageSync('UPORT');
         this.basePORT = UPORT
         const PROJ = uni.getStorageSync('UPROJ');
         this.baseUrl = PROJ
         this.getUrl()
      },
      methods: {
         // 获取url
         getUrl() {
            this.commonUrl = this.baseHttp + this.baseIP + ':' +this.basePORT + "/" +this.baseUrl
         },
         // 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()
            }
            console.log(1)
            // 不设置定时器 会出现扫入的字符串不全
            setTimeout(()=>{
               var len = this.barcode.length
               if (len != 8) {
                  uni.showToast({title: '托盘码有误请重试', icon: "none", position: 'top'});
                  this.barcodeFocuss()
                  return;
               }
               if (len == 8) {
                  this.focuss()
               }
            },100)
         },
         // 托盘码有误重置
         barcodeFocuss() {
            // #ifdef APP
            let that = this;
            that.barcodeFocus = false;
            setTimeout(()=>{
               that.barcode = '';
               that.barcodeFocus = true;
            }, 100);
            // #endif
         },
         // 商品光标清空重置
         focuss() {
@@ -227,7 +237,7 @@
            }
            uni.showLoading();
            uni.request({
                url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/comb/auth',
                url: that.commonUrl + '/mobile/comb/auth',
                data: JSON.stringify({
                  barcode: that.barcode,
                  combMats: that.matList
@@ -273,7 +283,7 @@
               },
               success: function(res) {
                   // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的
                   res.eventChannel.emit('acceptDataFromOpenerPage', {baseIP:that.baseIP, basePORT:that.basePORT })
                   res.eventChannel.emit('acceptDataFromOpenerPage', {commonUrl:that.commonUrl })
               },
               
            });
@@ -282,7 +292,7 @@
         findMat() {
            let that = this
            uni.request({
                url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/auth',
                url: that.commonUrl + '/mat/auth',
                data: {
                  matnr:that.matnr
                },
@@ -301,7 +311,6 @@
                            // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                            matList: function(data) {
                              that.matList.push(data.data)
                              console.log(that.matList)
                           },
                        },
                        success: function(res) {