| | |
| | | <view class="square-content"> |
| | | <view class="content-input"> |
| | | <input v-model="barcode" type="text" placeholder="扫码 / 输入" placeholder-style="margin-top:10px" maxlength="10" |
| | | :focus="barcodeFocus" @input="barcodeInput"> |
| | | :focus="barcodeFocus" @confirm="barcodeInput()"> |
| | | <uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons> |
| | | </view> |
| | | </view> |
| | |
| | | methods: { |
| | | // 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() |
| | | } |
| | | // 不设置定时器 会出现扫入的字符串不全 |
| | | 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() { |