编写登录页面,首页面,入库页面,样式修改,扫码功能实现
This commit is contained in:
89
components/pda-scan-input/index.vue
Normal file
89
components/pda-scan-input/index.vue
Normal file
@@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<view class="input-box">
|
||||
<input :adjust-position="false" :focus="isFocus" type="text" v-model="search" @confirm="getInfo" @blur="isFocus = true" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getWareHouseProfile } from '@/api/warehouse/warehose.js';
|
||||
export default {
|
||||
name: 'pda-scan-input',
|
||||
props: {
|
||||
type: {
|
||||
default: 1,
|
||||
type: Number
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isFocus: true,
|
||||
search: 'A-001',
|
||||
// 扫码枪扫码后查询结果,获取信息
|
||||
searchInfo: null,
|
||||
time: null
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
isFocus(n) {}
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.time) {
|
||||
clearInterval(this.time);
|
||||
this.time = null;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 初始化
|
||||
init() {
|
||||
this.time = setInterval(() => {
|
||||
if (!this.isFocus) {
|
||||
this.$nextTick(function () {
|
||||
this.isFocus = true;
|
||||
});
|
||||
}
|
||||
}, 1);
|
||||
},
|
||||
// 传输数据
|
||||
emitInputChange(data) {
|
||||
this.$emit('getInfo', data, type);
|
||||
},
|
||||
getInfo() {
|
||||
if (type === 1) {
|
||||
//TODO 获取仓库信息
|
||||
const data = {
|
||||
warehouse_num: this.search
|
||||
};
|
||||
getWareHouseProfile(data).then((res) => {
|
||||
if (res.code !== 200) {
|
||||
uni.showToast({ title: '获取仓库信息异常', icon: 'none' });
|
||||
}
|
||||
this.searchInfo = res.data;
|
||||
this.emitInputChange(res.data);
|
||||
});
|
||||
} else if (type === 2) {
|
||||
//TODO 获取物料信息
|
||||
this.emitInputChange(res.data);
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.search = '';
|
||||
this.isFocus = false;
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.input-box {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
/* height: 0px; */
|
||||
/* opacity: 0; */
|
||||
/* visibility: hidden; */
|
||||
/* display:none; */
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user