#
whycq
2022-05-11 99c8fdd5bae73e35eb9e8e5814013aa31c60dd95
pages/basics/outPakin.vue
@@ -37,10 +37,10 @@
         <view class="square-none"  v-show="matList.length === 0">
            <view class="v-show">暂无更多数据...</view>
         </view>
         <checkbox-group @change="checkbox">
         <checkbox-group >
            <view v-for="(item,index) in matList" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" >
               <view class="data-list-left">
                  <text>No:{{listLen-index}}</text>
                  <view class="matnr">No:{{listLen-index}}</view>
                  <view class="matnr">{{item.matnr}}-{{item.batch}}</view>
               </view>
               <view class="data-list-right">
@@ -57,6 +57,12 @@
            <button class="cu-btn lg pakin-btn bg-blue" @click="comb()">组托</button>
         </view>
      </view>
      <view>
         <!-- 提示信息弹窗 -->
         <uni-popup ref="message" type="message">
            <uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
         </uni-popup>
      </view>
   </view>
</template>
@@ -72,9 +78,11 @@
            searchBox: 'hide',
            pick:'hide',
            matnr:'',
            matList:[],
            matList:[{matnr:'1101842-10000',batch:'22047515999'}],
            result: '',
            listLen:0
            listLen:0,
            msgType: 'success',
            messageText: '这是一条成功提示',
         }
      },
      mounted(){
@@ -84,11 +92,16 @@
         this.basePORT = UPORT
      },
      methods: {
         getListLength() {
            this.listLen = this.matList.length
         messageToggle(type) {
            this.msgType = type
            this.messageText = `这是一条${type}消息提示`
            this.$refs.message.open()
         },
         focuss() {
            uni.hideKeyboard()
            // setInterval(function(){
            //    uni.hideKeyboard()
            // },20)
            // uni.hideKeyboard()
         },
         resst() {
            this.matList = []
@@ -105,16 +118,19 @@
            });
         },
         removeMatnr() {
            this.matnr = ''
            uni.vibrateShort();
            this.focus = false;
            this.$nextTick(function() {
               this.focus = true;
            });
            this.matnr = ''
            uni.vibrateShort();
         },
         remove(item,index) {
            this.matList.splice(index,1)
            this.listLen = this.matList.length
            this.messageToggle('success')
            this.messageText = '删除成功'
            uni.vibrateShort();
         },
         comb() {
@@ -148,6 +164,9 @@
                        position: 'bottom',
                        duration: 1000
                     });
                     that.barcode = '';
                     that.matList = '';
                     that.matList = [];
                  } else if (res.code == 403) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
                     setTimeout(() => {
@@ -161,30 +180,12 @@
               }
            });
         },
         selectMat() {
            let that = this
            uni.vibrateShort();
            uni.showLoading();
            uni.navigateTo({
               url: "matSelect",
               events: {
                   // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                   acceptDataFromOpenedPage: function(data) {
                     that.matnr = data.data
                     that.findMat(that.matnr)
                   },
                 },
                 success: function(res) {
                   // 通过eventChannel向被打开页面传送数据
                   res.eventChannel.emit('acceptDataFromOpenerPage', {baseIP:that.baseIP, basePORT:that.basePORT })
                 }
            });
            that.matnr = ''
         },
         findMat() {
            let that = this
            let str = that.matnr.split('-')
            that.matnr = str[0]+'-'+str[1]
            uni.showLoading();
            uni.request({
                url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/auth',
                data: {
@@ -197,7 +198,6 @@
                  uni.vibrateShort();
                  let res = result.data
                  if (res.code === 200 && res.data) {
                     that.matnr = ''
                     let add = true;
                     if(res.data) {
                        let mat = res.data;
@@ -205,22 +205,32 @@
                        mat['anfme'] = 1
                        for(let i = 0;i < that.matList.length;i++) {
                           if(that.matList[i].batch == str[2]) {
                              that.messageToggle('warn');
                              that.messageText = '重复扫描';
                              that.focus = false;
                              that.$nextTick(function() {
                                 that.focus = true;
                              });
                              add = false;
                              break;
                           }
                        }
                     }
                     if(add) {
                        that.messageToggle('success');
                        that.messageText = '检索成功';
                        that.focus = false;
                        that.$nextTick(function() {
                           that.focus = true;
                        });
                        // uni.hideKeyboard();
                        that.matList.unshift(res.data)
                     }
                     that.focus = false;
                     that.$nextTick(function() {
                        that.focus = true;
                     });
                     uni.hideKeyboard();
                  that.listLen = that.matList.length
                     that.matnr = ''
                     that.listLen = that.matList.length;
                     uni.hideLoading();
                  } else if (res.code == 403) {
                     that.messageToggle('warn')
                     that.messageToggle('error')
                     that.messageText = res.msg
                     setTimeout(() => {
                        uni.reLaunch({
@@ -228,7 +238,7 @@
                        });
                     }, 1000);
                  } else {
                     that.messageToggle('warn')
                     that.messageToggle('error')
                     that.messageText = res.msg
                     // uni.showToast({title: res.msg, icon: "none",position: 'top'})
                  }
@@ -240,35 +250,12 @@
         change(e) {
            console.log('当前模式:' + e.type + ',状态:' + e.show);
         },
         toggle(type) {
            this.type = type
            // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
            this.$refs.goodsSearch.open(type)
         },
         checkbox: function (e) {
            var items = this.data,
               values = e.detail.value;
            for (var i = 0, lenI = items.length; i < lenI; ++i) {
               const item = items[i]
               item.id = item.id + ''
               if(values.indexOf(item.id) >= 0){
                  this.$set(item,'checked',true)
               }else{
                  this.$set(item,'checked',false)
               }
            }
            if (values.length == items.length) {
               this.check = true
               this.checkText = "取消全选"
            } else {
               this.check = false
               this.checkText = "全选"
            }
            uni.vibrateShort();
         },
      }
   }
</script>
<style>
   /* @import "../../colorui/main.css";
@@ -410,17 +397,18 @@
      display: inline-block;
      float: left;
      margin-left: 6%;
      height: 90rpx;
      height: 100rpx;
      /* line-height: 100rpx; */
      color: #676767;
   }
   .matnr {
      padding-top: 10rpx;
      padding-top: 8rpx;
   }
   .data-list-right {
      display: inline-block;
      float: right;
      height: 90rpx;
      line-height: 90rpx;
      height: 100rpx;
      line-height: 100rpx;
      margin-right: 10%;
   }
</style>