TraceabilityAPP/pages/feedIng/histroyFeed.vue

148 lines
3.1 KiB
Vue

<template>
<view class="content">
<!-- <view class="card">
<view class="tit">
<view class="">
溯源码: {{animal_detail.animal_code}}
</view>
</view>
<view class="card-li">
<view class="">
养殖品种: {{animal_detail.animal_kind}}
</view>
<view class="">
年龄: {{animal_detail.animal_age}}
</view>
</view>
<view class="card-li">
<view class="">
养殖类型: {{animal_detail.animal_breed}}
</view>
<view class="">
体重:{{animal_detail.animal_weight}}
</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: #00A15E;" v-if='animal_detail.animal_status==1'>
健康
</view>
<view class="" style="color: #FFD736;" v-if='animal_detail.animal_status==2'>
怀孕中
</view>
<view class="" style="color: #3274F9;" v-if='animal_detail.animal_status==4'>
可出栏
</view>
<view class="" style="color: #F84221;" v-if='animal_detail.animal_status==3'>
生病隔离中
</view>
</view>
</view> -->
<detailCard :id='animal_id'></detailCard>
<view class="">
<view class="">
养殖情况
</view>
<imgCard v-for="(item,index) in imgList" :imgUrl='item' :key="index" @tap='previewImage(index)'></imgCard>
</view>
<view class="up-plant-btn" @click="updateImgFn">
上传新的种植情况
</view>
</view>
</template>
<script setup>
import imgCard from "@/components/imgCard.vue"
import uplodeImg from "@/utils/uplodeImg.js"
import {
animalPicListAPI,
addAnimalPicAPI,
animalInfoAPI
} from "@/api/animal.js"
import {
onLoad
} from "@dcloudio/uni-app"
import {
reactive,
ref
} from "vue";
import detailCard from "@/components/animal/detailCard.vue"
const img = ref("")
const updateImgFn = () => {
uplodeImg().then(res => {
img.value = res.data.image
addAnimalPicAPI({
animal_id: Number(animal_id.value),
pic: res.data.image
}).then(res => {
imgList.unshift(img.value)
})
})
}
const imgList = reactive([])
const animal_id = ref("")
onLoad((option) => {
animal_id.value = option.id
animalPicListAPI({
animal_id: option.id
}).then(res => {
res.data.forEach(item => {
imgList.push(item.pic)
})
})
})
const previewImage = (index) => {
uni.previewImage({
urls: imgList,
current: index,
})
}
</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;
}
}
.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>