|  |  | 
 |  |  | <template> | 
 |  |  |    <view> | 
 |  |  |       <view class="code"> | 
 |  |  |          <!-- <view class="item"> | 
 |  |  |             <view class="code-decs">订单号:</view> | 
 |  |  |             <input type="text" placeholder=" 扫码 / 输入" v-model="order" :focus="orderFocus" | 
 |  |  |                @input="orderInput()" disabled> | 
 |  |  |          </view> --> | 
 |  |  |          <view class="item"> | 
 |  |  |             <view class="code-decs">托盘码:</view> | 
 |  |  |             <input type="text" placeholder=" 扫码 / 输入" v-model="barcode" :focus="barcodeFocus" | 
 |  |  | 
 |  |  |             baseUrl: '', | 
 |  |  |             token: '', | 
 |  |  |             order: '', | 
 |  |  |             orderFocus: true, | 
 |  |  |             barcode: '', | 
 |  |  |             barcodeFocus: '', | 
 |  |  |             dataList: [], | 
 |  |  |             count: 0, | 
 |  |  |             rowNum: '', | 
 |  |  | 
 |  |  |             messageText: '', | 
 |  |  |             title: '', | 
 |  |  |             content: '', | 
 |  |  |             barcodeFocus: false, | 
 |  |  |             barcodeFocus: true, | 
 |  |  |             matFocus: false, | 
 |  |  |             matData: '' | 
 |  |  |             matData: '', | 
 |  |  |             removeNum: 0 | 
 |  |  |          } | 
 |  |  |       }, | 
 |  |  |       onShow() { | 
 |  |  | 
 |  |  |                      that.matData = result.data | 
 |  |  |                      that.matnr = '' | 
 |  |  |                      that.matData['batch'] = '' | 
 |  |  |                      // if (matnr[2] === null) { | 
 |  |  |                      //    matnr[2] = '' | 
 |  |  |                      // } | 
 |  |  |                      result.data.batch = matnr[2] | 
 |  |  |                      uni.navigateTo({ | 
 |  |  |                         url: "../mat/matSelected", | 
 |  |  | 
 |  |  |             var len = this.dataList.length | 
 |  |  |             var add = true ,sameItem = false | 
 |  |  |             for (var i = 0; i < len; i++) { | 
 |  |  |                if (mat.matnr == this.dataList[i].matnr) { | 
 |  |  |                   for (var j = 0; j < len; j++) { | 
 |  |  |                      if (mat.batch == this.dataList[j].batch) { | 
 |  |  |                         sameItem = true | 
 |  |  |                if (mat.orderNo != this.dataList[i].orderNo) { | 
 |  |  |                   add = true | 
 |  |  |                   break; | 
 |  |  |                } else { | 
 |  |  |                   if (mat.matnr == this.dataList[i].matnr) { | 
 |  |  |                      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 | 
 |  |  |                      // 相同物料 不同批号  新加列表 | 
 |  |  |                      if (mat.batch != this.dataList[i].batch) { | 
 |  |  |                         this.$forceUpdate() // 强制刷新 | 
 |  |  |                         if (sameItem) { | 
 |  |  |                            add = false | 
 |  |  |                         } else { | 
 |  |  |                            add = true | 
 |  |  |                         } | 
 |  |  | 								 | 
 |  |  |                      } else { | 
 |  |  |                         add = true | 
 |  |  |                         // 相同物料相同批号 数量累加 | 
 |  |  |                         this.dataList[i].anfme += mat.anfme | 
 |  |  |                         this.$forceUpdate() // 强制刷新 | 
 |  |  |                         add = false | 
 |  |  |                      } | 
 |  |  | 							 | 
 |  |  |                   } else { | 
 |  |  |                      // 相同物料相同批号 数量累加 | 
 |  |  |                      this.dataList[i].anfme += mat.anfme | 
 |  |  |                      this.$forceUpdate() // 强制刷新 | 
 |  |  |                      add = false | 
 |  |  |                   } | 
 |  |  |                } | 
 |  |  | 					 | 
 |  |  |             } | 
 |  |  |             if (add) { | 
 |  |  |                this.dataList.unshift(mat) | 
 |  |  | 
 |  |  |             this.dataList = [] | 
 |  |  |             this.order = '' | 
 |  |  |             this.barcode = '' | 
 |  |  |             this.matnr = '' | 
 |  |  |             this.messageText = "重置完成" | 
 |  |  |             this.messageToggle('success') | 
 |  |  |          }, | 
 |  |  | 
 |  |  |          }, | 
 |  |  |          // 列表移除按钮 | 
 |  |  |          remove(item, i, type) { | 
 |  |  |             this.removeNum  = i | 
 |  |  |             this.msgType = type | 
 |  |  |             this.title = '警告' | 
 |  |  |             this.content = '是否移除当前商品!' | 
 |  |  | 
 |  |  |          removeConfirm(i) { | 
 |  |  |             this.messageText = "移除成功" | 
 |  |  |             this.messageToggle('success') | 
 |  |  |             this.dataList.splice(i, 1) | 
 |  |  |             this.dataList.splice(this.removeNum, 1) | 
 |  |  |          }, | 
 |  |  |          reviseConfirm() { | 
 |  |  |             this.dataList[this.rowNum].anfme = this.count | 
 |  |  | 
 |  |  |          changeValue(value) { | 
 |  |  |             this.count = value | 
 |  |  |          }, | 
 |  |  |          // 清空 | 
 |  |  |          resst() { | 
 |  |  |             this.dataList = [] | 
 |  |  |             this.barcode = '' | 
 |  |  |             this.barcodeFocuss() | 
 |  |  |          }, | 
 |  |  |       } | 
 |  |  |    } | 
 |  |  | </script> |