#
whycq
2023-10-05 15a71f30d03e47a9fddb690ee4f9462b47e82707
pages/pakin/pakin.vue
@@ -8,7 +8,7 @@
         </view>
         <view class="item">
            <view class="code-decs">物料码:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="matnr" :focus="matFocus" @input="findMat()">
            <input type="text" placeholder=" 扫码 / 输入" v-model="matNo" :focus="matFocus" @input="findMat()">
            <view class="item-right">
               <button></button>
               <text style="text-align: right;color: #409EFF;" @click="selectMat()">提取+</text>
@@ -84,7 +84,7 @@
               <view class="popup-item">
                  <view class="popup-item-left">编码:</view>
                  <view class="popup-item-right">
                     <input type="text" v-model="matnr" disabled="true"
                     <input type="text" v-model="matNo" disabled="true"
                        style="background-color: #f7f7f7;padding: 0;color: #d5d5d5;">
                  </view>
               </view>
@@ -152,7 +152,7 @@
            dataList: [],
            count: 0,
            rowNum: '',
            matnr: '',
            matNo: '',
            batch: '',
            weight: '',
            msgType1: 'success',
@@ -209,7 +209,7 @@
         focuss() {
            this.focus = false;
            setTimeout(() => {
               this.matnr = '';
               this.matNo = '';
               this.matFocus = true;
            }, 100);
         },
@@ -219,7 +219,7 @@
            uni.request({
               url: that.baseUrl + '/matCode/list/auth',
               data: {
                  mat_no: that.matnr
                  mat_no: that.matNo
               },
               header: {
                  'token': uni.getStorageSync('token')
@@ -228,7 +228,7 @@
                  result = result.data
                  if (result.code === 200 && result.data) {
                     that.matData = result.data
                     that.matnr = ''
                     that.matNo = ''
                     that.matData['batch'] = ''
                     uni.navigateTo({
                        url: "../mat/matSelected",
@@ -282,20 +282,54 @@
               events: {
                  // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据  另外一个页面传过来的
                  acceptDataFromOpenedPage: function(data) {
                     that.matnr = data.data
                     that.findMat(that.matnr)
                     that.matNo = data.data
                     that.findMat(that.matNo)
                  },
               },
            });
            that.matnr = ''
            that.matNo = ''
         },
         // checkMat(mat) {
         //    var len = this.dataList.length
         //    var add = true ,sameItem = false
         //    for (var i = 0; i < len; i++) {
         //       if (mat.matno == this.dataList[i].matno) {
         //          for (var j = 0; j < len; j++) {
         //             if (mat.batch == this.dataList[j].batch) {
         //                sameItem = true
         //             }
         //          }
         //          // 相同物料 不同批号  新加列表
         //          if (mat.batch != this.dataList[i].batch) {
         //             this.$forceUpdate() // 强制刷新
         //             if (sameItem) {
         //                add = false
         //             } else {
         //                add = true
         //             }
         //          } else {
         //             // 相同物料相同批号 数量累加
         //             this.dataList[i].anfme += mat.anfme
         //             this.$forceUpdate() // 强制刷新
         //             add = false
         //          }
         //       }
         //    }
         //    if (add) {
         //       this.dataList.unshift(mat)
         //    }
         // },
         checkMat(mat) {
            var len = this.dataList.length
            var add = true ,sameItem = false
            for (var i = 0; i < len; i++) {
               if (mat.matnr == this.dataList[i].matnr) {
               console.log(i);
               console.log(mat);
               console.log(this.dataList[i].matNo);
               if (mat.matNo == this.dataList[i].matNo) {
                  for (var j = 0; j < len; j++) {
                     if (mat.batch == this.dataList[j].batch) {
                        sameItem = true
@@ -324,7 +358,7 @@
         },
         // 修改批号
         revise(item, i) {
            this.matnr = this.dataList[i].matnr
            this.matNo = this.dataList[i].matNo
            this.count = this.dataList[i].anfme
            this.batch = this.dataList[i].batch
            this.weight = this.dataList[i].weight
@@ -359,7 +393,7 @@
            this.dataList[this.rowNum].batch = this.batch
            this.dataList[this.rowNum].weight = this.weight
            this.dataList[this.rowNum].appeTime$ = this.appeTime$
            this.matnr = ''
            this.matNo = ''
            this.messageText = "修改成功"
            this.messageToggle('success')
            this.$refs.revise.close()
@@ -394,7 +428,7 @@
            }
            for (var i = 0; i < that.dataList.length; i++) {
               if (that.dataList[i].anfme == 0 || that.dataList[i].anfme == '') {
                  this.messageText = that.dataList[i].matnr + '组托数量不能为0'
                  this.messageText = that.dataList[i].matNo + '组托数量不能为0'
                  this.messageToggle('error')
                  return;
               }