#
whycq
2023-01-30 1bbb2a5f47e8f03955154106cf5542cb8bcf13e1
pages/basics/pakin.vue
@@ -3,13 +3,15 @@
      <scroll-view scroll-y catch:touchmove="touchmove">
         <view class="square-2">
            <view class="square-title">
               <view class="title-sign"><view class="sign"></view></view>
               <view class="title-sign">
                  <view class="sign"></view>
               </view>
               <view class="title-text"><text>托盘条码</text></view>
            </view>
            <view class="square-content">
               <view class="content-input">
                  <input v-model="barcode" type="text" placeholder="扫码 / 输入"
                  :focus="barcodeFocus" @confirm="barcodeInput()" placeholder-style="line-height:  85rpx;">
                  <input v-model="barcode" type="text" placeholder="扫码 / 输入" :focus="barcodeFocus"
                     @confirm="barcodeInput()" placeholder-style="line-height:  85rpx;">
                  <uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons>
               </view>
            </view>
@@ -18,13 +20,15 @@
         
         <view class="square-2">
            <view class="square-title">
               <view class="title-sign"><view class="sign"></view></view>
               <view class="title-sign">
                  <view class="sign"></view>
               </view>
               <view class="title-text"><text>检索商品</text></view>
            </view>
            <view class="square-content">
               <view class="content-input-btn">
                  <input v-model="matnr" type="text" placeholder="扫码 / 输入" @input="findMat()"
                  :focus="focus" placeholder-style="line-height:  85rpx;">
                  <input v-model="matnr" type="text" placeholder="扫码 / 输入" @input="findMat()" :focus="focus"
                     placeholder-style="line-height:  85rpx;">
                  <uni-icons type="closeempty" size="20" color="#dadada" @click="removeMatnr()"></uni-icons>
               </view>
               <view class="content-btn">
@@ -36,7 +40,9 @@
         
         <view class="square-1">
            <view class="square-title">
               <view class="title-sign"><view class="sign"></view></view>
               <view class="title-sign">
                  <view class="sign"></view>
               </view>
               <view class="title-text"><text>商品列表</text></view>
               <!-- <label v-show="matList.length != 0" style="float: right;margin-right: 20px;margin-top: 13px;"><uni-icons type="trash" size="25" color="#a5a5a5" @click="remove()"></uni-icons></label> -->
            </view>
@@ -47,7 +53,8 @@
         </view>
         
         <checkbox-group @change="checkbox">
            <view v-for="(item,index) in matList" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" >
            <view v-for="(item,index) in matList" :key="index" class="data-list bg-false"
               :class="'bg-'+item.checked">
               <view class="data-list-left">
                  <!-- <view>
                     <checkbox :value="item.id+''" :checked="item.checked" style="display: block;" />
@@ -57,11 +64,16 @@
                  <view><text style="width: 400rpx;">批号:{{item.batch}}</text></view>
                  <view>
                     <text style="width: 400rpx;">数量:{{item.anfme}}</text>
                     <text style="margin-left: 100rpx;">单位:{{item.unit}}</text>
                  </view>
               </view>
               <view class="data-list-right">
                  <label><uni-icons type="compose" size="20" color="#a5a5a5" @click="revise(item,index)"></uni-icons></label>
                  <label><uni-icons type="trash" size="25" color="#a5a5a5" @click="remove(item,index)"></uni-icons></label>
                  <label>
                     <uni-icons type="compose" size="20" color="#a5a5a5" @click="revise(item,index)"></uni-icons>
                  </label>
                  <label>
                     <uni-icons type="trash" size="25" color="#a5a5a5" @click="remove(item,index)"></uni-icons>
                  </label>
               </view>
            </view>
         </checkbox-group>
@@ -87,7 +99,7 @@
      
      <!-- 弹窗 -->
      <!-- 修改数量 -->
      <uni-popup ref="revise" background-color="#fff">
      <uni-popup ref="revise">
         <view class="revise-box ">
            <view class="revise-box-top">
               <view class="color-block-blue"></view>
@@ -97,10 +109,14 @@
               <text style="display: inline-block;float: left;width: 50px;">批号:</text>
               <input type="text" style="width: 100px;border-bottom: 1px solid #9e9e9e;" v-model="batch">
            </view>
            <view class="" style="position: relative;left: 50px;margin-bottom: 20px;">
               <text style="display: inline-block;float: left;width: 50px;">单位:</text>
               <input type="text" style="width: 100px;border-bottom: 1px solid #9e9e9e;" v-model="unit">
            </view>
            <view class="changeBox">
               <view class="num-box">
                  <text style="display: inline-block;float: left;width: 50px;">批号:</text>
                  <uni-number-box :value="count" :max="9999" color="#747474"  @change="changeValue"/>
                  <text style="display: inline-block;float: left;width: 50px;">数量:</text>
                  <uni-number-box :value="count" :max="999999999" color="#747474" @change="changeValue" />
               </view> 
            </view>
            <view class="revise-box-buttom">
@@ -136,7 +152,8 @@
            check:false,
            checkText:'全选',
            checkedData:[],
            batch:''
            batch: '',
            unit: ''
         }
      },
      onShow() {
@@ -165,7 +182,11 @@
            setTimeout(()=>{
               var len = this.barcode.length
               if (len != 8) {
                  uni.showToast({title: '托盘码有误请重试', icon: "none", position: 'top'});
                  uni.showToast({
                     title: '托盘码有误请重试',
                     icon: "none",
                     position: 'top'
                  });
                  this.barcodeFocuss()
                  return;
               }
@@ -223,16 +244,28 @@
            uni.vibrateShort();
            let that = this;
            if (that.barcode === '') {
               uni.showToast({title: '请扫描托盘条码', icon: "none", position: 'top'});
               uni.showToast({
                  title: '请扫描托盘条码',
                  icon: "none",
                  position: 'top'
               });
               return;
            }
            if (that.matList.length === 0) {
               uni.showToast({title: '请添加商品列表', icon: "none", position: 'top'});
               uni.showToast({
                  title: '请添加商品列表',
                  icon: "none",
                  position: 'top'
               });
               return;
            }
            for (var i = 0; i < that.matList.length; i++) {
               if (that.matList[i].anfme == 0 || that.matList[i].anfme == '') {
                  uni.showToast({title: that.matList[i].matnr + '组托数量不能为0', icon: "none", position: 'top'});
                  uni.showToast({
                     title: that.matList[i].matnr + '组托数量不能为0',
                     icon: "none",
                     position: 'top'
                  });
                  return;
               }
            }
@@ -248,6 +281,7 @@
                  'token':uni.getStorageSync('token')
                },
               success(result) {
                  console.log(that.matList);
                  uni.hideLoading();
                  var res = result.data
                  if (res.code === 200) {
@@ -258,14 +292,22 @@
                        duration: 1000
                     });
                  } else if (res.code == 403) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
                     uni.showToast({
                        title: res.msg,
                        icon: "none",
                        position: 'top'
                     })
                     setTimeout(() => {
                        uni.reLaunch({
                           url: '../login/login'
                        });
                     }, 1000);
                  } else {
                     uni.showToast({title: res.msg, icon: "none",position: 'top'})
                     uni.showToast({
                        title: res.msg,
                        icon: "none",
                        position: 'top'
                     })
                  }
               }
            });
@@ -284,7 +326,9 @@
               },
               success: function(res) {
                   // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的
                   res.eventChannel.emit('commonUrl', {commonUrl:that.commonUrl })
                  res.eventChannel.emit('commonUrl', {
                     commonUrl: that.commonUrl
                  })
               },
               
            });
@@ -317,18 +361,28 @@
                        },
                        success: function(res) {
                           // 通过eventChannel向被打开页面传送数据
                           res.eventChannel.emit('matData', { data: that.matData })
                           res.eventChannel.emit('matData', {
                              data: that.matData
                           })
                        },
                     });
                  } else if (res.code == 403) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
                     uni.showToast({
                        title: res.msg,
                        icon: "none",
                        position: 'top'
                     })
                     setTimeout(() => {
                        uni.reLaunch({
                           url: '../login/login'
                        });
                     }, 1000);
                  } else {
                     uni.showToast({title: res.msg, icon: "none",position: 'top'})
                     uni.showToast({
                        title: res.msg,
                        icon: "none",
                        position: 'top'
                     })
                  }
                  
               }
@@ -465,24 +519,30 @@
   .revise-box {
      position: relative;
      width: 500rpx;
      height: 400rpx;
      border-radius: 25px;
      height: 470rpx;
      border-radius: 15px;
      background-color: #FFFFFF;
   }
   .revise-box-top {
      width: 400rpx;
      height: 120rpx;
      border-radius: 25px;
   }
   .changeBox {
      width: 400rpx;
      height: 100rpx;
   }
   .num-box {
      margin-left: 100rpx;
   }
   .revise-box-buttom{
      margin-left: 190rpx;
   }
   .pak-seach-box {
      background-color: #FFFFFF;
      margin: 15rpx 15rpx 0rpx 15rpx;
@@ -490,11 +550,13 @@
      height: 150rpx;
      border-radius: 20rpx;
   }
   .box-top{
      display: block;
      height: 60rpx;
      width: 720rpx;
   }
   .color-block-blue {
      background-color: #1E9FFF;
      display: inline-block;
@@ -505,6 +567,7 @@
      border: 5rpx solid #1E9FFF;
      border-radius: 20rpx;
   }
   .title {
      display: inline-block;
      float: left;
@@ -514,6 +577,7 @@
      line-height: 50rpx;
      margin-top: 10rpx;
   }
   .box-buttom {
      display: inline-block;
      background-color: #ededed;
@@ -522,11 +586,13 @@
      border-radius: 20rpx;
      margin: 15rpx 15rpx 0rpx 15rpx;
   }
   .box-buttom input {
      width: 75%;
      float: left;
      margin: 8rpx 10rpx 0rpx 25rpx;
   }
   .box-buttom .search-icon{
      width: 60rpx;
      height: 60rpx;
@@ -534,6 +600,7 @@
      margin-top: 5rpx;
      margin-right: 10rpx;
   }
   /* .pak-seach-box input {
      background-color: #ededed;
      border: 1rpx solid #d8d8d8;
@@ -556,9 +623,11 @@
      margin: 15rpx 15rpx 0rpx 15rpx;
      line-height: 60rpx;
   }
   .pakin-btn {
      background-color: #1E9FFF;
   }
   .pak-data-box {
      background-color: #F1F1F1;
      margin: 15rpx 15rpx 0rpx 15rpx;
@@ -566,29 +635,36 @@
      height: 70rpx;
      border-radius: 20rpx;
   }
   .pak-data-box .box-top {
      background-color: #FFFFFF;
      height: 70rpx;
      border-radius: 20rpx 20rpx 20rpx 20rpx;
   }
   .bg-false {
      background-color: #FFFFFF;
   }
   .bg-true {
      background-color: #ebebeb;
   }
   .data-list {
      border-bottom: 1px solid #d8d8d8;
      height: 180rpx;
      margin: 15rpx;
      border-radius: 20rpx;
   }
   .data-list:first-child {
      margin-top: 20rpx;
   }
   .data-list:last-child {
      margin-bottom: 120rpx;
   }
   /* .data-list-left {
      display: inline-block;
      float: left;
@@ -604,15 +680,18 @@
      height: 180rpx;
      color: #676767;
   }
   .matnr {
      padding-top: 10rpx;
   }
   .data-list-right {
      display: inline-block;
      float: right;
      height: 180rpx;
      line-height: 180rpx;
   }
   /* display: inline-block;
   float: right;
   width: 200rpx;