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.
226 lines
5.3 KiB
226 lines
5.3 KiB
<style lang="scss" scoped>
|
|
.plant_plan{
|
|
height:100%;
|
|
display:flex;
|
|
flex-direction: column;
|
|
scroll-view{
|
|
flex-grow: 1;
|
|
height:1rpx;
|
|
.card{
|
|
&>.info{
|
|
display:flex;
|
|
&>.u-transition{
|
|
position:relative;
|
|
margin-right:20rpx;
|
|
&:before{
|
|
content:attr(data-type);
|
|
position:absolute;
|
|
z-index: 30;
|
|
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;
|
|
border-radius: 6rpx;
|
|
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;
|
|
&.over{
|
|
background:#F7F7F7;
|
|
border-radius: 8rpx;
|
|
height:48rpx;
|
|
line-height: 48rpx;
|
|
padding:0 20rpx;
|
|
margin:0 0 0 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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
button{
|
|
flex-shrink: 0;
|
|
margin:20rpx auto!important;
|
|
}
|
|
}
|
|
</style>
|
|
<template>
|
|
<view class="plant_plan">
|
|
<scroll-view scroll-y @scrolltolower="search">
|
|
<view class="card" v-for="(v,k) in list" :key="k">
|
|
<view class="info" @click="reDetail(v.id)">
|
|
<u-image :data-type="v.plantType" radius="20rpx" width="170rpx" height="140rpx" mode="aspectFill" src="https://cdn.uviewui.com/uview/album/1.jpg">
|
|
<view slot="error" style="font-size: 24rpx;">加载失败</view>
|
|
</u-image>
|
|
<view class="detail">
|
|
<view class="name">
|
|
<text>{{v.plantStandard}}</text> <text class="over">{{v.varietyName}}</text> <text class="plant-youbian"/>
|
|
</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>
|
|
</view>
|
|
</view>
|
|
<view class="date">
|
|
<text>本次预估采收时间:{{v.harvestTime}}</text>
|
|
<template v-if="v.status==1">
|
|
<button class="cu-btn" style="--c:255, 196, 87;" @click.stop="finishPlant(k)">结束种植</button>
|
|
<button class="cu-btn" style="--c:153, 153, 153;" @click.stop="toAdd(v.id)">采收</button>
|
|
</template>
|
|
<text v-if="v.status==2" class="over">已结束</text>
|
|
</view>
|
|
</view>
|
|
<u-empty v-if="list.length==0" icon="http://cdn.uviewui.com/uview/empty/data.png"/>
|
|
</scroll-view>
|
|
|
|
<button class="cu-btn round bg-green shadow submit" @click="addPlant">+新增种植计划</button>
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import request,{host} from '@/common/request'
|
|
export default {
|
|
name:"plantPlan",
|
|
props:{
|
|
plotId:{
|
|
type:String,
|
|
default:""
|
|
}
|
|
},
|
|
data(){
|
|
return{
|
|
searchVal:{
|
|
pageNo:1,
|
|
pageSize:4
|
|
},
|
|
total:0,
|
|
list:[],
|
|
host:host("imgUrl"),
|
|
}
|
|
},
|
|
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.plotId
|
|
}
|
|
})
|
|
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.plotId}`,
|
|
events:{ update:()=> {this.clean();this.search()} }
|
|
})
|
|
},
|
|
reDetail(id){
|
|
uni.navigateTo({
|
|
url:`/pages/massif/plant_plan?id=${id}`,
|
|
event:{update:()=> {this.clean();this.search()} }
|
|
})
|
|
},
|
|
//结束种植
|
|
async finishPlant(index){
|
|
var res=await request("/api/plantPlan/finishPlant",{
|
|
params:{plantPlanId:this.list[index].id}
|
|
})
|
|
if(res.statu){
|
|
uni.showToast({title:"结束成功!",duration:1500})
|
|
this.list[index].status=2
|
|
}else{
|
|
uni.showModal({
|
|
title:"提示",
|
|
content:res.msg||"结束种植失败!",
|
|
showCancel:false,
|
|
})
|
|
}
|
|
},
|
|
//跳转新增采收页面
|
|
toAdd(plantId){
|
|
uni.navigateTo({
|
|
url:`/pages/massif/plant_info?plantId=${plantId}&plotId=${this.plotId}`,
|
|
events:{ toRecovery:()=> this.$emit("trigger",{tabIndex:2,plantId}) }
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|