#
whycq
2022-08-16 17de5258a24ba6f42a07f9cc57b3bfc552e7bbff
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" placeholder-style="line-height:  85rpx;">
                  <input v-model="barcode" type="text" placeholder="扫码 / 输入" placeholder-style="margin-top:10px" maxlength="10"
                  :focus="barcodeFocus" @confirm="barcodeInput()">
                  <uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons>
               </view>
            </view>
@@ -22,14 +22,14 @@
               <view class="title-text"><text>检索商品</text></view>
            </view>
            <view class="square-content">
               <view class="content-input-btn">
               <view class="content-input">
                  <input v-model="matnr" type="text" placeholder="扫码 / 输入" @input="findMat()"
                  :focus="focus" placeholder-style="line-height:  85rpx;">
                  :focus="focus" placeholder-style="margin-top:9px">
                  <uni-icons type="closeempty" size="20" color="#dadada" @click="removeMatnr()"></uni-icons>
               </view>
               <view class="content-btn">
               <!-- <view class="content-btn">
                  <button class="cu-btn bg-blue pda-btn" @click="selectMat()">+提取</button>
               </view>
               </view> -->
            </view>
         </view>
         
@@ -52,15 +52,15 @@
                  <!-- <view>
                     <checkbox :value="item.id+''" :checked="item.checked" style="display: block;" />
                  </view> -->
                  <view class="matnr"><text style="width: 400rpx;">编码:{{item.matnr}}</text></view>
                  <view><text style="width: 400rpx;">品名:{{item.maktx}}</text></view>
                  <view><text style="width: 400rpx;">批号:{{item.batch}}</text></view>
                  <view class="matnr"><text style="width: 400rpx;">编码:{{item.matNo}}</text></view>
                  <view><text style="width: 400rpx;">品名:{{item.matName}}</text></view>
                  <view><text style="width: 400rpx;">规格:{{item.str2}}</text></view>
                  <view>
                     <text style="width: 400rpx;">数量:{{item.anfme}}</text>
                     <text style="width: 400rpx;">数量:{{item.count}}</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="compose" size="20" color="#a5a5a5" @click="revise(index)"></uni-icons></label>
                  <label><uni-icons type="trash" size="25" color="#a5a5a5" @click="remove(item,index)"></uni-icons></label>
               </view>
            </view>
@@ -87,18 +87,19 @@
      
      <!-- 弹窗 -->
      <!-- 修改数量 -->
      <uni-popup ref="revise" background-color="#fff" @change="change">
      <uni-popup ref="revise" background-color="#fff">
         <view class="revise-box">
            <view class="revise-box-top">
               <view class="color-block-blue"></view>
               <text class="title">组托数量</text>
            </view>
            <view class="text-box">
               <text>可组数量:{{enableQty}}</text>
               <text>确认组托数量</text>
            </view>
            <view class="changeBox">
               <view class="num-box">
                  <uni-number-box v-model="count" :min="minCount" :max="maxCount" color="#747474"  @change="changeValue"/>
                  <uni-number-box v-model="counts" :min="0" :max="99999" color="#747474" />
               </view> 
            </view>
            <view class="revise-box-buttom">
@@ -127,6 +128,7 @@
            result: '',
            enableQty:'',
            count:'',
            counts:'',
            minCount:0,
            maxCount:'',
            rowNum:'',
@@ -150,15 +152,19 @@
      methods: {
         // 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()
            }
            // 不设置定时器 会出现扫入的字符串不全
            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() {
@@ -204,13 +210,8 @@
               this.focus = true;
            });
         },
         remove() {
            // this.matList.splice(index,1)
            for (var i = 0; i < this.matList.length; i++) {
               if (this.matList[i].checked == true) {
                  this.matList.splice(i,1)
               }
            }
         remove(item,index) {
            this.matList.splice(index,1)
            this.checkList();
            uni.vibrateShort();
         },
@@ -282,9 +283,9 @@
         findMat() {
            let that = this
            uni.request({
                url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/auth',
                url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/matCode/auth',
                data: {
                  matnr:that.matnr
                  id:that.matnr
                },
                header: {
                  'token':uni.getStorageSync('token')
@@ -301,7 +302,6 @@
                            // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                            matList: function(data) {
                              that.matList.push(data.data)
                              console.log(that.matList)
                           },
                        },
                        success: function(res) {
@@ -325,47 +325,38 @@
            this.$refs.goodsSearch.open(type)
         },
         checkbox: function (e) {
            var items = this.matList,
               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();
            // var items = this.matList,
            //    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();
         },
         revise(item,index) {
            var maxCount = this.matList[index].maxCount
            if (maxCount == undefined ) {
               this.matList[index]["maxCount"] = item.enableQty
            }
            this.enableQty = item.enableQty
            this.count = this.minCount
            this.maxCount = item.maxCount
         revise(index) {
            this.rowNum = index
            this.eject()
         },
         eject(type) {
            this.type = type
            // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
            this.$refs.revise.open(type)
         },
         changeValue() {
            this.$refs.revise.open()
            
         },
         changeCount(e) {
         },
         // 确认组托数量
         confirm() {
            this.matList[this.rowNum].anfme = this.count
            this.matList[this.rowNum].count = this.counts
            this.$forceUpdate() // 强制刷新
            this.$refs.revise.close()
         },
         // 列表反选
@@ -526,12 +517,13 @@
      height: 180rpx;
      margin: 15rpx;
      border-radius: 20rpx;
      font-size: 12px;
   }
   .data-list:first-child {
      margin-top: 20rpx;
   }
   .data-list:last-child {
      margin-bottom: 120rpx;
      margin-bottom: 170rpx;
   }
   /* .data-list-left {
      display: inline-block;
@@ -568,4 +560,50 @@
      width: 80rpx;
      height: 180rpx;
   }
   .revise-box {
      width: 500rpx;
      height: 500rpx;
   }
   .revise-box-top {
      width: 100%;
      height: 100rpx;
      background-color: #fff;
      padding: 10rpx;
   }
   .changeBox {
      width: 100%;
      height: 100rpx;
      line-height: 120rpx;
      text-align: center;
      background-color: #FFF;
      margin-top: 20rpx;
      border-bottom: 1px solid #e3e3e3;
   }
   .text-box {
      width: 100%;
      height: 100rpx;
      line-height: 120rpx;
      text-align: center;
      /* padding-left: 120rpx; */
      background-color: #FFF;
      margin-top: 20rpx;
      border-bottom: 1px solid #e3e3e3;
   }
   .changeBox .num-box {
      display:  inline-block;
      /* float: left; */
   }
   .changeBox button {
      float: left;
   }
   .revise-box-buttom {
      position: absolute;
      width: 100%;
      height: 100rpx;
      line-height: 100rpx;
      background-color: #FFFFFF;
      bottom: 0;
      text-align: center;
   }
</style>