<template>
	<view class="cy_grid_box">
		<u-grid :col="3" :border="false">
		<!-- 	<u-grid-item @click="PagerJump(item.menuId)" v-for="item in menuList" :key="item.menuId">
				<image class="in-img" :src="item.pdaIcon" alt="">
					<view class="wk-text">{{ item.menuName}}</view>
			</u-grid-item> -->
			<u-grid-item @click="PagerJump(2094)">
						<image class="in-img" src="../../static/icon/1.png" alt="">
							<view class="wk-text">入库收货</view>
			</u-grid-item>
			<u-grid-item @click="PagerJump(2095)">
						<image class="in-img" src="../../static/icon/2.png" alt="">
							<view class="wk-text">入库验收</view>
			</u-grid-item>
			
			
			<u-grid-item @click="PagerJump(10010)">
						<image class="in-img" src="../../static/icon/5.png" alt="">
							<view class="wk-text">AGV搬运</view>
			</u-grid-item>	
			<u-grid-item @click="PagerJump(10009)">
						<image class="in-img" src="../../static/icon/6.png" alt="">
							<view class="wk-text">出库分拣</view>
			</u-grid-item>
			<u-grid-item @click="PagerJump(10015)">
						<image class="in-img" src="../../static/icon/qita.png" alt="">
							<view class="wk-text">其他入库</view>
			</u-grid-item>
			<u-grid-item @click="PagerJump(2103)">
						<image class="in-img" src="../../static/icon/3.png" alt="">
							<view class="wk-text">库存查询</view>
			</u-grid-item>
			<u-grid-item @click="PagerJump(2102)">
						<image class="in-img" src="../../static/icon/10.png" alt="">
							<view class="wk-text">盘点录入</view>
			</u-grid-item>
			<u-grid-item @click="PagerJump(10016)">
						<image class="in-img" src="../../static/icon/shifang.png" alt="">
							<view class="wk-text">点位释放</view>
			</u-grid-item>
			<!-- 	<u-grid-item @click="PagerJump(10076)">
						<image class="in-img" src="../../static/icon/icon_94vo0bbzuhq/ruku.png" alt="">
							<view class="wk-text">人工入库</view>
				</u-grid-item>
				<u-grid-item @click="PagerJump(10077)">
						<image class="in-img" src="../../static/icon/icon_94vo0bbzuhq/chukuguanli-copy.png" alt="">
							<view class="wk-text">更换台车物料</view>
				</u-grid-item>	
				<u-grid-item @click="PagerJump(10079)">
						<image class="in-img" src="../../static/icon/icon_94vo0bbzuhq/navicon-pdd-copy.png" alt="">
							<view class="wk-text">盘点执行</view>
				</u-grid-item> -->
		</u-grid>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				menuList: []
			}
		},
		onLoad() {
			// 获取菜单信息
			this.getMenuInfo()
		},
		async onShow() {

		},
		methods: {
			getMenuInfo() {
				this.$u.api.getMenuInfo().then((res)=>{
					if(res.code===200) {
						this.menuList = res.data
					} else {
						this.$u.toast(res.msg);
					}
				})	
			},
			checkOutPick(params) {
				this.$u.api.pickingManage.checkOutPick(params).then(res => {
					if(res.code===200) {
						//  进入索取页面
						if(res.data.pickType===200) {
							// 零货
							if(params.taskType===0) {
								this.$u.route({
									url: 'pages/smallStore/index',
									type: 'navigateTo',
									params: {
										list: JSON.stringify(res.data.taskStaticList)
									}
								})
							}
							// 整件
							if(params.taskType===1) {
								this.$u.route({
									url: 'pages/allPiece/index',
									type: 'navigateTo',
									params: {
										list: JSON.stringify(res.data.taskStaticList)
									}
								})
							}
							// 整散合一
							if(params.taskType===2) {
								this.$u.route({
									url: 'pages/dispersion/index',
									type: 'navigateTo',
									params: {
										list: JSON.stringify(res.data.taskStaticList)
									}
								})
							}
							
						}
						//进入拣货页面
						if(res.data.pickType===800) {
							// 零货
							if(params.taskType===0) {
								this.$u.route({
									url: 'pages/smallStore/picking',
									type: 'navigateTo',
									params: {
										list: JSON.stringify(res.data.businOutPickDTaskVo),
										container: JSON.stringify(res.data.containrList)
									}
								})
							}
							// 整件
							if(params.taskType===1) {
								this.$u.route({
									url: 'pages/allPiece/picking',
									type: 'navigateTo',
									params: {
										list: JSON.stringify(res.data.businOutPickDTaskVo)
									}
								})
							}
							// 整散合一
							if(params.taskType===2) {
								this.$u.route({
									url: 'pages/dispersion/picking',
									type: 'navigateTo',
									params: {
										list: JSON.stringify(res.data.businOutPickDTaskVo),
										container: JSON.stringify(res.data.containrList)
									}
								})
							}
						}
						// 进入绑定周转箱页面
						if(res.data.pickType===801) {
							// 零货
							if(params.taskType===0) {
								this.$u.route({
									url: 'pages/smallStore/bind',
									type: 'navigateTo',
									params: {
										list: JSON.stringify(res.data.taskAndContainerList)
									}
								})
							}
							// 整件
							// if(params.taskType===1) {
							// 	this.$u.route({
							// 		url: 'pages/allPiece/bind',
							// 		type: 'navigateTo',
							// 		params: {
							// 			list: res.data.taskAndContainerList
							// 		}
							// 	})
							// }
							// 整散合一
							if(params.taskType===2) {
								this.$u.route({
									url: 'pages/dispersion/bind',
									type: 'navigateTo',
									params: {
										list: JSON.stringify(res.data.taskAndContainerList)
									}
								})
							}
						}
					} else {
						this.$u.toast(res.msg);
					}
					
				});
			},
			// 页面跳转
			PagerJump(PagerJump) {

				this.PagerJumpType = PagerJump // 将页面类型
				// 防抖
				// debounce(func, wait = 500, immediate = false)
				// func <Function> 触发回调执行的函数
				// wait <Number> 时间间隔，单位ms
				// immediate <Number> 在开始还是结束处触发，如非特殊情况，一般默认为false即可
				this.$u.debounce(this.toNext, 500) // 
			},
			// 防抖回调执行的函数
			toNext() {
				if (this.PagerJumpType === 2094) { // 入库收货
					this.$u.route({
						url: 'pages/receive/index',
						type: 'navigateTo',
					})
				} else if (this.PagerJumpType === 2095) { //入库验收
					this.$u.route({
						url: 'pages/checkAccept/index',
						type: 'navigateTo',
					})
				} else if (this.PagerJumpType === 2096) { //入库上架
					this.$u.route({
						url: 'pages/onShelf/index',
						type: 'navigateTo',
					})
				} else if (this.PagerJumpType === 2097) { //零货拣货
					this.checkOutPick({
						taskType: 0
					})
				} else if (this.PagerJumpType === 2098) { //整件拣货
					this.checkOutPick({
						taskType: 1
					})
				} else if (this.PagerJumpType === 2099) { //整散拣货
					this.checkOutPick({
						taskType: 2
					})
				} else if (this.PagerJumpType === 2100) { //复核出库
					this.$u.route({
						url: 'pages/toReview/index',
						type: 'navigateTo',
					})
				} else if (this.PagerJumpType === 2101) { //补货上架
					this.$u.route({
						url: 'pages/replenishment/index',
						type: 'navigateTo',
					})
				} else if (this.PagerJumpType === 2102) { //盘点计划
					this.$u.route({
						url: 'pages/inventory/index',
						type: 'navigateTo',
					})
				} else if (this.PagerJumpType === 2103) { //库存查询
					this.$u.route({
						url: 'pages/stock/index',
						type: 'navigateTo',
					})
				} else if (this.PagerJumpType === 2104) { //货位调整
					this.$u.route({
						url: 'pages/cargoLocation/index',
						type: 'navigateTo',
					})
				}else if (this.PagerJumpType === 10008) { //AGV上架
					this.$u.route({
						url: 'pages/AvgOnShelf/index',
						type: 'navigateTo',
					})
				}else if (this.PagerJumpType === 10009) { //AGV拣货
					this.$u.route({
						url: 'pages/AvgOrderPkg/index',
						type: 'navigateTo',
					})
				}else if (this.PagerJumpType === 10010) { //AGV搬运
					this.$u.route({
						url: 'pages/AvgCarry/index',
						type: 'navigateTo',
					})
				}else if(this.PagerJumpType === 10014){//缓存墙上架
					this.$u.route({
						url: 'pages/cache/index',
						type: 'navigateTo',
					})
				}else if(this.PagerJumpType === 10015){//其他入库
					this.$u.route({
						url: 'pages/payInto/index',
						type: 'navigateTo',
					})
				}else if(this.PagerJumpType === 10016){//点位释放
					this.$u.route({
						url: 'pages/release/index',
						type: 'navigateTo',
					})
				}
			},
		}
	}
</script>
<style lang="scss">
	@import "index.scss";
</style>
