<template>
	<view class="phone-zjzgs-page">
		<view class="icon-title-navBar-box">
			<view @click="goUpPage" class="nav-bar-icon"></view>
			<text class="nav-bar-title">申请办证数量</text>
		</view>
		<view class="zjzgs-body-box">
			<view class="zjzgs-num-box" v-for="item in certList" :key="item.jzId">
					<view class="zjzgs-title">{{ item.jgName }}</view>
					<view class="num-item-box">
						<view>职业等级：{{ item.zyName }}{{item.zyLevel}}</view>
					</view>
					<view class="num-item-box">
						<view>申请数量：{{ item.userCount }}</view>
					</view>
					<view class="list-btn-box">
						<view class="list-btn" @click="checkUser(item)">查看详情</view>
					</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		onLoad
	} from "@dcloudio/uni-app"
	import {ref} from "vue"
	import * as httpApi from "@/api/zijiazhenggongsi"
	
	const listIds = ref([])
	
	const certList = ref([])
	
	const startDate = ref(null)
	const endDate = ref(null)
	const jzId = ref(null)
	
	onLoad((options) =>{
			listIds.value = options.listIds.split(',');
			startDate.value = options.startDate;
			endDate.value = options.endDate;
			jzId.value = options.jzId;
			getCertInfo()
	})
	
	function getCertInfo() {
		httpApi.getZiJiazhengGongsiInfo({idList:listIds.value}).then(res => {
			certList.value = res.data;
		})
	}
	
	function checkUser(item) {
		uni.redirectTo({
			url:`/pages/admin/Jiazheng/index?isZijiazheng=true&userIdList=${item.userList.join(',')}&listIds=${listIds.value.join(',')}&startDate=${startDate.value}&endDate=${endDate.value}&from=banzhengshuliang&jzId=${jzId.value}`
		})
	}
	 function goUpPage() {
		  uni.redirectTo({
		  	url:`/pages/admin/zijiazheng/index?startDate=${startDate.value}&endDate=${endDate.value}`
		  })
	  }
</script>

<style>

</style>
