<template>
	<view class="content">
		<imgCard></imgCard>

		<view class="bad-info">
			<view class="" style="display: flex;align-items: center;">
				<u--image :src="urlFn('sj')" style="margin: 0 5rpx;" width="28.04rpx" height="28.04rpx"></u--image>
				<text>刷新时间:{{dateFn()}}</text>
			</view>
			<view style="display: flex;" @click="navgo(`/pages/feedIng/histroyFeed?id=${animal_id}`)">
				查看历史条件 <u--image src="/static/img/CKGD.png" style="margin-left: 5rpx;" width="31.54rpx"
					height="31.54rpx"></u--image>
			</view>
		</view>
		<view class="up-plant-btn" @click="updateImgFn">

			上传新的种植情况
		</view>
		<view class="card">
			<view class="tit">
				<view class="">
					编号: 52656
				</view>
				<view class="">
					溯源码: 52656
				</view>
			</view>
			<view class="card-li">
				<view class="">
					养殖品种: 土豆
				</view>
				<view class="">
					年龄: 的划分等级
				</view>
			</view>
			<view class="card-li">
				<view class="">
					养殖类型: 20亩
				</view>
				<view class="">
					体重: 45kg
				</view>
			</view>
		</view>

		<view class="card">
			<view class="card-li">
				<view class="" style="display: flex;align-items: center;">
					<u--image src="/static/img/GG.png" style="margin: 0 21rpx;" width="80rpx" height="80rpx"></u--image>
					当前养殖状态
				</view>
				<view class="" style="color: green;">
					健康
				</view>
			</view>

		</view>
		<view class="">
			<view class="" style="margin-bottom: 20rpx;">
				饲养记录
			</view>
			<myTable></myTable>
		</view>
	</view>
</template>

<script setup>
	import myTable from "@/components/myTable/index.vue"
	import imgCard from "@/components/imgCard.vue"
	import {
		ref
	} from "vue"
	import {
		onLoad
	} from "@dcloudio/uni-app"
	const urlFn = (name) => {
		return `/static/img/${name}.png`
	}
	const img = (w, h, m) => {
		return `width:${w}rpx;height:${h};margin:0 ${m}rpx `
	}
	const navgo = (url) => {
		uni.navigateTo({
			url
		})
	}
	const dateFn = () => {
		var today = new Date();

		// 获取年、月、日
		var year = today.getFullYear();
		var month = today.getMonth() + 1; // 月份从0开始，需要加1
		var day = today.getDate();

		// 构建日期字符串
		var dateStr = year + '-' + month + '-' + day;
		return dateStr
		// 输出日期字符串
	}
	const animal_id = ref(0)
	onLoad((option) => {
		animal_id.value = option.id
	})
</script>

<style lang="scss" scoped>
	.card {
		margin-bottom: 20rpx;

		.tit {
			display: flex;
			justify-content: space-between;
			padding-bottom: 20rpx;
			border-bottom: 1px solid #EBF1EF;
		}

		.card-li {
			margin-top: 20rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
		}
	}

	.table {
		margin-top: 20rpx;
		height: 500rpx;
		background-color: red;
	}

	.bad-info {
		display: flex;
		// background-color: red;
		justify-content: space-between;
		align-items: center;
		margin: 20rpx 0;
		color: #737373;
		width: 693.93rpx;
		font-size: 26.29rpx;

		.tit-b {
			color: red;
		}


	}

	.up-plant-btn {
		width: 371.5rpx;
		height: 66.59rpx;
		color: #00A15E;
		margin: 40rpx auto;
		border: 1px solid #00A15E;
		font-weight: bold;
		border-radius: 42.06rpx 42.06rpx 42.06rpx 42.06rpx;
		display: flex;
		align-items: center;
		justify-content: center;

	}
</style>