<template>
	<view>
		<view class="title-back" :style="{height:`${uni.getStorageSync('moveHeight')+40}px`}">
			<view class="left-father" @click="uni.navigateBack();">
				<image class="back-img" src="https://www.focusnu.com/media/directive/index/left.png" />
			</view>
		</view>
		<view :style="{height:`${uni.getStorageSync('moveHeight') + 40}px`}"></view>
		<image class="bacimg" src="https://www.focusnu.com/media/directive/bgyg.png" mode="aspectFill"></image>
		
	 
		
		<view class="box" v-for="(v,i) in list" :key='i' :class="act==i?'act':''" @click="act=i">
			<view>
				<text class="tit">{{v.comName}}</text>
			</view>
			<view class="cont" style="margin-top: 23rpx;">
				<text class="hui">负责人</text>
				<text class="hui">{{v.orgLeader}}</text>
			</view>	
			<view class="cont" style="margin-top: 13rpx;">
				<text class="hui">联系电话</text>
				<text class="hui">{{v.orgLeaderPhone}}</text>
			</view>
			<view class="cont">
				<view v-if="v.izPz == 'N'" class="bianj" @click.stop="uni.navigateTo({ url:`orgMaterial?orgObj=${JSON.stringify(v)}`});">
					编辑
				</view>
				<view v-if="v.izPz == 'Y'" class="bianj" @click.stop="uni.navigateTo({ url:`orgMaterial?orgObj=${JSON.stringify(v)}`});">
					详情
				</view>
			</view>
		</view>
		<view style="height:3vw;width: 100%;display: flex;align-items: center;justify-content: center;margin: 30rpx 0;">
			<u-loadmore :status="status" :loadText="{nomore:'暂无更多数据'}" v-if="list.length>0" />
			<view style="height: 30rpx;"></view>
		</view>
		<view class="none" v-if="list.length == 0">
			<image style="width: 300rpx;height: 300rpx;"
				src="https://www.focusnu.com/media/directive/index/none.png" mode="widthFix" lazy-load="false" />
			<view class="">暂无机构信息</view>
		</view>
	</view>
</template>

<script setup lang="ts">
	 import {
	 	reactive,
	 	ref,
	 	onMounted,
	 	onUnmounted,
		defineExpose
	 } from 'vue';
	 import {
	 	onLoad,
	 	onShow,
	 	onPullDownRefresh,
		onReachBottom
	 } from '@dcloudio/uni-app';
	 import {
	 	getSuppliersWlInfo,
		getSuppliersOrgInfoByOpenId,
	 } from './api.js'
	 const status = ref('loadmore')
	 const list = ref([])
	 const value = ref('')
	 const openId = uni.getStorageSync('openid')
	 const id = ref('')
	 const pageNo = ref(1)
	 const act = ref(-1)
	 onLoad((e)=>{
		 id.value = e.id;
		 search()
	 })
	 
	 const search = ()=>{
		 let obj = {
			 openId: openId
		 }
		 getSuppliersOrgInfoByOpenId(obj).then(res=>{
			 console.log('---->',res)
			 list.value.push(...res.result) 
			 // status.value = (res.result.total == list.value.length ? 'nomore' : 'loadmore')
		 })
	 }
	 onReachBottom(()=>{
		 if(status.value=='loading'|| status.value=='nomore'){return}
		 status.value = 'loading';
		 search()
	 })
	 const swih = (e,i)=>{
		 list.value[i] = e;
	 }
	 defineExpose({swih})
</script>

<style lang="scss" scoped>
	.fiedrightview {
		width: 100rpx;
		height: 100rpx;
		background: rgba(255, 255, 255, 0.86);
		border-radius: 50%;
		border: 1px solid #D9DADC;
		display: flex;
		justify-content: center;
		// align-items: center;
		position: relative;
		font-size: 60rpx;
		position: fixed;
		right: 30rpx;
		bottom: 90rpx;
		line-height: 86rpx;
	
		text {
			min-width: 1.8vw;
			height: 1.8vw;
			border-radius: 0.8vw;
			border: 2px solid #E81D1D;
			display: flex;
			align-items: center;
			justify-content: center;
			padding: 0 0.5vw;
			font-weight: 400;
			font-size: 1.3vw;
			color: #E81D1D;
			position: absolute;
			top: -0.8vw;
			right: -0.8vw;
		}
	
		image {
			width: 3.3vw;
			height: 3.3vw;
		}
	}
	.act{
		border: 2px dashed #0083FA !important;
	}
	.box{
		width: 703rpx;
		min-height: 230rpx;
		padding: 45rpx 35rpx;
		background: #fff;
		border-radius: 25rpx;
		overflow: hidden;
		margin: 24rpx auto ;
		border: 2px solid #fff;
		position: relative;
		z-index: 30;
		.xian{
			width: 100%;
			height: 1px;
			background: #E5E5E5;
			margin: 16rpx auto;
		}
		.cont{
			width: 100%;
			display: flex;
			align-items: center;
			.bianj{
				width: 120rpx;
				height: 56rpx;
				border-radius: 28rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				background: linear-gradient(90deg, #E6F4FE,#CCE8FE,#CAE6FE);
				color: #0083FA;
				font-size: 31rpx;
			}
			.hei{
				font-size: 26rpx;
				color: #222;
				font-weight: 500;
			}
			.hui{
				font-size: 26rpx;
				color: #979DA6;
			}
		}
		.tit{
			font-size: 32rpx;
			color: #63686F;
			font-weight: bold;
		}
	}
	.scr{
		width: 100%;
		height: 110rpx;
		background: RGBA(247, 247, 247, 1);
		z-index: 10;
		padding-bottom: 10rpx;
	}
	.serch{
		width: 700rpx;
		height: 80rpx;
		margin: 15rpx auto 0;
		border: 1px solid rgba(229, 229, 229, 1);
		display: flex;
		align-items: center;
		border-radius: 40rpx;
		position: relative;
		.right-img {
			width: 50rpx;
			height: 100%;
			position: absolute;
			top: 0;
			right: 19rpx;
			z-index: 999;
			display: flex;
			justify-content: center;
			align-items: center;
			
			image{
				width: 40rpx;
				height: 40rpx;
			}
		}
		
		.bacimg{
			width: 42rpx;
			height: 42rpx;
			margin: 0 38rpx;
			
		}
	}

.gray-font {
		padding: 20rpx 60rpx;
		padding-bottom: 35rpx;
		color: #999999;
	}

	.bacimg {
			width: 100%;
			height: 780rpx;
			position: fixed;
			top: 0;
			left: 0;
			z-index: 0;
		}
	
		.title-back {
			background: rgba(255, 255, 255, 0);
			width: 100%;
			height: 70rpx;
			display: flex;
			justify-content: space-between;
			align-items: flex-end;
			padding-bottom: 20rpx;
			position: fixed;
			top: 0;
			left: 0;
			z-index: 9999;
		}
	
		.left-father {
			width: 150rpx;
			height: 100%;
			display: flex;
			align-items: flex-end;
	
			.back-img {
				width: 45rpx;
				height: 40rpx;
				margin-left: 40rpx;
				margin-right: 15rpx;
			}
		}
	</style>
	<style>
		page {
			background: #F7F7F7;
		}
	</style>