cultivationApp/pages/husbandryForm/detail.vue

381 lines
8.0 KiB
Vue
Raw Normal View History

2023-11-29 18:12:28 +08:00
<template>
<view class="content">
2023-12-13 18:55:18 +08:00
2023-11-29 18:12:28 +08:00
<view class="content-con-a" v-if="datalist.length>0">
<view class="shop_action">
<view class="" v-for="(item,i) in datalist">
2023-12-13 18:55:18 +08:00
<view class=" tit">
2023-11-29 18:12:28 +08:00
{{item.type_text}}
</view>
2023-12-13 18:55:18 +08:00
2023-11-29 18:12:28 +08:00
<view class="shop_action-detail" v-if="item.type!=3&&item.type!=5">
2023-12-13 18:55:18 +08:00
<view class="action-detail">
<view class="title">
施肥面积
</view>
<view class="detail">
{{item.detail.area}}
</view>
</view>
2023-11-29 18:12:28 +08:00
<view class="action-detail">
<view class="title">
2023-12-09 17:07:42 +08:00
{{item.type_text.slice(0, -2)}}<text class=""
v-if="item.type==2||item.type==4"></text>品种
2023-11-29 18:12:28 +08:00
</view>
<view class="detail">
{{item.detail.kind}}
</view>
</view>
2023-12-07 09:34:25 +08:00
<view class="action-detail" v-if="item.detail.breed">
<view class="title">
2023-12-09 17:07:42 +08:00
{{item.type_text.slice(0, -2)}}<text class=""
v-if="item.type==2||item.type==4"></text>品牌
2023-12-07 09:34:25 +08:00
</view>
<view class="detail">
{{item.detail.breed}}
</view>
</view>
2023-11-29 18:12:28 +08:00
<view class="action-detail">
<view class="title">
2023-12-09 17:07:42 +08:00
{{item.type_text.slice(0, -2)}}<text class=""
v-if="item.type==2||item.type==4"></text>用量
2023-11-29 18:12:28 +08:00
</view>
<view class="detail">
{{item.detail.dosage}}
<text v-if='item.type==4'></text>
<text v-if='item.type!=4&&item.type!=5'></text>
</view>
</view>
2023-12-07 09:34:25 +08:00
2023-11-29 18:12:28 +08:00
<view class="action-detail">
<view class="title">
2023-12-09 17:07:42 +08:00
参与人
2023-11-29 18:12:28 +08:00
</view>
<view class="detail">
{{item.detail.user}}
</view>
</view>
<view class="action-detail" v-if="item.detail.start_date">
<view class="title">
{{item.type_text.slice(0, -2)}}开始时间
</view>
<view class="detail">
{{item.detail.start_date}}
</view>
</view>
<view class="action-detail" v-if="item.detail.end_date">
<view class="title">
{{item.type_text.slice(0, -2)}}结束时间
</view>
<view class="detail">
{{item.detail.end_date}}
</view>
</view>
<view class="action-detail-img">
<view class="title">
{{item.type_text.slice(0, -2)}}图片
</view>
2023-12-09 17:07:42 +08:00
2023-12-07 09:34:25 +08:00
<view class="detail-img" v-if="item.detail&&item.detail.pic&&item.detail.pic.length>0">
2023-12-13 18:55:18 +08:00
<u-swiper :list="item.detail.pic" @click="hdClick" indicator indicatorMode="dot"
circular></u-swiper>
<!-- <image @click="perviewFn(item.detail.pic)" :src="item.detail.pic[0]" mode="aspectFit">
</image> -->
2023-11-29 18:12:28 +08:00
</view>
</view>
</view>
<view class="shop_action-detail" v-if="item.type==3">
2023-12-07 09:34:25 +08:00
2023-11-29 18:12:28 +08:00
<view class="action-detail">
<view class="title">
灌溉面积
</view>
<view class="detail">
{{item.detail.area}}
</view>
</view>
2023-12-07 09:34:25 +08:00
<view class="action-detail">
<view class="title">
灌溉方式
</view>
<view class="detail">
2023-12-09 17:07:42 +08:00
{{item.detail.type==1?"喷灌":item.detail.type==2?"滴灌":"沟灌"}}
2023-12-07 09:34:25 +08:00
</view>
</view>
2023-12-09 17:07:42 +08:00
2023-11-29 18:12:28 +08:00
<view class="action-detail">
<view class="title">
2023-12-09 17:07:42 +08:00
参与人
2023-11-29 18:12:28 +08:00
</view>
<view class="detail">
{{item.detail.user}}
</view>
</view>
<view class="action-detail" v-if="item.detail.start_date">
<view class="title">
{{item.type_text.slice(0, -2)}}开始时间
</view>
<view class="detail">
{{item.detail.start_date}}
</view>
</view>
<view class="action-detail" v-if="item.detail.end_date">
<view class="title">
{{item.type_text.slice(0, -2)}}结束时间
</view>
<view class="detail">
{{item.detail.end_date}}
</view>
</view>
<view class="action-detail-img">
<view class="title">
灌溉图片
</view>
2023-12-07 09:34:25 +08:00
<view class="detail-img" v-if="item.detail&&item.detail.pic&&item.detail.pic.length>0">
<image @click="perviewFn(item.detail.pic)" :src="item.detail.pic[0]" mode="aspectFit">
</image>
2023-11-29 18:12:28 +08:00
</view>
</view>
</view>
<view class="shop_action-detail" v-if="item.type==5">
<view class="action-detail">
2023-12-07 09:34:25 +08:00
<view class="title" style="width: 200rpx;">
2023-11-29 18:12:28 +08:00
收获时间
</view>
<view class="detail">
{{item.create_time}}
</view>
</view>
<view class="action-detail">
<view class="title" style="width: 200rpx;">
2023-12-09 17:07:42 +08:00
参与人
2023-11-29 18:12:28 +08:00
</view>
<view class="detail">
{{item.detail.user}}
</view>
</view>
<view class="action-detail-img">
2023-12-07 09:34:25 +08:00
<view class="title">
2023-11-29 18:12:28 +08:00
收获图片
</view>
2023-12-07 09:34:25 +08:00
<view class="detail-img" v-if="item.detail&&item.detail.pic&&item.detail.pic.length>0">
<image @click="perviewFn(item.detail.pic)" :src="item.detail.pic[0]" mode="aspectFit">
</image>
2023-11-29 18:12:28 +08:00
</view>
</view>
</view>
</view>
</view>
</view>
2023-12-13 18:55:18 +08:00
2023-11-29 18:12:28 +08:00
</view>
</template>
<script setup>
import {
listForType
} from '@/api/api.js'
import {
ref,
reactive
} from "vue"
import {
onLoad,
onReady
} from "@dcloudio/uni-app"
const task_id = ref('');
const datalist = reactive([])
const daysDiff = ref('');
onLoad((options) => {
task_id.value = options.id
// if (options.task_id) {
// mode.value = "detail"
// }
getlist1(options.plant_id, options.type)
})
//获取详情
const getlist1 = (id, type) => {
listForType({
plant_id: id,
type: type
}).then((res) => {
if (res.code == 1) {
2023-12-07 09:34:25 +08:00
2024-03-06 17:40:26 +08:00
res.data.forEach(item=>{
datalist.push(item)
})
2023-12-13 18:55:18 +08:00
res.data.detai
// console.log(res.data)
2023-11-29 18:12:28 +08:00
}
});
};
//生长期计算
const getday = (data) => {
const start = new Date(data.plant_date);
const end = new Date(data.actions[data.actions.length - 1].create_time.split(' ')[0]);
const diffTime = Math.abs(end - start);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
daysDiff.value = diffDays
}
//查看图片
const perviewFn = (url) => {
uni.previewImage({
2023-12-07 09:34:25 +08:00
urls: url
2023-11-29 18:12:28 +08:00
})
}
2023-12-13 18:55:18 +08:00
const hdClick = (e) => {
console.log(e)
}
2023-11-29 18:12:28 +08:00
</script>
<style lang="scss">
page {
background-color: $theme-bg-color;
}
.content {
padding-top: 30rpx;
padding-bottom: 30rpx;
.banner {
width: 694rpx;
height: 484rpx;
margin: 0 auto;
}
.content-con-a {
padding: 0 32rpx;
margin-top: 30rpx;
.shop_detail {
.shop_detail-top {
margin-bottom: 28rpx;
}
.shop_detail-botm {
width: 694rpx;
padding: 35rpx 0;
background: #FFFFFF;
border-radius: 21rpx 21rpx;
.detail {
display: flex;
margin-bottom: 35rpx;
margin-left: 35rpx;
.detaila {
width: 200rpx;
}
.detailb {
width: 500rpx;
}
}
}
}
.shop_action {
margin-top: 42rpx;
2023-12-14 11:27:14 +08:00
2023-11-29 18:12:28 +08:00
.shop_action-title {
font-size: 33rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #333333;
margin-bottom: 28rpx;
}
.shop_action-detail {
width: 694rpx;
padding: 35rpx 0;
background: #FFFFFF;
border-radius: 21rpx 21rpx;
margin-bottom: 30rpx;
2023-12-14 11:27:14 +08:00
box-shadow: 1rpx 1rpx 10rpx 1rpx rgba(0, 0, 0, 0.1);
2023-11-29 18:12:28 +08:00
.action-detail {
display: flex;
padding-left: 35rpx;
margin-bottom: 25rpx;
.title {
width: 240rpx;
}
2023-12-07 09:34:25 +08:00
2023-11-29 18:12:28 +08:00
.detail {
width: 450rpx
}
}
.action-detail-img {
padding-left: 35rpx;
margin-bottom: 30rpx;
.title {
margin-bottom: 30rpx;
}
.detail-img {
width: 627rpx;
2023-12-14 11:27:14 +08:00
// height: 529rpx;
// background-color: red;
2023-12-07 09:34:25 +08:00
image {
width: 100%;
height: 100%;
}
2023-11-29 18:12:28 +08:00
}
}
}
}
}
}
2023-12-13 18:55:18 +08:00
.tit {
position: relative;
padding-left: 20rpx;
font-weight: bold;
margin-bottom: 20rpx;
}
.tit::before {
content: "";
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 0;
width: 3px;
/* 左边框的宽度 */
height: 30rpx;
2023-12-19 18:13:16 +08:00
background-color: #FFB049;
2023-12-13 18:55:18 +08:00
}
2023-11-29 18:12:28 +08:00
</style>