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.

227 lines
5.2 KiB

2 years ago
<style lang="scss" scoped>
.recovery{
2 years ago
height:100%;
display:flex;
flex-direction: column;
2 years ago
&>.dateRange{
2 years ago
flex-shrink: 0;
2 years ago
display: flex;
align-items: center;
margin:30rpx;
text{
&.plant-youbian{
display: flex;
align-items: center;
flex-direction: row-reverse;
justify-content: space-between;
background:#fff;
height:48rpx;
font-size:24rpx;
2 years ago
color:#333;
2 years ago
border-radius: 8rpx;
padding:0 10rpx;
min-width:226rpx;
box-sizing: border-box;
&:before{
transform: rotate(90deg);
}
2 years ago
&.noDate{
color:#999;
}
2 years ago
}
&:nth-child(2){
color:#999;
padding:0 28rpx;
}
}
}
2 years ago
scroll-view{
flex-grow: 1;
height:1rpx;
.card{
margin-top:0;
display:flex;
.u-transition{
flex-shrink: 0;
margin-right:20rpx;
}
.detail{
flex-grow: 1;
2 years ago
width:1rpx;
2 years ago
.name{
display: flex;
justify-content: space-between;
margin-bottom:15rpx;
text{
&:first-child{
font-weight: bold;
2 years ago
flex-grow: 1;
2 years ago
}
&:nth-child(2){
2 years ago
flex-shrink: 0;
2 years ago
font-weight: bold;
font-size:32rpx;
2 years ago
&:before{
content:"剩余:";
font-weight: normal;
font-size:24rpx;
}
2 years ago
&:after{
content:attr(data-unit);
font-weight: normal;
2 years ago
font-size:24rpx;
2 years ago
}
2 years ago
}
}
}
2 years ago
.info{
font-size: 24rpx;
color:#999;
display: flex;
align-items: center;
justify-content: space-between;
text.plant-jinrongjiaoyi{
display: flex;
align-items: center;
color:#10C176;
font-size:24rpx;
background:#EEFBF5;
height:48rpx;
line-height: 48rpx;
padding:0 10rpx;
&:before{
font-size:35rpx;
}
2 years ago
}
2 years ago
}
2 years ago
}
}
}
2 years ago
.u-popup{
flex:0;
}
2 years ago
}
</style>
<template>
<view class="recovery">
<view class="dateRange">
<text class="plant-youbian" :class="{noDate:!searchVal.startTime}" @click="dateType='startTime';show=true">{{searchVal.startTime||"请选择开始日期"}}</text>
2 years ago
<text>~</text>
<text class="plant-youbian" :class="{noDate:!searchVal.endTime}" @click="dateType='endTime';show=true">{{searchVal.endTime||"请选择结束日期"}}</text>
2 years ago
</view>
2 years ago
<scroll-view scroll-y @scrolltolower="search">
<view class="card" v-for="(v,k) in list" :key="k">
2 years ago
<u-image width="90rpx" height="90rpx" radius="6rpx" mode="aspectFill" :src="`${host}/${v.images}`">
<text slot="error" style="font-size:45rpx;" class="plant-xiaopangchetupianjiazaishibai"/>
</u-image>
<view class="detail">
<view class="name">
2 years ago
<text class="over">{{v.plantName}}</text>
2 years ago
<text data-unit="kg">{{v.harvestNum}}</text></view>
<view class="info">
<text class="people">负责人:{{v.principal}}</text>
<text class="date">采收日期:{{v.harvestTime}}</text>
<text class="plant-jinrongjiaoyi" v-if="v.harvestNum>0" @click="toAddTransaction(v)">交易</text>
</view>
2 years ago
</view>
</view>
2 years ago
<u-empty v-if="list.length==0" text="为查询到相关信息" width="70%" icon="/static/noData.png"/>
</scroll-view>
2 years ago
<u-datetime-picker
:show="show"
mode="date"
closeOnClickOverlay
@close="show=false"
@cancel="show=false"
:minDate="dateType=='endTime'&&searchVal.startTime?new Date(searchVal.startTime).getTime():new Date().set('y',-15).getTime()"
:maxDate="dateType=='startTime'&&searchVal.endTime?new Date(searchVal.endTime).getTime():new Date().set('y',15).getTime()"
:value="searchVal[dateType] || new Date().format('yyyy-MM-dd')"
2 years ago
@confirm="searchVal[dateType]=new Date($event.value).format('yyyy-MM-dd');clean();search();show=false"/>
2 years ago
</view>
</template>
<script>
2 years ago
import request,{host} from '@/common/request'
2 years ago
export default {
name:"recovery",
2 years ago
props:{
plotId:{
type:String,
default:""
2 years ago
},
plantId:{
type:String,
default:"",
}
2 years ago
},
2 years ago
data(){
return{
2 years ago
show:false,
dateType:"startTime",
2 years ago
host:host("imgUrl"),
searchVal:{
2 years ago
pageNo:1,
pageSize:5,
startTime:"",
endTime:"",
2 years ago
},
list:[],
total:0,
}
},
created(){
this.search()
},
methods:{
reSearch(){
this.clean()
this.search()
2 years ago
},
2 years ago
clean(){
2 years ago
this.list=[]
this.total=0
this.searchVal.pageNo=1
},
async search(){
2 years ago
if(this.total==0||this.list.length<this.total){
var res=await request("/api/plantHarvest/list",{
params:{
...this.searchVal,
2 years ago
plotId:this.plotId,
plantScheduleId: this.plantId,
2 years ago
}
})
if(res.statu){
this.list=this.list.concat(res.data.records)
this.total=res.data.total
this.searchVal.pageNo++
if(this.list.length==this.total)uni.showToast({title:"加载完成!",icon:"none"})
2 years ago
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取采收记录列表失败!",
showCancel:false,
})
}
}
},
toAddTransaction(e){
uni.navigateTo({
url:"/pages/massif/add_transaction",
events:{update:()=>{
this.clean()
this.search()
this.$emit("trigger",e.id)
}},
success(res){
res.eventChannel.emit('detail',e)
}
})
},
2 years ago
}
}
</script>