|  |  | 
 |  |  | <template> | 
 |  |  |    <view> | 
 |  |  |       <view class="status_bar"> | 
 |  |  |          <!-- 这里是状态栏 --> | 
 |  |  |       </view> | 
 |  |  |       <uni-nav-bar left-icon="left" background-color="#f8f8f8" title="制令入库" @clickLeft="back"  :fixed="true" | 
 |  |  |          :border="false" rightWidth="160rpx" leftWidth="160rpx" | 
 |  |  |          > | 
 |  |  |          <block slot="right"> | 
 |  |  |             <view class="city"> | 
 |  |  |                <view> | 
 |  |  |                   <text class="uni-nav-bar-text">{{store}}</text> | 
 |  |  |                </view> | 
 |  |  |             </view> | 
 |  |  |          </block> | 
 |  |  |        </uni-nav-bar> | 
 |  |  |       <view class="code"> | 
 |  |  |          <view class="item"> | 
 |  |  |             <view class="code-decs">制令号:</view> | 
 |  |  | 
 |  |  |          <view class="item"> | 
 |  |  |             <view class="code-decs">物料码:</view> | 
 |  |  |             <input type="text" placeholder=" 扫码 / 输入" v-model="matnr" :focus="matFocus" @input="checkBom()"> | 
 |  |  |             <uni-icons type="close" color="#c1c1c1" @click="clearMatnr"></uni-icons> | 
 |  |  |             <view class="item-right"> | 
 |  |  |                <button></button> | 
 |  |  |                <text style="text-align: right;color: #409EFF;" @click="selectMat()">提取+</text> | 
 |  |  | 
 |  |  |          return { | 
 |  |  |             baseUrl: '', | 
 |  |  |             token: '', | 
 |  |  |             storeId: 0, | 
 |  |  |             store: '', | 
 |  |  |             barcode: '', | 
 |  |  |             dataList: [], | 
 |  |  |             count: 0, | 
 |  |  | 
 |  |  |             bomCode: '', | 
 |  |  |             bomCodeFocus: true, | 
 |  |  |             maxAn: 0, | 
 |  |  |             ck1: true, | 
 |  |  |             ck2: false, | 
 |  |  |             ck1: false, | 
 |  |  |             ck2: true, | 
 |  |  |             fullPlt: 'N', | 
 |  |  |             decrees_a: { | 
 |  |  |                locNo: '', | 
 |  |  | 
 |  |  |          } | 
 |  |  |       }, | 
 |  |  |       onLoad() { | 
 |  |  |  | 
 |  |  |          // this.dataList = uni.getStorageSync('zlPakinDataList') | 
 |  |  |          // if (this.dataList === '') { | 
 |  |  |          //    this.dataList = [] | 
 |  |  |          // } | 
 |  |  |       }, | 
 |  |  |       onShow() { | 
 |  |  |          this.baseUrl = uni.getStorageSync('baseUrl'); | 
 |  |  |          this.token = uni.getStorageSync('token'); | 
 |  |  |          // setTimeout(()=>{ | 
 |  |  |          //    this.$refs.decrees.open('center') | 
 |  |  |          // },300) | 
 |  |  |          this.storeId = uni.getStorageSync('store') | 
 |  |  |          if (this.storeId == 1) { | 
 |  |  |             this.store = '宁波仓' | 
 |  |  |          } | 
 |  |  |          if (this.storeId == 2) { | 
 |  |  |             this.store = '新昌仓' | 
 |  |  |          } | 
 |  |  |       }, | 
 |  |  |       methods: { | 
 |  |  |          back() { uni.navigateBack({}) }, | 
 |  |  |          clearMatnr() { | 
 |  |  |             // this.matnr = '' | 
 |  |  |             this.focuss() | 
 |  |  |          }, | 
 |  |  |          // 是否满板 | 
 |  |  |          isFullPlt() { | 
 |  |  |             var temp = this.ck1 | 
 |  |  | 
 |  |  |             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; | 
 |  |  |                } | 
 |  |  | 
 |  |  |             }, 100); | 
 |  |  |          }, | 
 |  |  |          // 检验当前物料是否是在当前Bom表中 | 
 |  |  |          checkBom() { | 
 |  |  |          checkBom(mat) { | 
 |  |  |             let _this = this | 
 |  |  |             uni.request({ | 
 |  |  |                url: _this.baseUrl + '/mobile/pda/decrees/check', | 
 |  |  | 
 |  |  |                method: 'POST', | 
 |  |  |                header: {  | 
 |  |  |                   'token': uni.getStorageSync('token'), | 
 |  |  |                    'content-type' : 'application/x-www-form-urlencoded' | 
 |  |  |                   'content-type' : 'application/x-www-form-urlencoded' | 
 |  |  |                }, | 
 |  |  |                success(res) { | 
 |  |  |                   // console.log(res); | 
 |  |  | 
 |  |  |                   if (res.code === 200) { | 
 |  |  |                      switch(res.data.status) { | 
 |  |  |                         case 1: | 
 |  |  |                            _this.findMat() | 
 |  |  |                            // _this.findMat() | 
 |  |  |                            _this.checkMat(mat) | 
 |  |  |                            break; | 
 |  |  |                         case 2: | 
 |  |  |                            // 相同制令货物补货 | 
 |  |  | 
 |  |  |             let that = this | 
 |  |  |             uni.request({ | 
 |  |  |                url: that.baseUrl + '/mat/auth', | 
 |  |  |                data: { | 
 |  |  |                   matnr: that.matnr | 
 |  |  |                }, | 
 |  |  |                header: { | 
 |  |  |                   'token': uni.getStorageSync('token') | 
 |  |  |                }, | 
 |  |  |                data: { matnr: that.matnr }, | 
 |  |  |                header: { 'token': uni.getStorageSync('token') }, | 
 |  |  |                success(result) { | 
 |  |  |                   result = result.data | 
 |  |  |                   if (result.code === 200 && result.data) { | 
 |  |  | 
 |  |  |                         }, | 
 |  |  |                      }); | 
 |  |  |                   } else if (result.code == 403) { | 
 |  |  |                      uni.showToast({ | 
 |  |  |                         title: result.msg, | 
 |  |  |                         icon: "none", | 
 |  |  |                         position: 'top' | 
 |  |  |                      }) | 
 |  |  |                      uni.showToast({ title: result.msg, icon: "none", position: 'top' }) | 
 |  |  |                      setTimeout(() => { | 
 |  |  |                         uni.reLaunch({ | 
 |  |  |                            url: '../login/login' | 
 |  |  |                         }); | 
 |  |  |                         uni.reLaunch({ url: '../login/login' }); | 
 |  |  |                      }, 1000); | 
 |  |  |                   } else { | 
 |  |  |                      uni.showToast({ | 
 |  |  |                         title: result.msg, | 
 |  |  |                         icon: "none", | 
 |  |  |                         position: 'top' | 
 |  |  |                      }) | 
 |  |  |                      uni.showToast({ title: result.msg, icon: "none", position: 'top' }) | 
 |  |  |                   } | 
 |  |  |  | 
 |  |  |                } | 
 |  |  | 
 |  |  |          selectMat() { | 
 |  |  |             let that = this | 
 |  |  |             uni.navigateTo({ | 
 |  |  |                url: "../mat/matQuery", | 
 |  |  |                url: "../mat/matQueryByOrder", | 
 |  |  |                success: function(res) { | 
 |  |  |                   // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的 | 
 |  |  |                   res.eventChannel.emit('commonUrl', { | 
 |  |  | 
 |  |  |                events: { | 
 |  |  |                   // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据  另外一个页面传过来的 | 
 |  |  |                   acceptDataFromOpenedPage: function(data) { | 
 |  |  |                      that.matnr = data.data | 
 |  |  |                      that.checkBom(that.matnr) | 
 |  |  |                      that.matnr = data.data.matnr | 
 |  |  |                      that.checkBom(data.data) | 
 |  |  |                   }, | 
 |  |  |                }, | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             }); | 
 |  |  |             that.matnr = '' | 
 |  |  |          }, | 
 |  |  | 
 |  |  |             } | 
 |  |  |             this.$forceUpdate() // 强制刷新 | 
 |  |  |             this.maxAnfme = '' | 
 |  |  |             uni.setStorageSync('zlPakinDataList', this.dataList); | 
 |  |  |          }, | 
 |  |  |          // 修改批号 | 
 |  |  |          revise(item, i) { | 
 |  |  | 
 |  |  |          }, | 
 |  |  |          // 确认移除 | 
 |  |  |          removeConfirm() { | 
 |  |  |             this.messageText = "移除成功" | 
 |  |  |             this.messageToggle('success') | 
 |  |  |             uni.showToast({ title: "移除成功", icon: "success", position: 'top' }) | 
 |  |  |             this.dataList.splice(this.removeNum, 1) | 
 |  |  |          }, | 
 |  |  |          // 取消移除 | 
 |  |  | 
 |  |  |             this.dataList[this.rowNum].batch = this.batch | 
 |  |  |             this.dataList[this.rowNum].weight = this.weight | 
 |  |  |             this.matnr = '' | 
 |  |  |             this.messageText = "修改成功" | 
 |  |  |             this.messageToggle('success') | 
 |  |  |             uni.showToast({ title: "修改成功", icon: "success", position: 'top' }) | 
 |  |  |             this.$refs.revise.close() | 
 |  |  |          }, | 
 |  |  |          reviseClose() { | 
 |  |  | 
 |  |  |             uni.vibrateShort(); | 
 |  |  |             let that = this; | 
 |  |  |             if (that.barcode === '') { | 
 |  |  |                this.messageText = "请扫描托盘条码" | 
 |  |  |                this.messageToggle('error') | 
 |  |  |                uni.showToast({ title: "请扫描托盘条码", icon: "error", position: 'top' }) | 
 |  |  |                return; | 
 |  |  |             } | 
 |  |  |             if (that.dataList.length === 0) { | 
 |  |  |                this.messageText = "请添加商品列表" | 
 |  |  |                this.messageToggle('error') | 
 |  |  |                uni.showToast({ title: "请添加商品列表", icon: "error", position: 'top' }) | 
 |  |  |                return; | 
 |  |  |             } | 
 |  |  |             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.messageToggle('error') | 
 |  |  |                   uni.showToast({ title: "组托数量不能为0", icon: "error", position: 'top' }) | 
 |  |  |                   return; | 
 |  |  |                } | 
 |  |  |             } | 
 |  |  | 
 |  |  |                url: that.baseUrl + '/mobile/comb/auth', | 
 |  |  |                data: JSON.stringify({ | 
 |  |  |                   fullPlt: that.fullPlt, | 
 |  |  |                   owner: that.storeId, | 
 |  |  |                   barcode: that.barcode, | 
 |  |  |                   combMats: that.dataList | 
 |  |  |                }), | 
 |  |  | 
 |  |  |                      const innerAudioContext = uni.createInnerAudioContext(); | 
 |  |  |                      innerAudioContext.src = '/static/music/pakinOk.mp3'; | 
 |  |  |                      innerAudioContext.play() | 
 |  |  |                      that.dataList = [] | 
 |  |  |                      uni.setStorageSync('zlPakinDataList', that.dataList); | 
 |  |  |                      uni.showToast({ title: '组托成功', icon: "success", position: 'top' }) | 
 |  |  |                   } else if (res.code == 403) { | 
 |  |  |                      that.messageText = res.msg | 
 |  |  |                      that.messageToggle('error') | 
 |  |  |                      uni.showToast({ title: res.msg, icon: "error", position: 'top' }) | 
 |  |  |                      setTimeout(() => { | 
 |  |  |                         uni.reLaunch({ | 
 |  |  |                            url: '../login/login' | 
 |  |  |                         }); | 
 |  |  |                         uni.reLaunch({ url: '../login/login' }); | 
 |  |  |                      }, 1000); | 
 |  |  |                   } else { | 
 |  |  |                      that.messageText = res.msg | 
 |  |  |                      that.messageToggle('error') | 
 |  |  |                      uni.showToast({ title: res.msg, icon: "error", position: 'top' }) | 
 |  |  |                   } | 
 |  |  |                } | 
 |  |  |             }); | 
 |  |  | 
 |  |  |             this.dataList = [] | 
 |  |  |             this.barcode = '' | 
 |  |  |             this.bomCode = '' | 
 |  |  |             this.messageText = "重置完成" | 
 |  |  |             this.messageToggle('success') | 
 |  |  |             uni.showToast({ title: "重置完成", icon: "success", position: 'top' }) | 
 |  |  |             this.bomFocuss() | 
 |  |  |          }, | 
 |  |  |          // 取消重置 |