#
zjj
2024-10-30 f62410d5ff3124f13612235eea6583088fadffcf
pages/pakin/leftovers.vue
@@ -7,9 +7,10 @@
               @input="barcodeInput()">
         </view>
         <view class="item">
            <view class="code-decs">楼层:</view>
            <uni-combox :candidates="floorList" placeholder="请选择出库站点" v-model="floor"></uni-combox>
         </view>
            <view class="code-decs">拣料箱:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="barcode2" :focus="barcodeFocus2"
               @input="barcodeInput2()">
         </view>
         <!-- <view class="item">
            <view class="code-decs">满托:</view>
            <radio-group @change="isFrozen">
@@ -23,7 +24,7 @@
         </view> -->
      </view>
      
      <!-- <scroll-view>
      <scroll-view>
         <view class="list" v-for="(item,i) in dataList" :key="i">
            <view class="list-left">
               <view class="list-left-item">
@@ -56,7 +57,7 @@
                     <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>
@@ -66,13 +67,13 @@
               <uni-icons type="trash" color="#f58a8a" size="24" @click="remove(item,i,'warn')"></uni-icons>
            </view>
         </view>
      </scroll-view> -->
      </scroll-view>
      <!-- 底部操作按钮 -->
      <view class="buttom">
         <button size="mini" @click="reset('warn')">重置</button>
         <button size="mini" type="primary" @click="combConfirm('warn')">确定</button>
      </view>
      <!-- 弹窗 -->
      <!-- 弹窗
      <!-- 修改数量 -->
      <view>
         <uni-popup ref="revise" type="dialog">
@@ -145,6 +146,7 @@
            baseUrl: '',
            token: '',
            barcode: '',
            barcode2:'',
            dataList: [],
            count: 0,
            rowNum: '',
@@ -157,6 +159,7 @@
            title: '',
            content: '',
            barcodeFocus: true,
            barcodeFocus2: true,
            matFocus: false,
            matData: '',
            removeNum: 0,
@@ -197,8 +200,67 @@
                  this.barcodeFocuss()
                  return;
               }
               this.focuss()
               this.selectPakinDetlList()
               // this.focuss()
            }, 200)
         },
         barcodeInput2() {
            // 不设置定时器 会出现扫入的字符串不全
            setTimeout(() => {
               var len = this.barcode2.length
               if (len != 8) {
                  uni.showToast({
                     title: '托盘码有误请重试',
                     icon: "none",
                     position: 'top'
                  });
                  this.barcodeFocuss()
                  return;
               }
               // this.selectPakinDetlList()
               // this.focuss()
            }, 200)
         },
         selectPakinDetlList(){
            let that = this;
            uni.request({
               url: that.baseUrl + '/mobile/select/workDetl/barcode',
               data: JSON.stringify({
                  barcode: that.barcode
               }),
               method: 'POST',
               header: {
                  'token': uni.getStorageSync('token')
               },
               success(result) {
                  result = result.data
                  if (result.code === 200 && result.data) {
                     for(var i =0;i<result.data.length;i++){
                        console.log(result.data[i])
                        that.dataList.push(result.data[i])
                     }
                  } 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'
                     })
                  }
               }
            });
         },
         // 托盘码有误重置
         barcodeFocuss() {
@@ -207,6 +269,14 @@
            setTimeout(() => {
               that.barcode = '';
               that.barcodeFocus = true;
            }, 100);
         },
         barcodeFocuss2() {
            let that = this;
            that.barcodeFocus2 = false;
            setTimeout(() => {
               that.barcode2 = '';
               that.barcodeFocus2 = true;
            }, 100);
         },
         // 商品光标清空重置
@@ -231,25 +301,10 @@
               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()
                           },
                        },
                     });
                     for(var i =0;i<result.data.length;i++){
                        that.dataList.unshift(result.data[i])
                     }
                  } else if (result.code == 403) {
                     uni.showToast({
                        title: result.msg,
@@ -389,16 +444,21 @@
               this.messageToggle('error')
               return;
            }
            if (that.floor === 0 || that.floor === '') {
               this.messageText = "请选择楼层"
            if (that.barcode2 === '') {
               this.messageText = "请扫描拣料箱条码"
               this.messageToggle('error')
               return;
            }
            }
            if (that.dataList.length === 0) {
               this.messageText = "拣料列表为空"
               this.messageToggle('error')
               return;
            }
            uni.request({
               url: that.baseUrl + '/mobile/leftovers/out',
               data: JSON.stringify({
                  barcode: that.barcode,                  
                  floor: that.floor
                  barcode2: that.barcode2
               }),
               method: 'POST',
               header: {