<template>
	<view class="content background">
		<view class="title-box">道安WMS-PDA扫码</view>
		<view class="grid-box">
			<uni-grid :column="3" @change="gridCheck" :showBorder="false" :highlight="false">
				<uni-grid-item v-for="(item, index) in gridItemList" :index="index + 1">
					<view class="item">
						<uni-icons :type="item.icon" :size="48" color="#777" />
						<text class="text">{{ item.name }}</text>
					</view>
				</uni-grid-item>
			</uni-grid>
		</view>
		<!-- 扫描操作 -->
		<!-- <view>
			<PdaScanInput @getInfo="handleWareHouseChange"></PdaScanInput>
		</view> -->
	</view>
</template>

<script>
export default {
	data() {
		return {
			gridItemList: [
				{ name: '入库', icon: 'download-filled' },
				{ name: '出库', icon: 'upload-filled' },
				{ name: '盘点', icon: 'wallet-filled' },
				{ name: '移库', icon: 'cart-filled' },
				{ name: '退库', icon: 'undo-filled' },
				{ name: '拼箱', icon: 'folder-add-filled' },
				{ name: '拆箱', icon: 'folder-add-filled' },
				{ name: '货物查看', icon: 'eye-filled' },
				{ name: '入库记录', icon: 'list' },
				{ name: '出库记录', icon: 'list' }
			]
		};
	},
	onLoad: function () {},
	mounted() {
		// setInterval(function () {
		// 	uni.hideKeyboard(); //隐藏软键盘
		// 	// plus.key.hideSoftKeybord();
		// }, 60);
	},

	methods: {
		gridCheck(item) {
			const index = item.detail?.index;
			switch (index) {
				case 1:
					uni.navigateTo({
						url: '/pages/inWarehouse/inWarehouse'
					});
					break;
				case 2:
					uni.navigateTo({
						url: '/pages/outWarehouse/outWarehouse'
					});
					break;
				case 3:
					uni.navigateTo({
						url: '/pages/stocktake/stocktake'
					});
					break;
				case 4:
					uni.navigateTo({
						url: '/pages/relocation/relocation'
					});
					break;
				case 5:
					uni.navigateTo({
						url: '/pages/returnWarehose/returnWarehose'
					});
					break;
				case 6:
					//TODO 拼箱
					// uni.navigateTo({
					// 	url: '/pages/returnWarehose/returnWarehose'
					// });
					break;
				case 7:
					// 货物查看
					// uni.navigateTo({
					// 	url: '/pages/returnWarehose/returnWarehose'
					// });
					break;
				case 8:
					// 货物查看
					// uni.navigateTo({
					// 	url: '/pages/returnWarehose/returnWarehose'
					// });
					break;
				case 9:
					// 货物查看
					// uni.navigateTo({
					// 	url: '/pages/returnWarehose/returnWarehose'
					// });
					break;
				default:
					break;
			}
		},
		handleWareHouseChange(data) {
			uni.showToast({
				title: '扫描成功',
				icon: 'success'
			});
			// console.log('handleWareHouseChange', data);
		}
	}
};
</script>

<style scoped>
.background {
	/* background-color: #4671d5; */
}
.title-box {
	width: 100%;
	height: 80px;
	margin-bottom: 10px;
	font-size: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
}
.grid-box {
	width: 100%;
	height: 100%;
}
.grid-box .item {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}
.text {
	font-size: 24px;
}
</style>
