#
whycq
2024-03-13 a5c4bc3c248380d4c4a1f9edaff314f365acfaf5
pages/pakin/pakin.vue
@@ -2,18 +2,13 @@
   <view>
      <view class="code">
         <view class="item">
            <view class="code-decs">托盘码:</view>
            <view class="code-decs">箱码:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="barcode" :focus="barcodeFocus"
               @input="barcodeInput()">
         </view>
         <view class="item">
            <view class="code-decs">物料码:</view>
            <view class="code-decs">品番二维码:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="matnr" :focus="matFocus" @input="findMat()">
            <view class="item-right">
               <button></button>
               <text style="text-align: right;color: #409EFF;" @click="selectMat()">提取+</text>
               <uni-icons type="right" color="#c1c1c1"></uni-icons>
            </view>
         </view>
      </view>
      <view class="mat-list-title">
@@ -29,10 +24,10 @@
               <view class="list-left-item">
                  <view class="desc">编码:</view>
                  <view class="left-item">
                     <uni-tag :text="item.matnr" type="primary"></uni-tag>
                     <uni-tag :text="item.threeCode" type="primary"></uni-tag>
                  </view>
               </view>
               <view class="list-left-item">
               <!-- <view class="list-left-item">
                  <view class="desc">品名:</view>
                  <view class="left-item">{{item.maktx}}</view>
               </view>
@@ -45,17 +40,17 @@
                  <view class="left-item">
                     <uni-tag :text="item.batch" type="warning"></uni-tag>
                  </view>
               </view>
               </view> -->
               <!-- <view class="list-left-item">
                  <view class="desc">重量:</view>
                  <view class="left-item">
                     <uni-tag :text="item.weight" type="warning"></uni-tag>
                  </view>
               </view> -->
               <view class="list-left-item">
               <!-- <view class="list-left-item">
                  <view class="desc">数量:</view>
                  <view class="left-item">{{item.anfme}}</view>
               </view>
               </view> -->
            </view>
            <view class="list-right">
               <uni-icons type="compose" color="#9add8b" size="24" @click="revise(item,i)"></uni-icons>
@@ -173,19 +168,20 @@
         // barcode input 事件
         barcodeInput() {
            // 不设置定时器 会出现扫入的字符串不全
            setTimeout(() => {
               var len = this.barcode.length
               if (len != 8) {
                  uni.showToast({
                     title: '托盘码有误请重试',
                     icon: "none",
                     position: 'top'
                  });
                  this.barcodeFocuss()
                  return;
               }
               this.focuss()
            }, 200)
            // setTimeout(() => {
            //    var len = this.barcode.length
            //    if (len != 8) {
            //       uni.showToast({
            //          title: '托盘码有误请重试',
            //          icon: "none",
            //          position: 'top'
            //       });
            //       this.barcodeFocuss()
            //       return;
            //    }
            //    this.focuss()
            // }, 200)
            this.focuss()
         },
         // 托盘码有误重置
         barcodeFocuss() {
@@ -207,58 +203,10 @@
         // 搜索物料
         findMat() {
            let that = this
            uni.request({
               url: that.baseUrl + '/mat/auth',
               data: {
                  matnr: that.matnr
               },
               header: {
                  'token': uni.getStorageSync('token')
               },
               success(result) {
                  result = result.data
                  if (result.code === 200 && result.data) {
                     that.matData = result.data
                     that.matnr = ''
                     that.matData['batch'] = ''
                     uni.navigateTo({
                        url: "../mat/matSelected",
                        // 通过eventChannel向被打开页面传送数据
                        success: function(res) {
                           res.eventChannel.emit('mat', {
                              data: result.data
                           })
                        },
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                        events: {
                           matList: function(data) {
                              that.checkMat(data.data)
                              that.focuss()
                           },
                        },
                     });
                  } else if (result.code == 403) {
                     uni.showToast({
                        title: result.msg,
                        icon: "none",
                        position: 'top'
                     })
                     setTimeout(() => {
                        uni.reLaunch({
                           url: '../login/login'
                        });
                     }, 1000);
                  } else {
                     uni.showToast({
                        title: result.msg,
                        icon: "none",
                        position: 'top'
                     })
                  }
               }
            });
            let item = {}
            item['threeCode'] = that.matnr
            this.dataList.unshift(item)
            this.focuss()
         },
         selectMat() {
            let that = this