<template>
	<view class="container">
		<view class="add_btn">
			<u-button type="primary" size="small" text="去上报" style="width: 80px;" @click="addPark"
				icon="plus-circle"></u-button>
		</view>
		<view class="list">
			<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y" @scrolltoupper="upper"
				@scrolltolower="lower" @scroll="scroll">
				<view class="card" v-for="(item,index) in list" @click="toDetail(item.id)">
					<view class="title">{{item.tractor_license}}</view>

					<view class="name_1 flex">姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：{{item.reporter_name}}</view>
					
					<view class="name_1 flex">电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;话：{{item.phone_num}}</view>
					
					<view class="name_1 flex">入园目的：{{item.mission_text}}</view>
					
					<view class="name_1 flex">上报时间：{{item.create_time}}</view>

					<view class="name_1 flex">
						<u-tag text="已通过" type="success" v-if="item.status == 1"></u-tag>
						<u-tag text="拒绝" type="warning" v-else-if="item.status == 2"></u-tag>
						<u-tag text="审核中" type="error" v-else></u-tag>

					</view>
				</view>
			</scroll-view>


		</view>
	</view>

</template>

<script>
	import {
		get,
		post
	} from '@/common/request.js'
	export default {
		data() {
			return {
				list: []
			}
		},
		onLoad() {
			this.getParkList()
		},
		methods: {
			onPullDownRefresh() {
				setTimeout(() => {
					this.getParkList()
					uni.stopPullDownRefresh();
				}, 500);
			},
			addPark(){
				uni.navigateTo({
					url:'/pages/order/addPark'
				})
			},
			async getParkList() {
				await get('/myapi/api/yq_driver/parkList').then((res) => {
					this.list = res.data
				})
			},
			toDetail(id){
				uni.navigateTo({
					url:'/pages/order/detailPark?id='+id
				})
			}
		}
	}
</script>

<style scoped lang="less">
	.container {
		padding: 20px;


		.add_btn {
			position: fixed;
			top: 50px;
			right: 10px;
			z-index: 1;
		}

		.list {

			.scroll-Y {
				height: calc(100vh - 86px);

				.card {
					background-color: #fff;
					padding: 10px;
					margin-bottom: 10px;
					font-size: 14px;
					border-radius: 10px;
					border: 1px solid #f4f4f4;
					.title {
						font-size: 18px;
						font-weight: 700;
						height: 40px;
						line-height: 40px;
						border-bottom: 1px solid #f4f4f4;
						display: flex;
						justify-content: space-between;
						align-items: center;
					}

					.flex {
						display: flex;

						.icon-right {
							margin-right: 5px;
						}
					}

					.name_1 {
						margin: 10px 0;

					}
				}
			}
		}

	}
</style>