123
zhang
2025-05-26 112c71dbe86fdffffe3dceb13fc7881e7fbe7881
pages/basics/order.vue
@@ -29,20 +29,34 @@
            </view>
         </view>
         
         <view class="square-2">
            <view class="square-title">
               <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="tiaoma" type="text" placeholder="扫码 / 输入" @input="findTiaoMa()"
                  :focus="tmfocus" placeholder-style="line-height:  85rpx;">
                  <uni-icons type="closeempty" size="20" color="#dadada" @click="removeTm()"></uni-icons>
               </view>
            </view>
         </view>
         <view class="square-1">
            <view class="square-title">
               <view class="title-sign"><view class="sign"></view></view>
               <view class="title-text"><text>商品列表</text></view>
               <view v-show="matList.length != 0" class="lable">
                  <label class="label-btn" style="width: 170rpx;line-height: 95rpx;"  >
                  <!-- <label class="label-btn" style="width: 170rpx;line-height: 95rpx;"  >
                     <checkbox :checked="check" @click="allChecked()">{{checkText}}</checkbox>
                  </label>
                  <label class="label-btn"  >
                  </label> -->
                  <!-- <label class="label-btn"  >
                     <text  @click="reChecked()">反选</text>
                  </label>
                  <label >
                     <uni-icons type="trash" size="25" color="#a5a5a5" @click="remove()"></uni-icons>
                  </label>
                  </label> -->
               </view>
            </view>
            
@@ -52,17 +66,19 @@
         </view>
         
         <checkbox-group @change="checkbox">
            <view v-for="(item,index) in matList" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" >
               <label class="left-check-box">
                  <checkbox :value="item.id+''" :checked="item.checked" style="display: block;" />
            <view v-for="(item,index) in matList" :key="index" v-if="item.anfme>0"  class="data-list bg-false" :class="'bg-'+item.checked" >
               <label class="left-check-box" >
                  <checkbox :value="item.id+''" :checked="true" style="display: block;" />
               </label>
               <view class="data-list-left">
               <view class="data-list-left" >
                  <view class="matnr"><text style="width: 700rpx;">品号:{{item.matnr}}</text></view>
                  <view><text style="width: 700rpx;">品名:{{item.maktx}}</text></view>
                  <view><text style="width: 700rpx;">工序:{{item.sku}}</text></view>
                  <view><text style="width: 700rpx;">批号:{{item.batch}}</text></view>
                  <view>
                     <text style="width: 700rpx;">数量:{{item.anfme}}</text>
                     <text style="width: 700rpx;">总数量:{{item.count}}</text>
                  </view>
                  <view>
                     <text style="width: 700rpx;">可组托最大数量:{{item.anfme}}</text>
                  </view>
               </view>
               <view class="data-list-right">
@@ -129,12 +145,15 @@
            commonUrl:null,
            barcode: '',
            barcodeFocus:true,
            tmfocus:false,
            focus:false,
            type: 'center',
            searchBox: 'hide',
            pick:'hide',
            order:null,
            orderNo:null,
            tiaoma:null,
            tiaomas:[],
            matList:[],
            result: '',
            count:'',
@@ -217,6 +236,14 @@
               this.focus = true;
            });
         },
         removeTm() {
            this.tiaoma = ''
            uni.vibrateShort();
            this.tmfocus = false;
            this.$nextTick(function() {
               this.focus = true;
            });
         },
         eject(type) {
            this.type = type
            // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
@@ -271,7 +298,11 @@
         comb() {
            uni.vibrateShort();
            let that = this;
            if (that.barcode === '') {
            if (!that.orderNo) {
               uni.showToast({title: '请扫描单据号', icon: "none", position: 'top'});
               return;
            }
            if (!that.barcode) {
               uni.showToast({title: '请扫描托盘条码', icon: "none", position: 'top'});
               return;
            }
@@ -279,23 +310,24 @@
               uni.showToast({title: '托盘码必须为8位', icon: "none", position: 'top'});
               return;
            }
            if (that.matList.length === 0) {
            let mats =that.matList.filter(mat =>mat.anfme>0);
            if (mats.length === 0) {
               uni.showToast({title: '请添加商品列表', icon: "none", position: 'top'});
               return;
            }
            for (var i = 0; i < that.matList.length; i++) {
               if (that.matList[i].anfme === 0) {
                  uni.showToast({title: '商品组托数量为0不能组托', icon: "none", position: 'top'});
                  return;
               }
            }
            // for (var i = 0; i < mats.length; i++) {
            //    if (that.matList[i].anfme === 0) {
            //       uni.showToast({title: '商品组托数量为0不能组托', icon: "none", position: 'top'});
            //       return;
            //    }
            // }
            uni.showLoading();
            uni.request({
                url: that.commonUrl + '/mobile/comb/auth',
                data: JSON.stringify({
                  orderNo: that.orderNo,
                  barcode: that.barcode,
                  combMats: that.matList
                  combMats: mats
               }),
               method: 'POST',
                header: {
@@ -365,6 +397,66 @@
               }
            });
         },
         findTiaoMa() {
            let that = this
            if (!that.orderNo) {
               uni.showToast({title: '请扫描单据号', icon: "none", position: 'top'});
               return;
            }
            uni.request({
                url: that.commonUrl + '/mobile/mat/search/auth',
                data: {
                  matnr: that.tiaoma
                },
                header: {
                  'token':uni.getStorageSync('token')
                },
               success(result) {
                  console.log("result:");
                  console.log(result)
                  let res = result.data
                  if (res.code === 200 && res.data) {
                     that.checkMat(res.data)
                     //this.tiaomas.unshift(that.tiaoma)
                  } else if (res.code == 403) {
                     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'})
                  }
               }
            });
         },
         checkMat(mat) {
            var len = this.matList.length
            var add = true
            for (var i = 0; i < len; i++) {
               if (mat.matnr == this.matList[i].matnr) {
                  if ( mat.batch){
                     if( mat.batch == this.matList[i].batch){
                        this.matList[i].anfme += mat.anfme
                        this.$forceUpdate() // 强制刷新
                        add = false
                     }
                  }else{
                     this.matList[i].anfme += mat.anfme
                     this.$forceUpdate() // 强制刷新
                     add = false
                  }
               }
            }
            this.tiaoma = ''
            uni.vibrateShort();
            this.focus = false;
            this.$nextTick(function() {
               this.focus = true;
            });
         },
         change(e) {
            // console.log('当前模式:' + e.type + ',状态:' + e.show);
         },