<template>
	<view class="login-container">
		<view class="index-up">
			<image class="index-up-img" src="https://www.focusnu.com/media/directive/index/indexgif.gif" mode="widthFix"
				lazy-load="false" />
		</view>
		<model :show="show" @close="show=false" :content="content" />
		<swiper style="width: 100%;position: fixed;bottom: 0;left: 0;" :duration="150" :style="{minHeight: `100vh`}"
			:current="which" @change="swiperchange">

			<view v-for="(item,index) in menuArray" :key="index">
				<swiper-item>
					<view class="white-content-father">
						<view class="chuo-ball" @click="loadingData" v-if="item.applyStatus==`1`">
							<image class="ball-img"
								:src=" `https://www.focusnu.com/media/directive/index/refresh.png`" />
						</view>
						<view class="white-content" v-if="item.applyStatus==`1`">
							<image class="white-content-img"
								:src="`https://www.focusnu.com/media/directive/index/${statusarray[Number(item.applyStatus) - 1]}.png`"
								lazy-load="false" />
							<view class="white-font">
								您提交的

							</view>
							<view class="second-font">
								<text>
									"{{item.comName}}"
								</text>
							</view>
							<view class="second-font">
								入驻申请
								<text style="color: #fa8622;">
									正在审核中
								</text>
							</view>
							<!-- <view class="card-font" style="margin-top: 350rpx;">
								{{item.departName}}
							</view>
							<view class="gray-font">
								{{ item.comLegalPerson }} | {{ item.tel }} | {{ item.orgPropertyType }} | {{ item.orgBuildingArea + 'm²' }}
							</view>
							<view class="gray-bgc">
								
							
								<view style="color: #999999;z-index: 1;font-size: 30rpx;width: 100%;">
									{{item.comRegisterAddress}}
								</view>
							</view> -->
							<view class="button-blue" @click="look(item)">
								查看
							</view>
						</view>

						<view class="white-content" v-if="item.applyStatus==`3`">
							<image class="white-content-img"
								:src="`https://www.focusnu.com/media/directive/index/${statusarray[Number(item.applyStatus) - 1]}.png`"
								lazy-load="false" />

							<view class="white-font">
								您提交的

							</view>
							<view class="second-font">
								<text>
									"{{item.comName}}"
								</text>
							</view>
							<view class="second-font">
								入驻申请
								<text style="color: #eb2b59;">
									审核不通过
								</text>
							</view>
							<!-- <view class="card-font" style="margin-top: 350rpx;">
								{{item.departName}}
							</view>
							<view class="gray-font">
								{{ item.comLegalPerson }} | {{ item.tel }} | {{ item.orgPropertyType }} | {{ item.orgBuildingArea + 'm²' }}
							</view>
							<view class="gray-bgc">
								
							
								<view style="color: #999999;z-index: 1;font-size: 27rpx;width: 100%;">
									{{item.comRegisterAddress}}
								</view>
							</view> -->
							<view class="button-blue-spec" @click="again(item)">
								重新申请
							</view>
							<!-- <view class="button-white-spec" @click="jumptolist(item.content)">
								驳回原因
							</view> -->
						</view>

						<view style="z-index: 1;width: 100%;" v-if="item.applyStatus==`2`">
							<view class="zhiling-box">
								<view class="">
									暂无指令
								</view>
								<image class="zhiling-img" v-show="false"
									src="https://www.focusnu.com/media/directive/index/mine/more.png" />
							</view>
							<view class="white-box-father">
								<view v-for="(item,index) in buttonArray" :key="index" class="white-box">
									<image class="box-img"
										:src="`https://www.focusnu.com/media/directive/index/addstaff/${index}.png`" />
									<view class="box-font">{{item}}</view>

								</view>
								<view class="white-box">
									<view style="font-weight: 600;font-size: 80rpx;">+</view>
								</view>
							</view>
						</view>

					</view>

					<view class="zhiling-box" v-if="item.applyStatus==`-1`">
						<view style="display: flex;">
							<view class="">
								护理机构A邀请您加入，
							</view>
							<view style="color: #007FFF;">
								点击查看
							</view>

						</view>
						<view style="display: flex;align-items: center;">
							<view style="color: #999999;margin-right: 5rpx;">
								更多
							</view>
							<image class="zhiling-img"
								src="https://www.focusnu.com/media/directive/index/mine/more.png" />
						</view>

					</view>

					<view class="white-content" style="margin: 0 auto;margin-top: 30rpx;height: 600rpx;"
						v-if="item.applyStatus==`-1`">
						<view style="display: flex;width: 100%;margin-top: 30rpx;align-items: center;">
							<view class="blue-shu"></view>
							<view class="blue-font">
								入驻护理机构
							</view>

						</view>
						<image class="white-content-secondimg"
							src="https://www.focusnu.com/media/directive/index/addstaff/staff.png" lazy-load="false" />
						<view class="button-blue" @click="searchjigou()">
							入驻机构
						</view>
					</view>



					<view class="white-content-father-time" v-if="item.applyStatus==`2`">
						<view class="white-content" style="background-color: transparent;">
							<view class="white-bgc">
								长春市朝阳区久泰开运养老服务有限公司
							</view>

						</view>
					</view>
				</swiper-item>
			</view>
		</swiper>


		<view
			style="z-index:999;position: fixed;bottom: 70rpx; width: 100%;display: flex;justify-content: center;margin-top: -25rpx;height: 100rpx;">
			<view class="jia-box">
				<view v-for="(item,index) in menuArray" :key="index" @click="changecard(index)">
					<view :class="whichMenu==index? `black-box` :`gray-box`" v-if="index != menuArray.length - 1">
					</view>
					<view class="jia" @click="moveend" v-if="index == menuArray.length - 1">
						<image class="jia-img" :src="`https://www.focusnu.com/media/directive/index/bluejia.png`" />
					</view>
				</view>
			</view>
		</view>
		<downMenu :itemTarget="0" />
	</view>
</template>

<script setup>
	import {
		reactive,
		ref,
		onMounted,
		onUnmounted
	} from 'vue';
	import {
		onLoad,
		onShow
	} from '@dcloudio/uni-app';
	import {
		getMessageList
	} from '@/pages/addstaff/api/addjigou.js'
	import {
		getIndex
	} from './api.js'
	import request from '@/request/index.js'
	import downMenu from '@/compontent/public/yuangongdownmenu.vue'
	import model from "@/compontent/public/model.vue"

	const show = ref(false);

	const content = ref("");

	const buttonArray = ref(["技能培训", "考勤排班", "每日工作", "员工功能", "员工功能", "员工功能", "员工功能"])
	const statusarray = ["loading", "success", "fail"]
	const which = ref(0);

	const searchjigou = () => {
		uni.navigateTo({
			url: "/pages/yuangongindex/searchjigou"
		})
	}

	const clearvalue = () => {
		supervalue.value = ""
	}

	const changecard = (e) => {
		which.value = e
		whichMenu.value = which.value

	}
	const moveend = () => {
		which.value = menuArray.value.length
		whichMenu.value = which.value
	}
	const addjigou = () => {
		uni.setStorageSync('specicalid', "");
		uni.setStorageSync("baddata", "")
		uni.setStorageSync("backhuancun", {})
		uni.navigateTo({
			url: `/pages/addjigou/name`
		});
	}
	// const jumpToAll = (element) => {
	// 	console.log("????",element.applyStatus)
	// 	uni.getStorage({
	// 		key: 'openid',
	// 		success: function(res) {
	// 			getMessageList(res.data).then(res => {
	// 				if (res.success) {
	// 					uni.navigateTo({
	// 						url: `/pages/addstaff/all?element=${JSON.stringify(res.result[0])}&applyStatus=${element.applyStatus}`
	// 					});
	// 				}

	// 			})
	// 		}
	// 	});
	// }
	const look = (element) => {
		uni.navigateTo({
			url: `/pages/yuangongindex/workjoin`
		});
		// uni.getStorage({
		// 	key: 'openid',
		// 	success: function(res) {
		// 		getMessageList(res.data).then(res => {
		// 			if (res.success) {
		// 				uni.navigateTo({
		// 					url: `/pages/addstaff/all?element=${JSON.stringify(res.result[0])}&applyStatus=${element.applyStatus}`
		// 				});
		// 			}

		// 		})
		// 	}
		// });
	}

	const jumptolist = (res) => {
		if (res) {
			content.value = res;
			show.value = true
		}
	}

	const again = (item) => {
		uni.navigateTo({
			url: "/pages/yuangongindex/searchjigou"
		})
		// uni.getStorage({
		// 	key: 'openid',
		// 	success: function(res) {
		// 		getMessageList(res.data).then(res => {
		// 			if (res.success) {
		// 				uni.setStorageSync("baddata", res.result[0])
		// 				uni.setStorageSync('specicalid', res.result[0].id);
		// 				uni.setStorageSync("backhuancun", {})
		// 				uni.navigateTo({
		// 					url: `/pages/addstaff/information`
		// 				});
		// 			}

		// 		})
		// 	}
		// });
	}
	const jumpTo = () => {
		uni.navigateTo({
			url: `/pages/login/index`
		});
	}

	const whichMenu = ref(0);
	const swiperchange = (res) => {
		whichMenu.value = res.detail.current
		which.value = res.detail.current
	}


	const gotoWindy = () => {
		uni.navigateTo({
			url: "/pages/selectunit/map"
		});

	}

	const goback = () => {
		uni.navigateBack()
	}

	onMounted(async () => {

	})

	onUnmounted(() => {})
	const menuArray = ref([])
	const loadingData = () => {
		uni.getStorage({
			key: 'openid',
			success: function(res) {
				getIndex(res.data).then(res => {
					// console.log("????",res)
					menuArray.value = res.result
					menuArray.value.push({
						applyStatus: `-1`
					})
				})
				getMessageList(res.data).then(res => {

					uni.setStorageSync("staff", res.result[0])
				})
			}
		});

	}

	onShow(() => {
		loadingData()
	})
</script>

<style lang="scss" scoped>
	.login-container {
		display: flex;
		flex-direction: column;
		min-height: calc(100vh);
		width: 100%;
		background-color: rgb(239, 241, 252);
		position: relative;
	}

	.index-up {
		position: absolute;
		top: 0rpx;
		left: 0;
		width: 100%;

		.index-up-img {
			width: 100%;
			height: 20rpx;
		}
	}

	.index-ball-father {
		width: 100%;
		display: flex;
		justify-content: flex-end;
		position: fixed;
		top: 120rpx;
		left: 0;
		z-index: 999;
		margin-top: 120rpx;

		.white-ball {
			width: 60rpx;
			height: 60rpx;
			background-color: #fff;
			border-radius: 50%;
			margin-right: 20rpx;
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.super-white-ball {
			width: 70rpx;
			height: 60rpx;
			background-color: #fff;
			border-radius: 50%;
			margin-right: 40rpx;
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.small-img {
			width: 25rpx;
			height: 25rpx;
		}
	}

	.index-smallPhoto {
		width: 100%;
		display: flex;
		justify-content: flex-end;
		margin-top: 480rpx;
		margin-bottom: 50rpx;

		.photo-box {
			margin-right: 40rpx;
			height: 180rpx;
			width: 250rpx;
			z-index: 2;
			position: relative;

			.photo-box-img {
				position: absolute;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
			}
		}

	}

	.white-content {
		z-index: 1;
		height: 740rpx;
		width: 90%;
		background-color: #fff;
		border-radius: 30rpx;
		z-index: 2;
		display: flex;
		align-items: center;
		flex-direction: column;
		position: relative;

		.white-content-img {
			position: absolute;
			top: 110rpx;
			left: 50%;
			transform: translateX(-50%);
			width: 200rpx;
			height: 175rpx;
		}

		.white-content-secondimg {
			position: absolute;
			left: 50%;
			top: 30%;
			transform: translate(-50%, -30%);
			width: 400rpx;
			height: 300rpx;
			z-index: 1;
		}

		.white-font {
			margin-top: 330rpx;
			font-size: 30rpx;
		}

		.second-font {
			margin-top: 10rpx;
			font-size: 30rpx;
			padding: 0 30rpx;
		}
	}

	.white-content-father {
		width: 100%;
		display: flex;
		justify-content: center;
		margin-top: 40vh;
		z-index: 1;
		position: relative;
		overflow: hidden;

	}

	.bottom-text {
		font-size: 22rpx;
	}

	.white-content-father-time {
		width: 100%;
		display: flex;
		justify-content: center;
		margin-top: 20rpx;

		.white-bgc {
			width: 100%;
			height: 100%;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 32rpx;
			color: #333333;
		}

		.white-content {
			height: 110rpx;
			width: 92%;
			overflow: hidden;
			background-size: 100% auto;
			border-radius: 35rpx;
			z-index: 2;
		}

		.white-shu {
			height: 100%;
			width: 2rpx;
			background-color: #fff;
			margin: 0 20rpx;
		}
	}

	.bad-button {
		width: 100%;
		margin-top: 40rpx;
		display: flex;
		justify-content: flex-end;

		.blue-button {
			background: linear-gradient(to right, #00C9FF, #0076FF);
			color: #fff;
			font-size: 25rpx;
			padding: 10rpx 20rpx;
			border-radius: 35rpx;
			margin-right: 40rpx;
		}
	}

	.zhiling-box {
		display: flex;
		justify-content: space-around;
		align-items: center;
		width: 92%;
		margin-left: 4%;
		height: 110rpx;
		background-color: #fff;
		border-radius: 35rpx;
		font-size: 32rpx;

		.zhiling-img {
			width: 25rpx;
			height: 25rpx;
		}
	}

	.white-box-father {
		display: flex;
		width: 100%;
		flex-wrap: wrap;
		margin-left: 1%;

		.white-box {
			margin-top: 35rpx;
			width: 20.7%;
			margin-left: 3%;
			height: 237rpx;
			background-color: #fff;
			border-radius: 35rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			flex-direction: column;

			.box-img {
				width: 55rpx;
				height: 55rpx;
				margin-bottom: 25rpx;
			}

			.box-font {
				font-size: 30rpx;
			}
		}
	}

	.result {
		margin: 0 auto;
	}

	.jia-box {
		position: absolute;
		top: 0rpx;
		left: 0;
		display: flex;
		height: 80rpx;
		width: 100%;
		justify-content: center;
	}

	.jia {
		margin-top: -5rpx;
		width: 25rpx;
		height: 25rpx;
		border-radius: 50%;
		background-color: #fff;
		color: #fff;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 30rpx;

		.jia-img {
			width: 18rpx;
			height: 18rpx;
			z-index: 2;
		}
	}

	.gray-box {
		border-radius: 20rpx;
		height: 20rpx;
		width: 35rpx;
		margin-right: 15rpx;
		background-color: #fff;
	}

	.black-box {
		border-radius: 20rpx;
		height: 20rpx;
		width: 35rpx;
		margin-right: 15rpx;
		background-color: black;
	}

	.button-blue {
		position: absolute;
		bottom: 45rpx;
		width: 40%;
		display: flex;
		justify-content: center;
		align-items: center;
		height: 90rpx;
		border-radius: 37rpx;
		background: linear-gradient(to right, #00C9FF, #0076FF);
		color: #fff;
		font-size: 33rpx;
		margin-top: 80rpx;
		z-index: 999;
	}

	.button-blue-spec {
		position: absolute;
		bottom: 45rpx;
		left: 50%;
		width: 40%;
		transform: translateX(-50%);
		display: flex;
		justify-content: center;
		align-items: center;
		height: 90rpx;
		border-radius: 37rpx;
		background: linear-gradient(to right, #00C9FF, #0076FF);
		color: #fff;
		font-size: 33rpx;
		margin-top: 80rpx;
	}

	.button-white-spec {
		position: absolute;
		bottom: 30rpx;
		right: 8%;
		width: 40%;
		display: flex;
		justify-content: center;
		align-items: center;
		height: 90rpx;
		border-radius: 37rpx;
		background: linear-gradient(to bottom, #f3f3f5, #dee4e9);
		border: 2rpx solid #b1c0ca;
		// color: #fff;
		font-size: 33rpx;
		margin-top: 80rpx;
	}

	.chuo-img {
		position: absolute;
		top: 72rpx;
		right: 235rpx;
		width: 120rpx;
		height: 110rpx;
		z-index: 3;
	}

	.chuo-ball {
		position: absolute;
		top: 20rpx;
		right: 60rpx;
		width: 60rpx;
		height: 60rpx;
		z-index: 3;
		background-color: rgb(242, 242, 242);
		border-radius: 50%;
		display: flex;
		justify-content: center;
		align-items: center;

		.ball-img {
			width: 37rpx;
			height: 37rpx;
		}
	}

	.blue-shu {
		width: 17rpx;
		height: 35rpx;
		border-radius: 17rpx;
		background: linear-gradient(to right, #00C9FF, #0076FF);
		margin-left: 40rpx;
		margin-right: 20rpx;
	}

	.blue-font {
		font-size: 30rpx;
		color: black;
	}
	.card-font {
		margin-left: 40rpx;
		font-size: 33rpx;
		margin-top: 10rpx;
	}
	
	.gray-font {
		margin-left: 40rpx;
		font-size: 32rpx;
		margin-top: 20rpx;
		color: #B1B1B1;
		// width: 100%;
	}
	
	.gray-bgc {
		margin: 0 40rpx;
		width: 80%;
		height: 75rpx;
		border-radius: 10rpx;
		display: flex;
		align-items: center;
		position: relative;
		text-align: center;
		font-size: 30rpx;
		margin-top: 40rpx;
	
		.gray-img {
			width: 100%;
			height: 100%;
			position: absolute;
			top: 0;
			left: 0;
		}
	}
</style>