You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

193 lines
4.3 KiB

2 years ago
<style lang="scss" scoped>
.plant_plan{
.card{
&>.info{
display:flex;
image{
width:170rpx;
height:140rpx;
margin-right:20rpx;
position:relative;
border-radius: 20rpx;
&:before{
content:attr(data-type);
2 years ago
position:absolute;
top:0;
left:0;
border-radius: 20rpx 20rpx 20rpx 0;
background:rgba(60, 84, 44, 0.5);
color:#fff;
padding:6rpx 2rpx;
min-width:80rpx;
text-align: center;
}
}
&>.detail{
flex-grow: 1;
width:1rpx;
.name{
display:flex;
margin-bottom: 6rpx;
text{
&:first-child{
flex-shrink: 0;
font-size:20rpx;
color:#fff;
background:#10C176;
height:40rpx;
width:80rpx;
line-height: 40rpx;
text-align: center;
2 years ago
border-radius: 6rpx;
2 years ago
margin-right:12rpx;
}
&:nth-child(2){
font-weight: bold;
flex-grow: 1;
}
}
}
.batch,.recovery{
font-size:24rpx;
color:var(--c);
margin-bottom:6rpx;
}
.mu{
color:#10C176;
font-size:32rpx;
font-weight: bold;
&:after{
content:"亩";
}
}
}
}
&>.date{
border-top:2rpx solid rgba(216, 216, 216, 0.5);
margin-top:6rpx;
padding-top:12rpx;
display:flex;
align-items: center;
text{
flex-shrink: 0;
color:#999;
font-size:24rpx;
margin-right:auto;
}
button{
margin:0 0 0 20rpx;
color:rgba(var(--c),1);
background:rgba(var(--c),0.15);
height:48rpx;
font-size:24rpx;
padding:0 16rpx;
min-width:100rpx;
}
}
}
}
</style>
<template>
<view class="plant_plan">
<view class="card" v-for="(v,k) in list" :key="k">
<view class="info" @click="reDetail(v.id)">
<image :src="`${host}/${v.images}`" :data-type="v.plantType"/>
2 years ago
<view class="detail">
<view class="name">
<text>{{v.plantStandard}}</text> <text class="over">{{v.varietyName}}</text> <text class="plant-youbian"/>
2 years ago
</view>
<view class="batch" style="--c:#999;">种植批次号{{v.plantBatch}}</view>
<view class="recovery" style="--c:#FFC760;">已采收{{v.harvested}}kg</view>
<view class="mu">{{v.plantArea}}</view>
2 years ago
</view>
</view>
<view class="date">
<text>本次预估采收时间{{v.harvestTime}}</text>
<button class="cu-btn" style="--c:255, 196, 87;" @click.stop="finishPlant(v.id)">结束种植</button>
<button class="cu-btn" style="--c:153, 153, 153;" @click.stop="$u.route({url:'pages/massif/plant_info',params:{plantId:v.id,plotId:id}})">采收</button>
2 years ago
</view>
</view>
<u-empty v-if="list.length==0" icon="http://cdn.uviewui.com/uview/empty/data.png"/>
<button class="cu-btn round bg-green shadow submit" @click="addPlant">+新增种植计划</button>
2 years ago
</view>
</template>
<script>
import request,{host} from '@/common/request'
2 years ago
export default {
name:"plantPlan",
props:{
id:{
type:String,
default:""
}
},
2 years ago
data(){
return{
searchVal:{
pageNo:1,
pageSize:4
},
total:0,
list:[],
host:host(undefined,"/plant_manage/sys/common/static"),
}
},
created(){
this.search()
},
methods:{
clean(){
this.list=[]
this.total=0
this.searchVal.pageNo=1
},
async search(){
if(this.total==0||this.list.length<this.total){
var res=await request('/api/plantPlan/list',{
params: {
...this.searchVal,
plotId: this.id
}
})
if(res.statu){
this.list=this.list.concat(res.data.records)
this.total=res.data.total
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取地块列表失败!",
showCancel:false,
})
}
}
},
addPlant(){
uni.navigateTo({
url:`/pages/massif/plant_plan?plotId=${this.id}`,
event:{update:()=> {this.clean();this.search()} }
})
},
reDetail(id){
uni.navigateTo({
url:`/pages/massif/plant_plan?id=${id}`,
event:{update:()=> {this.clean();this.search()} }
})
},
//结束种植
async finishPlant(plantPlanId){
var res=await request("/api/plantPlan/finishPlant",{
params:{plantPlanId}
})
if(res.statu){
}else{
uni.showModal({
title:"提示",
content:res.msg||"结束种植失败!",
showCancel:false,
})
}
},
2 years ago
}
}
</script>