<template>
	<view class="login-container" :style="!workArray.length?{backgroundColor:`#F7F7F7`}:{}">
		<model :show="show" @close="show=false" :content="content" />
		<!-- <view class="title-back">
			<view class="left-father" @click="goBack">
				<image class="back-img" src="https://www.focusnu.com/media/directive/index/left.png" />
				<view style="font-size: 30rpx;">审核记录</view>
			</view>
		</view> -->
		<view class="title-back" :style="{height:`${uni.getStorageSync('moveHeight')+40}px`}">
			<view class="left-father" @click="goBack">
				<image class="back-img" src="https://www.focusnu.com/media/directive/index/left.png" />
				<view style="font-size: 30rpx;">审核记录</view>
			</view>
		</view>
		<view :style="{height:`${uni.getStorageSync('moveHeight') + 30}px`}"></view>
		<view class="index-up" v-if="workArray.length">
			<image class="index-up-img" src="https://www.focusnu.com/media/directive/index/indexgif.gif" mode="widthFix"
				lazy-load="false" />
		</view>
		<view
			style="position: absolute;left:0;top: 400rpx;width: 100%;display: flex;flex-direction: column;justify-content: center;align-items: center;z-index: 999;"
			v-if="!workArray.length">
			<image style="height: 220rpx;width: 350rpx;"
				src="https://www.focusnu.com/media/directive/index/jigouyaoqing.png" />
			<view style="color: #8E96AD;margin-top: 20rpx;">
				暂无申请信息
			</view>
		</view>
		<view class="bgc-card">
			<view class="under-scroll">
				<view v-for="(item,index) in workArray" :key="index">
					<view class="white-small"  @click="jumpToAll(item)">
						<view class="card-font">

							{{item.departName}}
						</view>
						<view class="gray-font">
							<image style="margin-left: 10rpx;height: 25rpx;width: 25rpx;margin-right: 10rpx;"
								src="https://www.focusnu.com/media/directive/index/ruzhu/man.png" />
							{{ item.guardianName }} |
							<image style="margin-left: 10rpx;height: 25rpx;width: 25rpx;margin-right: 10rpx;"
								src="https://www.focusnu.com/media/directive/index/ruzhu/phone.png" />
							{{ item.guardianPhone }}
							
						</view>
						<view class="gray-font">
							<image style="margin-left: 10rpx;height: 28rpx;width: 28rpx;margin-right: 10rpx;"
								src="https://www.focusnu.com/media/directive/index/ruzhu/time.png" />
							{{item.createTime}}
						</view>
						<view class="applying" v-if="item.modifyStatus===`1`">
							待审核
						</view>
						<view class="applysuccess" v-if="item.modifyStatus===`2`">
							审核通过
						</view>
						<view class="applyfail" v-if="item.modifyStatus===`3`">
							审核驳回
						</view>
						<view class="applyfail" v-if="item.modifyStatus===`4`">
							待审核
						</view>
						<view class="applyfail" v-if="item.modifyStatus===`5`">
							审核驳回
						</view>
					<!-- 	<view class="applying" v-if="item.applyStatus===`1`&&item.applyType==`2`">
							变更中
						</view>
						<view class="applysuccess" v-if="item.applyStatus===`2`&&item.applyType==`2`">
							变更通过
						</view>
						<view class="applyfail" v-if="item.applyStatus===`3`&&item.applyType==`2`">
							变更驳回
						</view> -->
						<!-- <view class="applywhy" v-if="item.applyStatus===`3`" @click="openLook(item.auditContent)">
							驳回原因
						</view> -->
						<view class="gray-bgc">
							<image class="gray-img" src="https://www.focusnu.com/media/directive/index/ditu/bgc.png" />

							<view style="color: #999999;z-index: 1;font-size: 27rpx;width: 100%;">
								<image
									style="margin-left: 10rpx;height: 30rpx;width: 25rpx;margin-right: 10rpx;z-index: 1;"
									src="https://www.focusnu.com/media/directive/index/ditu/mark.png" />
								{{item.houseAddress}}
							</view>
						</view>
						<view style="width: 100%;display: flex;justify-content: center;">
							<!-- <view class="blue-button"
								v-if="item.applyStatus != 1 && item.applyStatus != 2 && item.izHistory == `N` && item.applyType!=`2`"
								@click.stop="again(item)">
								重新申请
							</view> -->
							<view class="white-button"
								v-if="item.modifyStatus===`3`"
								@click.stop="openLook(item.auditContent)">
								驳回原因
							</view>
						</view>

					</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script setup>
	import {
		reactive,
		ref,
		nextTick
	} from 'vue';
	import {
		onLoad,
		onPullDownRefresh,

	} from '@dcloudio/uni-app'
	import {
		queryElderHisAudit 
	} from './api.js'
	import model from "@/compontent/public/model.vue"

	const type = ref(0)
	const workArray = ref([])
	const special = ref(false);
	const statusarray = ["loading", "success", "fail"]
	// 页面加载时接收 URL 参数
	onLoad((options) => {
		queryElderHisAudit().then(res => {
			workArray.value = res.result
		})
	})

	onPullDownRefresh(() => {
		queryElderHisAudit().then(res => {
			workArray.value = res.result
		})
		uni.stopPullDownRefresh()
	})
	const content = ref("");
	const show = ref(false);
	const openLook = (res) => {
		if (res) {
			content.value = res;
			show.value = true
		}
	}
	const goBack = () => {
		uni.navigateBack()
	}

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

	const jumpToAll = (element) => {
		uni.navigateTo({
			url: `/pages/oldmanindex/all?element=${JSON.stringify(element)}`
		});
		
	}
</script>

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

	}

	.under-scroll {
		width: 100%;
		height: calc(100% - 460rpx);
		padding-top: 30rpx;

		.white-small {
			width: 94%;
			margin-left: 3%;
			// height: 300rpx;
			background-color: #fff;
			border-radius: 30rpx;
			// padding: 40rpx;
			padding: 0rpx 40rpx;
			// margin-bottom: 50rpx;
			font-size: 25rpx;
			// color: #999999;
			position: relative;
			padding-bottom: 25rpx;
		}
	}

	.button-heng {
		// width: 100%;
		display: flex;
		justify-content: flex-end;
		position: absolute;
		bottom: 30rpx;
		right: 0;




	}

	.bgc-card {
		margin-top: 450rpx;
		background-color: #F7F7F7;
		width: 98%;
		margin-left: 1%;
		border-top-left-radius: 30rpx;
		border-top-right-radius: 30rpx;
		min-height: calc(100vh - 650rpx);
		z-index: 1;
	}

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

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

	.title-card {
		margin: 30rpx;
		background-color: #fff;
		width: 93%;
		height: 250rpx;
		border-radius: 30rpx;
		padding: 0 45rpx;
		margin-top: 40rpx;
		padding-top: 40rpx;

		.big-weight {
			font-size: 30rpx;
			color: #333333;
			font-weight: 600;
			margin-bottom: 30rpx;
		}

		.title-other {
			color: #666666;
			font-size: 25rpx;
		}
	}

	.title-back {
		background-color: #F7F7F7;
		width: 100%;
		height: 70rpx;
		display: flex;
		justify-content: space-between;
		align-items: flex-end;
		padding-bottom: 20rpx;
		border-bottom: 1rpx solid #cbd1d2;
		position: fixed;
		top: 0;
		left: 0;
		z-index: 9999;
	}

	.left-father {
		display: flex;
		align-items: center;
		z-index: 1;

		.back-img {
			width: 45rpx;
			height: 40rpx;
			margin-left: 40rpx;
			margin-right: 15rpx;
		}
	}

	.enter-img {
		width: 25rpx;
		height: 25rpx;
		position: absolute;
		right: 30rpx;
		top: 35rpx;
	}

	.bottom-father {
		display: flex;
		justify-content: space-between;
		margin-bottom: 20rpx;
	}

	.bottom-img {
		position: absolute;
		right: 30rpx;
		top: 60rpx;
		width: 160rpx;
		height: 140rpx;
	}

	.blue-button {
		margin: 0 30rpx;
		margin-top: 30rpx;

		width: 200rpx;
		height: 60rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		background: linear-gradient(to bottom, #e7f4ff, #c5e5ff);
		border: 2rpx solid #9AD1FF;
		color: #007CFF;
		border-radius: 25rpx;

		font-size: 30rpx;
		z-index: 999;
	}

	.white-button {
		margin: 0 30rpx;
		margin-top: 30rpx;

		width: 200rpx;
		height: 60rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		background: linear-gradient(to bottom, #f3f3f5, #dee4e9);
		border-radius: 25rpx;
		// color: #fff;
		font-size: 30rpx;
		z-index: 999;
		// display: flex;
		// justify-content: center;
		// align-items: center;
		// width: 30%;
		// height: 60rpx;
		// margin: 0 30rpx;
		// margin-top: 10rpx;
		// // color: #fff;
		// background: linear-gradient(to bottom, #f3f3f5, #dee4e9);
		// border-radius: 25rpx;
		// font-size: 30rpx;
	}

	.card-font {
		margin-left: 10rpx;
		font-size: 32rpx;
		margin-top: 30rpx;
		padding-top: 25rpx;
		word-wrap: break-word;
		width: 450rpx;
		font-weight: 600;
	}

	.gray-font {
		// margin-left: 20rpx;
		font-size: 32rpx;
		margin-top: 20rpx;
		color: #B1B1B1;
		width: 100%;
	}

	.gray-bgc {
		margin-top: 20rpx;
		// padding-bottom: 20rpx;
		width: 100%;
		height: 75rpx;
		border-radius: 10rpx;
		display: flex;
		align-items: center;
		position: relative;
		font-size: 28rpx;

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

	.applying {
		position: absolute;
		right: 20rpx;
		top: 0rpx;
		background-color: #FFE8D3;
		color: #FF7900;
		width: 130rpx;
		height: 50rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 28rpx;
		border-radius: 10rpx;
		margin-left: 35rpx;
		margin-top: 25rpx;
		// margin-top: 20rpx;
		// margin-bottom: 20rpx;
	}

	.applysuccess {
		position: absolute;
		right: 20rpx;
		top: 0rpx;
		background-color: #DEF1FF;
		color: #0093FF;
		width: 130rpx;
		height: 50rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 28rpx;
		border-radius: 10rpx;
		margin-left: 35rpx;
		margin-top: 25rpx;
		// margin-bottom: 20rpx;
	}

	.applyfail {
		position: absolute;
		right: 20rpx;
		top: 0rpx;
		background-color: #fff4f7;
		color: #FC3D7F;
		min-width: 130rpx;
		height: 50rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 28rpx;
		border-radius: 10rpx;
		margin-left: 35rpx;
		margin-top: 20rpx;
		white-space: nowrap;
		padding: 0 10rpx;
		// margin-bottom: 20rpx;
	}

	.applywhy {
		position: absolute;
		right: 20rpx;
		top: 60rpx;
		background-color: #F1F1F1;
		color: #373737;
		width: 130rpx;
		height: 50rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 28rpx;
		border-radius: 10rpx;
		margin-left: 35rpx;
		margin-top: 20rpx;
	}
</style>