<template>
	<view class="">
		<view class="content">
			<view class="border-bgc">
			</view>
			<view class="" style="height: 30rpx;">
			</view>

			<view class="card">
				<view class="card-li">
					农户名称: {{userInfo.name}}
				</view>
				<view class="card-li">
					种养殖类型: 种植户
				</view>
				<view class="card-li">
					土地面积: {{userInfo.total_land_area}}亩
				</view>
				<view class="card-li">
					地址: {{userInfo.area_name}}{{userInfo.street_name}}{{userInfo.village_name}}{{userInfo.brigade_name}}
				</view>
			</view>

			<view class="card" v-for="(item,index) in userInfo.land_detail" :key="index"
				@click="navgoFn(item.is_cropped,item.land_id)">
				<view class="tit card-li">
					<view class="">
						{{item.land_notes}}
					</view>
					<view class="" style="color: #00A15E;" v-if="item.is_cropped">
						已种植
					</view>
					<view class="" style="color: #00A15E;" v-else>
						未种植
					</view>
				</view>
				<view class="card-li">
					<view class="">
						面积: {{item.land_area}}亩
					</view>
				</view>
				<view class="card-li tit" v-if="item.crop_name">
					<view class="" style="font-weight: normal;">
						农作物: {{item.crop_name}}
					</view>
					<view class="" style="color: #FF9B66;" v-if="item.ripe_time">
						已成熟
					</view>
				</view>
				<view class="card-li tit" style="font-weight: normal;" v-show="item.crop_yield">
					<view class="">
						预计产量: {{item.crop_yield}}kg
					</view>
					<view class="" v-if="false">
						已出售: 500kg
					</view>
				</view>
			</view>
			<view style="height: 170rpx;">
			</view>
		</view>

		<view class="bottom">
			<view class="add-btn" @click="navgo('/pages/growRecord/index')">
				批量处理
			</view>
			<view class="add-btn add" @click="navgo('/pages/InformationAdd/index')">
				增加种植
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		reactive
	} from "vue"


	const userInfo = reactive({
		"id": 307,
		"create_user_id": 33,
		"company_id": 17,
		"name": "王五",
		"phone": "18148000562",
		"area_name": "纳溪区",
		"street_name": "安富街道",
		"village_name": "上坝街",
		"brigade_name": "1队",
		"is_zz_user": true,
		"is_sc_user": true,
		"is_jq_user": true,
		"is_dw_user": true,
		"total_land_area": 5000,
		"total_pond_area": 32,
		"total_henhouse_area": 0,
		"total_pasture_area": 0,
		"pond_detail": [{
				"pond_id": 74,
				"pond_area": "32",
				"pond_notes": "好看"
			},
			{
				"pond_id": 73,
				"pond_area": "",
				"pond_notes": "过好几个"
			}
		],
		"land_detail": [{
				"land_id": 69,
				"land_area": "3000",
				"land_notes": "土地二",
				"is_cropped": true,
				"source_code": "NO1698027424",
				"crop_name": "葡萄",
				"crop_variety": "阳光玫瑰",
				"crop_brand": "不知道啥品牌",
				"crop_yield": 1000,
				"seed_time": "2023-10-23 10:17:04",
				"ripe_time": "2023-10-23 16:40:01"
			},
			{
				"land_id": 68,
				"land_area": "2000",
				"land_notes": "土地一",
				"is_cropped": false
			}
		]
	})
	const navgo = (url) => {
		uni.navigateTo({
			url
		})
	}
	const navgoFn = (type, id) => {

		if (!type) {
			navgo("/pages/InformationAdd/index")
		} else if (type) {
			navgo(`/pages/detail/plant?land_id=${id}`)
		}
		if (type == 2) {
			navgo('/pages/detail/plant')
		}
	}
</script>

<style lang="scss">
	.content {
		min-height: 90vh;
		position: relative;
		// padding: 0 20rpx;
		// padding-top: 50rpx;
		background-color: #EAF2EF;
		padding: 0;


		.card {
			position: relative;
			width: 693.93rpx;
			margin: auto;
			background-color: #fff;
			box-sizing: border-box;
			border-radius: 21.03rpx 21.03rpx 21.03rpx 21.03rpx;
			margin-bottom: 40rpx;

			.card-li {
				// margin-bottom: 17rpx;
			}

			.tit {
				display: flex;
				font-size: 33.29rpx;
				font-weight: bold;
				// background-color: red;
				justify-content: space-between;
			}
		}
	}

	.bottom {
		width: 750rpx;
		height: 150rpx;
		background-color: #EAF2EF;
		position: fixed;
		bottom: 0;
		display: flex;
		align-items: center;
		justify-content: center;

		.add-btn {
			width: 238.32rpx;
			height: 84.11rpx;
			border: #34D190 1px solid;
			border-radius: 42.06rpx 42.06rpx 42.06rpx 42.06rpx;
			display: flex;
			align-items: center;
			color: #00A15E;
			font-size: 33.29rpx;
			font-weight: bold;
			justify-content: center;
			margin-right: 20rpx;
		}

		.add {
			background-color: #00A15E;
			color: white;
		}
	}
</style>