|  |  | 
 |  |  | <template> | 
 |  |  |    <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 type="text" v-model="matnr" placeholder="扫码 / 输入" @input="find" :focus="focus"> | 
 |  |  |                <uni-icons type="closeempty" size="20" color="#dadada"></uni-icons> | 
 |  |  |             </view> | 
 |  |  |          </view> | 
 |  |  |       </view> | 
 |  |  | 		 | 
 |  |  |       <!-- 库位码输入框 --> | 
 |  |  |       <view class="square-2"> | 
 |  |  |          <view class="square-title"> | 
 |  |  | 
 |  |  |          </view> | 
 |  |  |          <view class="square-content"> | 
 |  |  |             <view class="content-input"> | 
 |  |  |                <input type="text" v-model="locno" placeholder="扫码 / 输入" @input="find" :focus="focus"> | 
 |  |  |                <uni-icons type="closeempty" size="20" color="#dadada"></uni-icons> | 
 |  |  |                <input type="text" v-model="locno" placeholder="扫码 / 输入" :focus="locnoFocus"> | 
 |  |  |                <uni-icons type="closeempty" size="20" color="#dadada" @click="remove('locno')"></uni-icons> | 
 |  |  |             </view> | 
 |  |  |          </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 type="text" v-model="matnr" placeholder="扫码 / 输入" @input="findMat" :focus="matnrFocus"> | 
 |  |  |                <uni-icons type="closeempty" size="20" color="#dadada" @click="remove('matnr')"></uni-icons> | 
 |  |  |             </view> | 
 |  |  |          </view> | 
 |  |  |       </view> | 
 |  |  | 
 |  |  |                <view><text style="width: 400rpx;">品名:{{item.maktx}}</text></view> | 
 |  |  |                <view><text style="width: 400rpx;">批号:{{item.batch}}</text></view> | 
 |  |  |                <view> | 
 |  |  |                   <text style="width: 400rpx;">数量:{{item.anfme}}</text> | 
 |  |  |                   <text style="width: 400rpx;">总数量:{{item.anfme}}</text><text style="width: 400rpx;">下架数量:{{item.qty}}</text> | 
 |  |  |                </view> | 
 |  |  |                <view> | 
 |  |  | 						 | 
 |  |  |                </view> | 
 |  |  |             </view> | 
 |  |  |             <view class="data-list-right"> | 
 |  |  | 
 |  |  |             <button class="cu-btn bg-blue " @click="comb()">下架</button> | 
 |  |  |          </label> | 
 |  |  |       </view> | 
 |  |  | 		 | 
 |  |  |       <!-- 弹窗 --> | 
 |  |  |       <!-- 修改数量 --> | 
 |  |  |       <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="changeBox"> | 
 |  |  |                <view class="num-box"> | 
 |  |  |                   <uni-number-box :value="qty" :max="9999" color="#747474"  @change="changeValue"/> | 
 |  |  |                </view>  | 
 |  |  |             </view> | 
 |  |  |             <view class="revise-box-buttom"> | 
 |  |  |                <view> | 
 |  |  |                   <button class="cu-btn bg-blue" @click="confirm()">确认</button> | 
 |  |  |                </view> | 
 |  |  |             </view> | 
 |  |  |          </view> | 
 |  |  |       </uni-popup> | 
 |  |  |    </view> | 
 |  |  |     | 
 |  |  | </template> | 
 |  |  | 
 |  |  |       data() { | 
 |  |  |           return { | 
 |  |  |             matnr: '', | 
 |  |  |             locno: '', | 
 |  |  |             locno: 'NA003', | 
 |  |  |             matList: [], | 
 |  |  |             focus:true | 
 |  |  |             locnoFocus:true, | 
 |  |  |             matnrFocus:false, | 
 |  |  |             res:'', | 
 |  |  |             qty:0 | 
 |  |  |          } | 
 |  |  |       }, | 
 |  |  |       mounted(){ | 
 |  |  |          const UIP = uni.getStorageSync('UIP'); | 
 |  |  |          this.baseIP = UIP; | 
 |  |  |          const UPORT = uni.getStorageSync('UPORT'); | 
 |  |  |          this.basePORT = UPORT | 
 |  |  |          const PROJ = uni.getStorageSync('UPROJ'); | 
 |  |  |          this.baseUrl = PROJ | 
 |  |  |          this.getUrl() | 
 |  |  |       }, | 
 |  |  |       methods: { | 
 |  |  |          // 获取url | 
 |  |  |          getUrl() { | 
 |  |  |             this.commonUrl = this.baseHttp + this.baseIP + ':' +this.basePORT + "/" +this.baseUrl | 
 |  |  |          }, | 
 |  |  |          // 搜索 | 
 |  |  |          findMat() { | 
 |  |  |             this.res = '' | 
 |  |  |             let that = this, | 
 |  |  |                url = '/mobile/mat/find/auth', | 
 |  |  |                data = {locNo: that.locno, matnr: that.matnr}, | 
 |  |  |                method = "GET"; | 
 |  |  |                that.res='' | 
 |  |  |             that.request(url,data,method); | 
 |  |  |             setTimeout(function() { | 
 |  |  |                that.res = that.res.data | 
 |  |  |                that.checkMat(that.res) | 
 |  |  |             }, 100); | 
 |  |  | 				 | 
 |  |  | 				 | 
 |  |  |          }, | 
 |  |  |          // 下架按钮 | 
 |  |  |          comb() { | 
 |  |  |             let that = this | 
 |  |  |             this.res = '' | 
 |  |  |             var offSaleParam = {} | 
 |  |  |             offSaleParam['locNo'] = 'NA002' | 
 |  |  |             offSaleParam['matnr'] = 'YJ2022081808312309' | 
 |  |  |             offSaleParam['locNo'] = this.locno | 
 |  |  |             offSaleParam['matnr'] = this.matnr | 
 |  |  |             offSaleParam['anfme'] = this.matList[0].qty | 
 |  |  |             let that = this, | 
 |  |  |                url = '/mobile/mat/offSale/auth', | 
 |  |  |                data = JSON.stringify(offSaleParam), | 
 |  |  |                method = "POST" | 
 |  |  |             that.request(url,data,method) | 
 |  |  |             setTimeout(function() { | 
 |  |  |                if(that.res.code === 200) { | 
 |  |  |                   that.resst() | 
 |  |  |                   uni.showToast({title: that.res.msg, icon: "none",position: 'top'}) | 
 |  |  |                } | 
 |  |  |             }, 100); | 
 |  |  | 				 | 
 |  |  |          }, | 
 |  |  |          revise(item,index) { | 
 |  |  |             // this.qty = this.matList[index].anfme | 
 |  |  |             this.rowNum = index | 
 |  |  |             this.eject() | 
 |  |  |          }, | 
 |  |  |          eject(type) { | 
 |  |  |             this.type = type | 
 |  |  |             // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性 | 
 |  |  |             this.$refs.revise.open(type) | 
 |  |  |          }, | 
 |  |  |          confirm() { | 
 |  |  |             this.matList[this.rowNum].qty = this.qty | 
 |  |  |             this.$refs.revise.close() | 
 |  |  |             this.$forceUpdate() // 强制刷新 | 
 |  |  |          }, | 
 |  |  |          changeValue(value) { | 
 |  |  |             this.qty = value | 
 |  |  |          }, | 
 |  |  |          // 清空input | 
 |  |  |          remove(e) { | 
 |  |  |             this[e] = '' | 
 |  |  |          }, | 
 |  |  |          // 重置按钮 | 
 |  |  |          resst() { | 
 |  |  |             this.matList = [] | 
 |  |  |             this.locno = '' | 
 |  |  |             this.matnr = '' | 
 |  |  |          }, | 
 |  |  |          // 添加商品 | 
 |  |  |          addMat(mat) { | 
 |  |  |             mat['qty'] = 0 | 
 |  |  |             this.matList.unshift(mat) | 
 |  |  |          }, | 
 |  |  |          checkMat(mat) { | 
 |  |  |             var len = this.matList.length | 
 |  |  |             var add = true | 
 |  |  |             for (var i = 0; i < len; i++) { | 
 |  |  |                if (mat.matnr == this.matList[i].matnr) { | 
 |  |  |                   this.matList[i].anfme += mat.anfme  | 
 |  |  |                   this.$forceUpdate() // 强制刷新 | 
 |  |  |                   add = false | 
 |  |  |                } | 
 |  |  |             } | 
 |  |  |             if (add) { | 
 |  |  |                mat['qty'] = 0 | 
 |  |  |                this.matList.unshift(mat) | 
 |  |  |             } | 
 |  |  |          }, | 
 |  |  |          // 通用方法 | 
 |  |  |          request(url,data,method){ | 
 |  |  |             let that = this | 
 |  |  |             uni.request({ | 
 |  |  |                url:'http://localhost:8081/lywms/mobile/mat/offSale/auth', | 
 |  |  |                data:JSON.stringify(offSaleParam), | 
 |  |  |                method:'POST', | 
 |  |  |                url: this.commonUrl + url, | 
 |  |  |                data: data, | 
 |  |  |                header:{'token':uni.getStorageSync('token')}, | 
 |  |  |                method: method, | 
 |  |  |                success(result) { | 
 |  |  |                   console.log(result); | 
 |  |  |                   var res = result.data | 
 |  |  |                   console.log(res); | 
 |  |  |                   if ( res.code === 200 ) { | 
 |  |  |                      that.res = res | 
 |  |  |                   } else if(res.code === 403) { | 
 |  |  |                      uni.showToast({title: res.msg, icon: "none", position: 'top'}) | 
 |  |  |                      setTimeout(() => { | 
 |  |  |                         uni.reLaunch({ | 
 |  |  |                            url: '../login/login' | 
 |  |  |                         }); | 
 |  |  |                      }, 1000); | 
 |  |  |                   } else { | 
 |  |  |                      console.log(res.msg); | 
 |  |  |                      uni.showToast({title: res.msg, icon: "none",position: 'top'}) | 
 |  |  |                   } | 
 |  |  | 						 | 
 |  |  |                } | 
 |  |  |             }) | 
 |  |  |          } | 
 |  |  |          }, | 
 |  |  |       } | 
 |  |  |     } | 
 |  |  | </script> | 
 |  |  |  | 
 |  |  | <style> | 
 |  |  |    @import url(@/static/css/putOnSale.css); | 
 |  |  |    .footer { | 
 |  |  |       width: 100%; | 
 |  |  |       height: 100rpx; | 
 |  |  |       line-height: 100rpx; | 
 |  |  |       background-color: #FFF; | 
 |  |  |       position: fixed; | 
 |  |  |       bottom: 0; | 
 |  |  |       border-top: 1px solid #d8d8d8; | 
 |  |  |       border-radius: 20rpx 20rpx 0 0 ; | 
 |  |  |       z-index: 1; | 
 |  |  |    } | 
 |  |  | </style> |