<template>
	<view class="home">
		<!-- <uni-notice-bar show-icon scrollable
			text="uni-app 版正式发布，开发一次，同时发布iOS、Android、H5、微信小程序、支付宝小程序、百度小程序、头条小程序等7大平台。" /> -->
		<!-- <uni-card v-for="i in userInfoData.menus" :key="i.id">
			<view class="title">
				{{i.name}}
			</view>
			<view class="menu-list-warp">
				<view class="menu-list-box" v-for="j in i.children" :key="j.id" @click="toRouter(j)">
					<image :src="'../static/' + j.icon" mode=""></image>
					<view class="">
						{{j.name}}
					</view>
				</view>
			</view>
		</uni-card> -->
		<uni-card>
			<view class="title">
				库存
			</view>
			<view class="menu-list-warp">
				<view class="menu-list-box" @click="toRouter('/submit/submit')">
					<image :src="'../static/smck.png'" mode=""></image>
					<view class="">
						异常上报
					</view>
				</view>
				<view class="menu-list-box" @click="toRouter('/usedTotal/usedTotal')" v-if="isRoom">
					<image :src="'../static/tj.png'" mode=""></image>
					<view class="">
						库存统计
					</view>
				</view>
			</view>
		</uni-card>
		<uni-card>
			<view class="title">
				出库管理
			</view>
			<view class="menu-list-warp">
				<view class="menu-list-box" @click="toRouter('/usedTotal/warehouse-list')">
					<image :src="'../static/smrk.png'" mode=""></image>
					<view class="">
						物料接收
					</view>
				</view>
				<view class="menu-list-box" @click="toRouter('/usedTotal/return-warehouse')">
					<image :src="'../static/tc.png'" mode=""></image>
					<view class="">
						物料退仓
					</view>
				</view>
				<view class="menu-list-box" @click="toRouter('/usedTotal/fabric-correction')">
					<image :src="'../static/kccx.png'" mode=""></image>
					<view class="">
						面料修正
					</view>
				</view>
				<view class="menu-list-box" @click="toRouter('/materialTransfer/materialTransfer')">
					<image :src="'../static/xcjj.png'" mode=""></image>
					<view class="">
						面料转仓
					</view>
				</view>
				<view class="menu-list-box" @click="toRouter('/materialTransfer/transferCompositeList')"  v-if="isRoom2">
					<image :src="'../static/fh.png'" mode=""></image>
					<view class="">
						转仓复核
					</view>
				</view>
				
			</view>
			
			
			
		</uni-card>
	</view>
</template>

<script>
	import {
		getInfo
	} from "@/util/api.js";
	import Vue from 'vue'
	export default {
		data() {
			return {
				userInfoData: [],
				notificationData: [],
				isRoom: false,
				isRoom2:false,
			}
		},
		onLoad() {
			// wx.requestSubscribeMessage({
			// 	tmplIds: ['Tt0C6SOrtd2QXIdLqrm0CNdarUE4LG_lNJblUnkqTPM'],
			// 	success(res) {
					
			// 	},
			// 	fail(err){
			// 		console.log(err)
			// 	}
			// })
			const v = this
			if (
				Vue.prototype.$token.role_id == '1552548151620026370' ||
				Vue.prototype.$token.role_id == '1552550790307004417' ||
				Vue.prototype.$token.role_id == '1552550978346041346') {
				this.isRoom = true
			}
			if (
				Vue.prototype.$token.role_id == '1569881723951472642' ||
				Vue.prototype.$token.role_id == '1552550978346041346' ||
				Vue.prototype.$token.role_id == '1552548151620026370') {
				this.isRoom2 = true
			}
			// v.$post('/wx/login/getUserInfo').then(res => {
			// 	v.userInfoData = res.data
			// 	Vue.prototype.$userInfo = res.data
			// 	uni.setStorage({
			// 		key: "userInfo",
			// 		data: res.data,
			// 		success(res) {

			// 		},
			// 		fail(res) {}
			// 	})
			// })
			// v.$post('/wx/message/notification',{}).then(res=>{
			// 	v.notificationData = res.data
			// })
		},
		methods: {
			toRouter(j) {
				console.log(j)
				wx.requestSubscribeMessage({
					tmplIds: ['Tt0C6SOrtd2QXIdLqrm0CNdarUE4LG_lNJblUnkqTPM'],
					success(res) {
						
					},
					fail(err){
						console.log(err)
					}
				})
				uni.navigateTo({
					url: '/pages' + j
				})
			},
		},
	}
</script>

<style lang="less">
	.menu-list-warp {
		.menu-list-box {
			width: 25%;
			text-align: center;
			float: left;
			padding: 20rpx;

			image {
				width: 100rpx;
				height: 100rpx;
			}
		}
	}
</style>
