木箱不允许输入
This commit is contained in:
88
components/SearchBoxMx.vue
Normal file
88
components/SearchBoxMx.vue
Normal file
@@ -0,0 +1,88 @@
|
||||
<template>
|
||||
<view class="search_wraper">
|
||||
<slot></slot>
|
||||
<view class="buttons_wraper">
|
||||
<view class="iconfont icon_del" @tap="toDel"></view>
|
||||
<view class="iconfont icon_scan" :class="{'icon_scan_active': focused === true}" @tap="toScan"></view>
|
||||
<view class="iconfont icon_phone" @tap="toPhone"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import permision from "@/utils/permission.js"
|
||||
export default {
|
||||
props: {
|
||||
focused: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toDel () {
|
||||
this.$emit('inputDel')
|
||||
},
|
||||
toScan () {
|
||||
this.$emit('inputScan', '')
|
||||
},
|
||||
async toPhone() {
|
||||
// #ifdef APP-PLUS
|
||||
let status = await this.checkPermission();
|
||||
if (status !== 1) {
|
||||
return;
|
||||
}
|
||||
// #endif
|
||||
uni.scanCode({
|
||||
success: (res) => {
|
||||
this.$emit('toPhone', res.result)
|
||||
},
|
||||
fail: (err) => {
|
||||
// uni.showToast({
|
||||
// title: '出错',
|
||||
// icon: 'none'
|
||||
// })
|
||||
}
|
||||
});
|
||||
}
|
||||
// #ifdef APP-PLUS
|
||||
,
|
||||
async checkPermission(code) {
|
||||
let status = permision.isIOS ? await permision.requestIOS('camera') :
|
||||
await permision.requestAndroid('android.permission.CAMERA');
|
||||
|
||||
if (status === null || status === 1) {
|
||||
status = 1;
|
||||
} else {
|
||||
uni.showModal({
|
||||
content: "需要相机权限",
|
||||
confirmText: "设置",
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
permision.gotoAppSetting();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
return status;
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus">
|
||||
@import '../common/style/mixin.styl';
|
||||
.search_wraper
|
||||
position relative
|
||||
_wh(100%, 70rpx)
|
||||
.search_input
|
||||
padding-right: 160rpx;
|
||||
.buttons_wraper
|
||||
position absolute
|
||||
top 0
|
||||
right 10rpx
|
||||
_wh(auto, 70rpx)
|
||||
_fj(flex-end)
|
||||
.icon_scan_active
|
||||
color $red
|
||||
</style>
|
||||
@@ -8,11 +8,9 @@
|
||||
<span class="filter_label">木箱</span>
|
||||
</view>
|
||||
<view class="filter_input_wraper">
|
||||
<search-box
|
||||
v-model="val1"
|
||||
:focused="true"
|
||||
@handleChange="handleChange"
|
||||
/>
|
||||
<search-box-mx :focused="focused" @inputDel="inputDel" @inputScan="inputScan" @toPhone="toPhone">
|
||||
<input type="text" v-model="val1" class="filter_input search_input" :focus="focused" @input="onKeyInput($event)" @blur="onBlur" @focus="focused = true">
|
||||
</search-box-mx>
|
||||
</view>
|
||||
</view>
|
||||
<view class="filter_item">
|
||||
@@ -71,11 +69,14 @@
|
||||
<script>
|
||||
import NavBar from '@/components/NavBar.vue'
|
||||
import SearchBox from '@/components/SearchBox.vue'
|
||||
import SearchBoxMx from '@/components/SearchBoxMx.vue'
|
||||
import permision from "@/utils/permission.js"
|
||||
import {boxQuery, stConfirm, stPrint} from '@/utils/getData2.js'
|
||||
export default {
|
||||
components: {
|
||||
NavBar,
|
||||
SearchBox
|
||||
SearchBox,
|
||||
SearchBoxMx
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -84,17 +85,20 @@
|
||||
isV: '0',
|
||||
dataList: [],
|
||||
disabled: false,
|
||||
disabled1: false
|
||||
disabled1: false,
|
||||
focused: true
|
||||
};
|
||||
},
|
||||
mounted () {
|
||||
setTimeout(() => {
|
||||
uni.hideKeyboard()
|
||||
}, 500)
|
||||
},
|
||||
methods: {
|
||||
/** 虚拟库 */
|
||||
isVirtual () {
|
||||
this.isV = this.isV === '0' ? '1' : '0'
|
||||
},
|
||||
handleChange (e) {
|
||||
this._boxQuery(e)
|
||||
},
|
||||
/** 初始化查询 */
|
||||
async _boxQuery (e) {
|
||||
let res = await boxQuery(e, '2')
|
||||
@@ -141,6 +145,32 @@
|
||||
} catch (e) {
|
||||
this.disabled1 = false
|
||||
}
|
||||
},
|
||||
onKeyInput ($event) {
|
||||
if ($event.target.value.length < 5) {
|
||||
this.$nextTick(function(){
|
||||
this.val1 = ''
|
||||
uni.hideKeyboard()
|
||||
})
|
||||
return
|
||||
}
|
||||
this._boxQuery(this.val1)
|
||||
},
|
||||
onBlur () {
|
||||
this.focused = false
|
||||
},
|
||||
inputDel () {
|
||||
this.val1 = ''
|
||||
},
|
||||
inputScan () {
|
||||
this.focused = true
|
||||
setTimeout(() => {
|
||||
uni.hideKeyboard()
|
||||
}, 300)
|
||||
},
|
||||
toPhone (e) {
|
||||
this.val1 = e
|
||||
this._boxQuery(this.val1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,9 @@
|
||||
<span class="filter_label">木箱</span>
|
||||
</view>
|
||||
<view class="filter_input_wraper">
|
||||
<search-box
|
||||
v-model="val1"
|
||||
:focused="true"
|
||||
@handleChange="handleChange"
|
||||
/>
|
||||
<search-box-mx :focused="focused" @inputDel="inputDel" @inputScan="inputScan" @toPhone="toPhone">
|
||||
<input type="text" v-model="val1" class="filter_input search_input" :focus="focused" @input="onKeyInput($event)" @blur="onBlur" @focus="focused = true">
|
||||
</search-box-mx>
|
||||
</view>
|
||||
</view>
|
||||
<view class="filter_item">
|
||||
@@ -71,11 +69,13 @@
|
||||
<script>
|
||||
import NavBar from '@/components/NavBar.vue'
|
||||
import SearchBox from '@/components/SearchBox.vue'
|
||||
import SearchBoxMx from '@/components/SearchBoxMx.vue'
|
||||
import {boxQuery, stConfirm, stPrint} from '@/utils/getData2.js'
|
||||
export default {
|
||||
components: {
|
||||
NavBar,
|
||||
SearchBox
|
||||
SearchBox,
|
||||
SearchBoxMx
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -84,17 +84,20 @@
|
||||
isV: '0',
|
||||
dataList: [],
|
||||
disabled: false,
|
||||
disabled1: false
|
||||
disabled1: false,
|
||||
focused: true
|
||||
};
|
||||
},
|
||||
mounted () {
|
||||
setTimeout(() => {
|
||||
uni.hideKeyboard()
|
||||
}, 500)
|
||||
},
|
||||
methods: {
|
||||
/** 虚拟库 */
|
||||
isVirtual () {
|
||||
this.isV = this.isV === '0' ? '1' : '0'
|
||||
},
|
||||
handleChange (e) {
|
||||
this._boxQuery(e)
|
||||
},
|
||||
/** 初始化查询 */
|
||||
async _boxQuery (e) {
|
||||
let res = await boxQuery(e, '4')
|
||||
@@ -141,6 +144,32 @@
|
||||
} catch (e) {
|
||||
this.disabled1 = false
|
||||
}
|
||||
},
|
||||
onKeyInput ($event) {
|
||||
if ($event.target.value.length < 5) {
|
||||
this.$nextTick(function(){
|
||||
this.val1 = ''
|
||||
uni.hideKeyboard()
|
||||
})
|
||||
return
|
||||
}
|
||||
this._boxQuery(this.val1)
|
||||
},
|
||||
onBlur () {
|
||||
this.focused = false
|
||||
},
|
||||
inputDel () {
|
||||
this.val1 = ''
|
||||
},
|
||||
inputScan () {
|
||||
this.focused = true
|
||||
setTimeout(() => {
|
||||
uni.hideKeyboard()
|
||||
}, 300)
|
||||
},
|
||||
toPhone (e) {
|
||||
this.val1 = e
|
||||
this._boxQuery(this.val1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,9 @@
|
||||
<span class="filter_label">木箱</span>
|
||||
</view>
|
||||
<view class="filter_input_wraper">
|
||||
<search-box
|
||||
v-model="val1"
|
||||
:focused="true"
|
||||
@handleChange="handleChange"
|
||||
/>
|
||||
<search-box-mx :focused="focused" @inputDel="inputDel" @inputScan="inputScan" @toPhone="toPhone">
|
||||
<input type="text" v-model="val1" class="filter_input search_input" :focus="focused" @input="onKeyInput($event)" @blur="onBlur" @focus="focused = true">
|
||||
</search-box-mx>
|
||||
</view>
|
||||
</view>
|
||||
<view class="filter_item">
|
||||
@@ -76,11 +74,13 @@
|
||||
<script>
|
||||
import NavBar from '@/components/NavBar.vue'
|
||||
import SearchBox from '@/components/SearchBox.vue'
|
||||
import SearchBoxMx from '@/components/SearchBoxMx.vue'
|
||||
import {boxQuery, stConfirm} from '@/utils/getData2.js'
|
||||
export default {
|
||||
components: {
|
||||
NavBar,
|
||||
SearchBox
|
||||
SearchBox,
|
||||
SearchBoxMx
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -89,19 +89,23 @@
|
||||
val3: '',
|
||||
isV: '0',
|
||||
dataList: [],
|
||||
disabled: false
|
||||
disabled: false,
|
||||
focused: true
|
||||
};
|
||||
},
|
||||
mounted () {
|
||||
setTimeout(() => {
|
||||
uni.hideKeyboard()
|
||||
}, 500)
|
||||
},
|
||||
methods: {
|
||||
/** 虚拟库 */
|
||||
isVirtual () {
|
||||
this.isV = this.isV === '0' ? '1' : '0'
|
||||
},
|
||||
handleChange (e) {
|
||||
this._boxQuery(e)
|
||||
},
|
||||
/** 初始化查询 */
|
||||
async _boxQuery (e) {
|
||||
console.log(11)
|
||||
let res = await boxQuery(e, '3')
|
||||
this.dataList = [...res.data]
|
||||
},
|
||||
@@ -127,6 +131,32 @@
|
||||
} catch (e) {
|
||||
this.disabled = false
|
||||
}
|
||||
},
|
||||
onKeyInput ($event) {
|
||||
if ($event.target.value.length < 5) {
|
||||
this.$nextTick(function(){
|
||||
this.val1 = ''
|
||||
uni.hideKeyboard()
|
||||
})
|
||||
return
|
||||
}
|
||||
this._boxQuery(this.val1)
|
||||
},
|
||||
onBlur () {
|
||||
this.focused = false
|
||||
},
|
||||
inputDel () {
|
||||
this.val1 = ''
|
||||
},
|
||||
inputScan () {
|
||||
this.focused = true
|
||||
setTimeout(() => {
|
||||
uni.hideKeyboard()
|
||||
}, 300)
|
||||
},
|
||||
toPhone (e) {
|
||||
this.val1 = e
|
||||
this._boxQuery(this.val1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,9 @@
|
||||
<span class="filter_label">木箱</span>
|
||||
</view>
|
||||
<view class="filter_input_wraper">
|
||||
<search-box
|
||||
v-model="val1"
|
||||
:focused="true"
|
||||
@handleChange="handleChange"
|
||||
/>
|
||||
<search-box-mx :focused="focused" @inputDel="inputDel" @inputScan="inputScan" @toPhone="toPhone">
|
||||
<input type="text" v-model="val1" class="filter_input search_input" :focus="focused" @input="onKeyInput($event)" @blur="onBlur" @focus="focused = true">
|
||||
</search-box-mx>
|
||||
</view>
|
||||
</view>
|
||||
<view class="filter_item">
|
||||
@@ -70,11 +68,13 @@
|
||||
<script>
|
||||
import NavBar from '@/components/NavBar.vue'
|
||||
import SearchBox from '@/components/SearchBox.vue'
|
||||
import SearchBoxMx from '@/components/SearchBoxMx.vue'
|
||||
import {boxQuery, stConfirm} from '@/utils/getData2.js'
|
||||
export default {
|
||||
components: {
|
||||
NavBar,
|
||||
SearchBox
|
||||
SearchBox,
|
||||
SearchBoxMx
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -82,17 +82,20 @@
|
||||
val2: '',
|
||||
isV: '0',
|
||||
dataList: [],
|
||||
disabled: false
|
||||
disabled: false,
|
||||
focused: true
|
||||
};
|
||||
},
|
||||
mounted () {
|
||||
setTimeout(() => {
|
||||
uni.hideKeyboard()
|
||||
}, 500)
|
||||
},
|
||||
methods: {
|
||||
/** 虚拟库 */
|
||||
isVirtual () {
|
||||
this.isV = this.isV === '0' ? '1' : '0'
|
||||
},
|
||||
handleChange (e) {
|
||||
this._boxQuery(e)
|
||||
},
|
||||
/** 初始化查询 */
|
||||
async _boxQuery (e) {
|
||||
let res = await boxQuery(e, '1')
|
||||
@@ -120,6 +123,32 @@
|
||||
} catch (e) {
|
||||
this.disabled = false
|
||||
}
|
||||
},
|
||||
onKeyInput ($event) {
|
||||
if ($event.target.value.length < 5) {
|
||||
this.$nextTick(function(){
|
||||
this.val1 = ''
|
||||
uni.hideKeyboard()
|
||||
})
|
||||
return
|
||||
}
|
||||
this._boxQuery(this.val1)
|
||||
},
|
||||
onBlur () {
|
||||
this.focused = false
|
||||
},
|
||||
inputDel () {
|
||||
this.val1 = ''
|
||||
},
|
||||
inputScan () {
|
||||
this.focused = true
|
||||
setTimeout(() => {
|
||||
uni.hideKeyboard()
|
||||
}, 300)
|
||||
},
|
||||
toPhone (e) {
|
||||
this.val1 = e
|
||||
this._boxQuery(this.val1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user