| | |
| | | </view> |
| | | <view class="square-content"> |
| | | <view class="content-input"> |
| | | <input v-model="barcode" type="text" placeholder="扫码 / 输入" maxlength="10" |
| | | :focus="barcodeFocus" @input="barcodeInput"> |
| | | <input v-model="barcode" type="text" placeholder="扫码 / 输入" |
| | | :focus="barcodeFocus" @input="barcodeInput()" placeholder-style="line-height: 85rpx;"> |
| | | <uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons> |
| | | </view> |
| | | </view> |
| | |
| | | <view class="square-content"> |
| | | <view class="content-input-btn"> |
| | | <input v-model="matnr" type="text" placeholder="扫码 / 输入" @input="findMat()" |
| | | :focus="focus"> |
| | | :focus="focus" placeholder-style="line-height: 85rpx;"> |
| | | <uni-icons type="closeempty" size="20" color="#dadada" @click="removeMatnr()"></uni-icons> |
| | | </view> |
| | | <view class="content-btn"> |
| | |
| | | export default { |
| | | data() { |
| | | return { |
| | | commonUrl:null, |
| | | barcode: '', |
| | | barcodeFocus:true, |
| | | focus:false, |
| | |
| | | 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 |
| | | }, |
| | | // barcode input 事件 |
| | | barcodeInput() { |
| | | var len = this.barcode.length |
| | | if (len != 8) { |
| | | uni.showToast({title: '托盘码有误请重试', icon: "none", position: 'top'}); |
| | | this.barcodeFocuss() |
| | | return; |
| | | } |
| | | if (len == 8) { |
| | | this.focuss() |
| | | } |
| | | console.log(1) |
| | | // 不设置定时器 会出现扫入的字符串不全 |
| | | setTimeout(()=>{ |
| | | var len = this.barcode.length |
| | | if (len != 8) { |
| | | uni.showToast({title: '托盘码有误请重试', icon: "none", position: 'top'}); |
| | | this.barcodeFocuss() |
| | | return; |
| | | } |
| | | if (len == 8) { |
| | | this.focuss() |
| | | } |
| | | },100) |
| | | }, |
| | | // 托盘码有误重置 |
| | | barcodeFocuss() { |
| | | // #ifdef APP |
| | | let that = this; |
| | | that.barcodeFocus = false; |
| | | setTimeout(()=>{ |
| | | that.barcode = ''; |
| | | that.barcodeFocus = true; |
| | | }, 100); |
| | | // #endif |
| | | }, |
| | | // 商品光标清空重置 |
| | | focuss() { |
| | |
| | | } |
| | | uni.showLoading(); |
| | | uni.request({ |
| | | url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/comb/auth', |
| | | url: that.commonUrl + '/mobile/comb/auth', |
| | | data: JSON.stringify({ |
| | | barcode: that.barcode, |
| | | combMats: that.matList |
| | |
| | | }, |
| | | success: function(res) { |
| | | // 通过eventChannel向被打开页面传送数据 向另外一个页面传递值的 |
| | | res.eventChannel.emit('acceptDataFromOpenerPage', {baseIP:that.baseIP, basePORT:that.basePORT }) |
| | | res.eventChannel.emit('acceptDataFromOpenerPage', {commonUrl:that.commonUrl }) |
| | | }, |
| | | |
| | | }); |
| | |
| | | findMat() { |
| | | let that = this |
| | | uni.request({ |
| | | url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/auth', |
| | | url: that.commonUrl + '/mat/auth', |
| | | data: { |
| | | matnr:that.matnr |
| | | }, |
| | |
| | | // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据 |
| | | matList: function(data) { |
| | | that.matList.push(data.data) |
| | | console.log(that.matList) |
| | | }, |
| | | }, |
| | | success: function(res) { |