TraceabilityAPP/pages/feedIng/feedList.vue

180 lines
3.5 KiB
Vue

<template>
<view class="content">
<view class="card">
<view class="tit">
<view class="">
农户名称: 1号土地
</view>
</view>
<view class="card-li">
<view class="">
种养殖类型: 土豆
</view>
<view class="">
养殖头数: 的划分等级
</view>
</view>
<view class="card-li">
<view class="">
土地面积: 20
</view>
<view class="">
公猪: 的划分等级
</view>
</view>
<view class="card-li">
<view class="">
养殖种类: 20
</view>
<view class="">
母猪: 的划分等级
</view>
</view>
<view class="card-li">
<view class="">
具体种类: 20
</view>
<view class="">
幼崽: 的划分等级
</view>
</view>
</view>
<view class="serch">
<u-search bgColor='white' v-model="query" height='63.08rpx' :show-action="false" actionText="搜索"
:animation="true"></u-search>
<view class="serch-btn" @tap="queryFn">
搜索
</view>
</view>
<view class="card" v-for="(item,index) in animalList" :key="index" @click="navgo('/pages/feedIng/feedDetail')">
<view class="tit">
<view class="">
编号: {{item.animal_code}}
</view>
<view class="" style="color: #00A15E;" v-if='item.animal_status==1'>
健康
</view>
<view class="" style="color: #FFD736;" v-if='item.animal_status==2'>
怀孕中
</view>
<view class="" style="color: #3274F9;" v-if='item.animal_status==4'>
可出栏
</view>
<view class="" style="color: #F84221;" v-if='item.animal_status==3'>
生病隔离中
</view>
</view>
<view class="card-li">
<view class="">
养殖类型: {{item.animal_kind}}
</view>
<view class="">
年龄: {{item.animal_age}}年
</view>
<view class="">
体重: {{item.animal_weight}}kg
</view>
</view>
</view>
<view class="ripe-btn" @click="navgo('/pages/feedIng/addPoultry')">
添加新动物
</view>
</view>
</template>
<script setup>
import {
animalListAPI,
} from "@/api/animal.js"
import {
reactive,
ref
} from "vue";
const navgo = (url) => {
uni.navigateTo({
url
})
}
const animalList = reactive([])
animalListAPI({
user_id: 307,
page_no: 1,
page_size: 3000000,
}).then(res => {
res.data.forEach(item => {
animalList.push(item)
})
})
const query = ref("")
const queryFn = () => {
animalList.splice(0, 999999999)
animalListAPI({
user_id: 307,
keyword: query.value,
}).then(res => {
res.data.forEach(item => {
animalList.push(item)
})
})
}
</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;
}
}
.serch {
position: relative;
margin-bottom: 20rpx;
.serch-btn {
color: white;
width: 115.65rpx;
height: 63.08rpx;
background-color: #1BAB6F;
text-align: center;
line-height: 63.08rpx;
border-radius: 50rpx;
position: absolute;
top: 0;
right: 0;
}
}
.ripe-btn {
width: 588.79rpx;
height: 84.11rpx;
background-color: #00A15E;
color: white;
display: flex;
justify-content: center;
align-items: center;
margin: 0 auto;
border-radius: 42.06rpx 42.06rpx 42.06rpx 42.06rpx;
background: linear-gradient(to right, #00A15E, #4CC593);
margin-top: 64rpx;
}
.showmore {
font-size: 29.79rpx;
justify-content: center;
display: flex;
align-items: center;
}
</style>