<!-- 单位查询列表 -->
<template>
	<view class="as-layout-horizontal as-gravity-center top">
		<view class="search-box as-layout-horizontal">
			<image :src="`${$imgUrl}service/icon-search.png`" class="icon"></image>
			<input class="search" placeholder="请输入单位名称" @input="inputHandle"/>
		</view>
		<view class="search-btn" @click="doSearch">搜索</view>
	</view>
	
	<!-- 列表 -->
	<view class="list">
		<view class="item" v-for="(item,index) in state.list">
			<view class="head">
				<view class="name">
					<text class="title">申请时间  {{item.time}}</text>
				</view>
				<view class="status" :class="item.status === 1 ? 'text-orange' : 'text-green'">{{item.status === 1 ? '审核中' : '审核通过'}}</view>
			</view>
			<view class="detail">
				<view class="order-text">
					<text class="type">单位名称：</text>
					<text class="value">{{item.name}}</text>
				</view>
			</view>
			<view class="btns" v-if="item.status !== 1">
				<view class="btn btn-normal as-gravity-center" @click="$util.navTo('/issueActivation/add-car')">新增车辆</view>
				<view class="btn btn-primary as-gravity-center" @click="$util.navTo('/issueActivation/car-submit-record')">车辆提交记录</view>
			</view>
		</view>
	</view>
	
	<view class="add-btn">
		<submit-button title="新增单位" @submit="$util.navTo('/issueActivation/add-company')"></submit-button>
	</view>
</template>

<script setup lang="ts">
	import { reactive } from "vue";
	import { msg } from "@/utils/utils";
	
	const state = reactive({
		//搜索关键字
		searchInput:'',
		//申请列表 status:1-审核中  2-审核通过
		list:[
			{name:'某某某某某某某某科技公司',time:'2023-10-23 12:00:23',status:1},
			{name:'某某某某某某某某科技公司',time:'2023-10-23 12:00:23',status:2},
			{name:'某某某某某某某某科技公司',time:'2023-10-23 12:00:23',status:1},
			{name:'某某某某某某某某科技公司',time:'2023-10-23 12:00:23',status:2},
			{name:'某某某某某某某某科技公司',time:'2023-10-23 12:00:23',status:1},
			{name:'某某某某某某某某科技公司',time:'2023-10-23 12:00:23',status:2},
			{name:'某某某某某某某某科技公司',time:'2023-10-23 12:00:23',status:1},
			{name:'某某某某某某某某科技公司',time:'2023-10-23 12:00:23',status:2},
		]
	})
	
	
	/* 输入 */
	const inputHandle = (event) => {
		state.searchInput = event.target.value;
	}
	
	/* 搜索 */
	const doSearch = () =>{
		 msg(state.searchInput);
	}
	
</script>

<style>
	page{
		background-color: #EEF7F7;
	}
</style>
<style lang="scss" scoped>
	.top{
		padding: 30rpx 30rpx 0px;
	}
	.search-box {
		margin-right: 20rpx;
		height: 82rpx;
		border-radius: 40rpx;
		background: #ffffff;
		display: flex;
		justify-content: center;
		align-items: center;
		border: 1px solid #dcdcdc;
		box-sizing: border-box;
	}
	
	.search-box .icon {
		width: 38rpx;
		height: 38rpx;
		margin: 0 28rpx;
	}
	
	.search-box .search {
		flex: 1;
		height: 100%;
		font-size: 28rpx;
		color: #333333;
	}
	
	.search-btn{
		color: white;
		background-color: #00B38B;
		width: 140rpx;
		height: 80rpx;
		line-height: 80rpx;
		font-size: 32rpx;
		border-radius: 40rpx;
		text-align: center;
	}
	
	.add-btn{
		padding: 30rpx 40rpx;
		position: fixed;
		bottom: 0;
		width: 100%;
		background-color: #EEF7F7;
	}
	
	.list {
		padding: 30rpx 30rpx 140rpx;
		display: flex;
		flex-direction: column;
	}
	
	.list .item {
		background: #ffffff;
		box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
		border-radius: 20rpx;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		margin-bottom: 30rpx;
	}
	
	.list .item .head {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 20rpx 28rpx;
		border-bottom: 1px solid #dcdcdc;
	}
	
	.list .item .head .icon {
		width: 48rpx;
		height: 48rpx;
	}
	
	.list .item .head .name {
		display: flex;
		align-items: center;
	}
	
	.list .text-green {
		font-size: 26rpx;
		color: #00b38b;
	}
	
	.list .text-orange {
		font-size: 26rpx;
		color: #ff8000;
	}
	
	.list .title {
		font-size: 30rpx;
		color: #333;
	}
	
	.list .detail {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 30rpx 32rpx;
	}
	
	.list .detail .type {
		font-size: 26rpx;
		color: #999;
	}
	
	.list .detail .value {
		font-size: 26rpx;
		color: #333;
	}
	
	.list .finished .detail .value {
		color: #999;
	}
	
	.list .detail .odd {
		margin: 20rpx 0;
	}
	
	.list .cny {
		font-size: 26rpx;
		color: #333;
	}
	.list .finished .cny{
		color: #999;
	}
	.list .amount {
		font-size: 40rpx;
		font-weight: bold;
	}
	
	.list .finished .amount {
		color: #999;
	}
	
	.list .btns {
		display: flex;
		align-items: center;
		justify-content: flex-end;
		border-top: 1px solid #dcdcdc;
		margin: 0 30rpx;
		padding: 20rpx 0;
	}
	
	.list .btn {
		height: 60rpx;
		// line-height: 60rpx;
		border-radius: 30rpx;
		padding: 0 24rpx;
		font-size: 26rpx;
		box-sizing: border-box;
		margin-right: 20rpx;
	}
	
	.list .btns .btn:last-child {
		margin: 0;
	}
	
	.list .btn-primary {
		border: 1px solid #00b38b;
		color: #00b38b;
	}
	
	.list .btn-normal {
		border: 1px solid #dcdcdc;
		color: #333;
	}
</style>