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.
 
 
 
 
 

544 lines
22 KiB

<style lang="scss" scoped>
.container {
background:#F6F6F6;
padding-bottom:20rpx;
min-height:100%;
&>.top{
position:absolute;
top:0;
left:0;
width:100%;
z-index: 20;
padding:calc(var(--status-bar-height) + 10rpx) 30rpx 0;
color:#fff;
font-size:24rpx;
display:flex;
justify-content: space-between;
align-items: center;
background:rgba(0,0,0,0.1);
.plant-dingweixiao:before{
font-size:20rpx;
margin-right:5rpx;
}
}
&>.head{
padding:30rpx;
width:calc(100% - 60rpx);
background:#31C888;
height:290rpx;
margin-bottom:-80rpx;
border-radius: 0 0 80rpx 80rpx;
box-sizing:content-box;
}
swiper.headImg{
height:424rpx;
margin-bottom:-80rpx;
.u-transition{
height:100%;
&/deep/ image{
border-radius: 0 0 35rpx 35rpx!important;
}
}
}
.card{
&.area{
position:relative;
z-index: 20;
table{
width:100%;
border-bottom:2rpx solid rgba(216, 216, 216, 0.2);
tr{
&.title{
font-size:24rpx;
}
&.value{
color:#10C176;
font-size:32rpx;
font-weight: bold;
}
}
}
.article{
display:flex;
align-items: center;
padding-top:20rpx;
&>.plant{
flex-grow: 1;
display:flex;
align-items: center;
.u-transition{
position:relative;
&:before{
content:attr(data-num);
color:#fff;
position:absolute;
z-index: 10;
top:0;
left:0;
width: 100%;
height:100%;
font-size: 20rpx;
display: flex;
align-items: center;
justify-content: center;
text-shadow: 2rpx 2rpx 5rpx #000;
}
&+.u-transition{
margin-left:-12rpx;
}
&/deep/ .u-image__image,&/deep/ .u-image__error{
border:4rpx solid #fff;
}
.plant-xiaopangchetupianjiazaishibai{
&:before{
color:#999;
margin:0;
}
}
}
}
text{
&:before{
color:var(--c);
margin-right:14rpx;
}
&.line{
width:5rpx;
height: 52rpx;
background:rgba(216, 216, 216, 0.2);
margin:0 30rpx 0 auto;
}
}
}
}
&.base{
margin-top:0;
background:linear-gradient(#fff,#F1FBF6);
.title{
display:flex;
align-items: center;
&:before{
content:" ";
width:12rpx;
height:30rpx;
border-radius: 20rpx;
background:#10C176;
margin-right:14rpx;
}
.plant-jiantou_zuoyouqiehuan{
margin-left:auto;
color:#10C176;
font-size:28rpx;
&:before{
margin-right:8rpx;
color:#fff;
background:#10C176;
font-weight: normal;
border-radius: 50%;
width:34rpx;
height:34rpx;
text-align: center;
line-height: 34rpx;
}
}
}
.matter{
margin:20rpx 0;
padding-bottom:20rpx;
border-bottom:2rpx solid #D8D8D8;
display:flex;
align-items: center;
text{
flex-shrink: 0;
display: inline-flex;
align-items: center;
&:before{
color:rgba(var(--c),1);
margin-right:12rpx;
text-shadow: 6rpx -6rpx rgba(var(--c),0.3);
}
&.active{
color:rgba(var(--c),1);
}
&.more{
color:#999;
margin-left:auto;
}
}
}
.item{
display:flex;
align-items: center;
margin-top:40rpx;
&:before{
content:" ";
flex-shrink: 0;
width:20rpx;
height:20rpx;
margin-right:16rpx;
border-radius: 50%;
background-image:radial-gradient(rgba(var(--c),1) 2px, rgba(var(--c),0.3) 2.5px)
}
text{
&:first-child{
flex-shrink: 0;
min-width:90rpx;
color:#333333;
font-size:28rpx;
margin-right:20rpx;
}
}
}
}
&.butcher{
display:flex;
align-items: center;
margin:30rpx;
view{
display: flex;
flex-direction: column;
align-items: center;
&+view{
margin-left:120rpx;
}
&:before{
background-repeat: no-repeat;
background-size:100% 100%;
margin-bottom:5rpx;
content:"";
width:68rpx;
height:62rpx;
}
&.harvest:before{
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAAAXNSR0IArs4c6QAABsxJREFUWEe1ln9sVWcZxz/Pe+45t/e2l9JCGSuDQgWEiegcosQp6hISTSbTZIkuM9viHyZKzJapMSZsINExN2M2okvQxLj9s01McEtUYIwljI4MGJUC8nuDlkt/l/66vT/OOY95b3tpb9vbtUze5P5zzznP83m/z/d53lf4GOvxBo25IZF4lu+FyiMY9kqOnVs3SHKmYWWmHxTe37xPPy0OPxMlgb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cYHaTQC5o1DMLZEgaeUggOjNCyvIh9psTeSoxdRFhUmymhJH74yB6+dQhjHvjS82Kpu4029DqIMfwXFGdMyLDkvfbJAi/9XEw3DQ+V6OeTGy0UPYY850PbLbax/Ar+Q7HAkB0H0OStEmAWgmi0OF4gfkxezihVtX834yzxXXPfPgfT/Fevz9T1YIXASz7ryGmHHSJgnmr3WptmO7zjn8nBiVpmYm0iwyMv1zu3BRm7iMiFzP3kCC4iOFmTe3RwG6YRBdJwRsxMTHGQXyy3RFEH+jxeGLYKlYSKB0MNwj6y8TNYDdpE7/Q3EEE3fG2+JtENH/Vm2ci/waLuvV8ZtN9WgAAAABJRU5ErkJggg==);
}
}
}
}
&>.tabs{
display:flex;
margin:30rpx;
justify-content: space-between;
&>view{
height:108rpx;
width:calc(100%/2 - 10rpx);
padding:0 30rpx;
display: flex;
align-items: center;
border-radius: 20rpx;
box-shadow: 4rpx 4rpx 6rpx rgba(var(--c),0.1);
color:rgba(var(--c),1);
font-size:32rpx;
font-weight: bold;
&:before{
margin-right:6rpx;
font-size:40rpx;
font-weight: 100;
}
text{
font-weight: 100;
margin-left:auto;
font-size:20rpx;
}
&.plant-dikuaimianji{
--c:49, 200, 136;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='166.519' height='54' viewBox='0 0 166.519 54'%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill:%23f1fffa;%7D.b%7Bopacity:0.17;fill:url(%23a);%7D.c,.d%7Bopacity:0.1;%7D.c%7Bfill:url(%23c);%7D.d%7Bfill:url(%23d);%7D%3C/style%3E%3ClinearGradient id='a' x1='0.5' x2='0.5' y2='1' gradientUnits='objectBoundingBox'%3E%3Cstop offset='0' stop-color='%2331c888'/%3E%3Cstop offset='1' stop-color='%2366febd'/%3E%3C/linearGradient%3E%3ClinearGradient id='c' x1='0.887' y1='-0.116' x2='0.064' y2='0.953' gradientUnits='objectBoundingBox'%3E%3Cstop offset='0' stop-color='%2310c176'/%3E%3Cstop offset='1' stop-color='%23f3fcf7'/%3E%3C/linearGradient%3E%3ClinearGradient id='d' x1='0.678' y1='1.074' x2='0.853' y2='0.091' gradientUnits='objectBoundingBox'%3E%3Cstop offset='0' stop-color='%2331c888'/%3E%3Cstop offset='1' stop-color='%23fff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect class='a' width='166' height='54' rx='12' transform='translate(0)'/%3E%3Ccircle class='b' cx='4.5' cy='4.5' r='4.5' transform='translate(99.816 22.069)'/%3E%3Ccircle class='b' cx='3' cy='3' r='3' transform='translate(31.886 11.889)'/%3E%3Cpath class='c' d='M8,35.486a8,8,0,0,1-8-8V.034a30.214,30.214,0,0,1,9.28,1A30.239,30.239,0,0,1,31.236,35.486Z' transform='translate(0 16.514)'/%3E%3Cpath class='d' d='M40.819,35.8,0,.319Q.071.16.143,0h82.4L52.106,35.014a8,8,0,0,1-11.286.789Z' transform='translate(83.976 0)'/%3E%3C/svg%3E");
}
&.plant-cangkuguanliguanli{
--c:76, 167, 255;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='166.519' height='54' viewBox='0 0 166.519 54'%3E %3Cdefs%3E %3Cstyle%3E.a%7Bfill:%23ecf5ff;%7D.b,.c%7Bopacity:0.17;%7D.b%7Bfill:url(%23c);%7D.c%7Bfill:url(%23d);%7D.d,.e%7Bopacity:0.1;%7D.d%7Bfill:url(%23e);%7D.e%7Bfill:url(%23f);%7D.f%7Bfilter:url(%23a);%7D%3C/style%3E %3Cfilter id='a' x='0' y='0' width='184' height='72' filterUnits='userSpaceOnUse'%3E %3CfeOffset dy='3' input='SourceAlpha'/%3E %3CfeGaussianBlur stdDeviation='3' result='b'/%3E %3CfeFlood flood-opacity='0.102'/%3E %3CfeComposite operator='in' in2='b'/%3E %3CfeComposite in='SourceGraphic'/%3E %3C/filter%3E %3ClinearGradient id='c' x1='0.5' x2='0.5' y2='1' gradientUnits='objectBoundingBox'%3E %3Cstop offset='0' stop-color='%234ca7ff'/%3E %3Cstop offset='1' stop-color='%23a2d0ff'/%3E %3C/linearGradient%3E %3ClinearGradient id='d' x1='0.5' x2='0.5' y2='1' gradientUnits='objectBoundingBox'%3E %3Cstop offset='0' stop-color='%234ca7ff'/%3E %3Cstop offset='1' stop-color='%23dfeefe'/%3E %3C/linearGradient%3E %3ClinearGradient id='e' x1='0.887' y1='-0.116' x2='0.064' y2='0.953' gradientUnits='objectBoundingBox'%3E %3Cstop offset='0' stop-color='%234ca7ff'/%3E %3Cstop offset='1' stop-color='%23f3fcf7'/%3E %3C/linearGradient%3E %3ClinearGradient id='f' x1='0.678' y1='1.074' x2='0.853' y2='0.091' gradientUnits='objectBoundingBox'%3E %3Cstop offset='0' stop-color='%234ca7ff'/%3E %3Cstop offset='1' stop-color='%23fff'/%3E %3C/linearGradient%3E %3C/defs%3E %3Crect class='a' width='166' height='54' rx='12' transform='translate(0)'/%3E %3Ccircle class='b' cx='4.5' cy='4.5' r='4.5' transform='translate(99.816 22.069)'/%3E %3Ccircle class='c' cx='3' cy='3' r='3' transform='translate(31.886 11.889)'/%3E %3Cpath class='d' d='M8,35.486a8,8,0,0,1-8-8V.034a30.214,30.214,0,0,1,9.28,1A30.239,30.239,0,0,1,31.236,35.486Z' transform='translate(0 16.514)'/%3E %3Cpath class='e' d='M40.819,35.8,0,.319Q.071.16.143,0h82.4L52.106,35.014a8,8,0,0,1-11.286.789Z' transform='translate(83.976 0)'/%3E %3C/svg%3E");
}
}
}
.u-popup{
&/deep/ .u-popup__content{
border-radius: 24rpx 24rpx 0 0;
padding-top:90px;
background-image:url(@/static/home_picker_head.png);
background-repeat: no-repeat;
background-size:100% 90px;
}
}
}
</style>
<template>
<view class="container">
<view class="top">
<text class="plant-dingweixiao" @click="!adderss.isOk && refreshPosition()">{{adderss.isOk?`${adderss.city}${adderss.district}`:"点击重新获取定位"}}</text> <text class="date">{{new Date().format("M月 d日")}}</text>
</view>
<swiper autoplay :interval="5*1000" v-if="headImgs.length>0" class="headImg" circular>
<swiper-item v-for="(v,k) in headImgs" :key="k">
<u-image :src="`${host}/${v}`" width="100%" height="100%" mode="aspectFill">
<text slot="error" class="plant-xiaopangchetupianjiazaishibai"/>
</u-image>
</swiper-item>
</swiper>
<image v-else class="head" src="@/static/banner.png" mode="aspectFit"/>
<view class="area card">
<table>
<tr class="title"> <td>地块个数()</td><td>地块面积()</td><td>在种面积()</td><td>在种品种()</td> </tr>
<tr class="value">
<td>{{massif.plotNum||0}}</td>
<td>{{massif.totalArea||0}}</td>
<td>{{massif.plantArea||0}}</td>
<td>{{massif.productCount||0}}</td>
</tr>
</table>
<view class="article">
<view class="plant" @click="$u.route({url:'pages/massif/myPlant'})">
<text class="plant-bijibenjilutongxunlu" style="--c:#FCA606;"/>
<u-image
v-for="(v,k) in (massif.images||[])" :key="k" mode="aspectFill"
width="60rpx"
height="50rpx"
radius="16rpx"
:data-num="param.imgNum((massif.images||[]).length,k)"
:src="`${host}/${v}`">
<text slot="error" class="plant-xiaopangchetupianjiazaishibai"/>
</u-image>
</view>
<text class="line"/>
<text class="plant-nongzi" style="margin-right:64rpx;--c:#4CA7FF;" @click="$u.route({url:'pages/stock/mana'})">库存</text>
<text class="plant-shumiao" style="--c:#EB4376;" @click="$u.route({url:'pages/seeding/info'})">种苗</text>
</view>
</view>
<view class="tabs">
<view class="plant-dikuaimianji" @click="$u.route({url:'pages/massif/index'})">基地 <text>更多>></text></view>
<view class="plant-cangkuguanliguanli" @click="$u.route({url:'pages/warehouse/mana'})">仓库 <text>更多>></text></view>
</view>
<view class="card butcher">
<view class="harvest" @click="$u.route({url:'/pages/base/outRecord'})">收获</view>
<view class="business" @click="$u.route({url:'/pages/base/businessRecord'})">交易</view>
</view>
<view class="card base">
<view class="title">
{{$store.state.baseInfo.name||'基地管理'}} <text class="plant-jiantou_zuoyouqiehuan" v-if="isAdmin" @click="show=true">切换基地</text>
</view>
<view class="matter">
<text class="plant-jilu" :class="{active:baseIndex=='record'}" style="--c:16, 193, 118;margin-right:40px;" @click="baseIndex=='record'?baseIndex='':baseIndex='record'">农事记录</text>
<text class="plant-tourupin" :class="{active:baseIndex=='input'}" style="--c:255, 195, 83;" @click="baseIndex=='input'?baseIndex='':baseIndex='input'">投入品</text>
<text class="more" @click="$u.route({url:'/pages/baseMana/formReacord'})">更多>></text>
</view>
<template v-if="!baseIndex || baseIndex=='record'">
<view v-for="(v,k) in baseInfo.farmWork||[]" :key="`${k}_work`" class="item" style="--c:16, 193, 118;">
<text>农事</text>
<u-notice-bar style="padding:0rpx;" icon="" speed="45" color="#777" bgColor="" :text="`${v.userName}${new Date(v.time).format('yyyy-MM-dd')}日完成了${v.plotName}${v.farmWorkName}任务`"/>
</view>
</template>
<template v-if="!baseIndex || baseIndex=='input'">
<view v-for="(v,k) in baseInfo.farmingInput||[]" :key="`${k}_input`" class="item" style="--c:255, 195, 83;">
<text>投入品</text>
<u-notice-bar style="padding:0rpx;" icon="" speed="45" color="#777" bgColor="" :text="`${v.userName}${new Date(v.time).format('yyyy-MM-dd')}日完成了${v.plotName}${v.farmWorkName}任务`"/>
</view>
</template>
<u-empty :show="isEmpty" text="为查询到相关信息" width="50%" icon="/static/noData.png"/>
</view>
<u-picker v-if="isAdmin" :show="show" :columns="plantBase" keyName="baseName" closeOnClickOverlay @close="show=false" @confirm="$store.commit('setBaseId', {id:$event.value[0].id,name:$event.value[0].baseName});show=false" @cancel="show=false"/>
</view>
</template>
<script lang="wxs" module="param">
module.exports={
imgNum(len,index){
return len-1==index?'30+':''
}
}
</script>
<script>
import request,{host} from '@/common/request'
export default {
data() {
return {
host:host('imgUrl'),
headImgs:[],
show:false,
plantBase:[[]],
massif:{images:[]},
baseInfo:{},
baseIndex:"",
stockList:[],
adderss:{},
}
},
computed:{
isAdmin(){
return this.$store.getters.userInfo.roleCode=='company_admin'
},
isEmpty(){
if(!this.baseIndex)return (this.baseInfo.farmWork||[]).length+(this.baseInfo.farmingInput||[]).length<=0
else if(this.baseIndex=='record')return (this.baseInfo.farmWork||[]).length<=0
else return (this.baseInfo.farmingInput||[]).length<=0
},
},
watch:{
"$store.state.baseInfo.id"(n){
this.getMassif()
this.getBaseInfo()
this.getStock()
}
},
onLoad() {
this.getHeadImg()
if(this.isAdmin){
this.getPlantBase()
}else{
this.$store.commit("setBaseId", {
id: this.$store.getters['userInfo'].plantBaseInfoId,
name: this.$store.getters['userInfo'].plantBaseInfoName
})
}
this.$provise.on("updateMassif", this.getMassif)
this.$provise.on("updateStock", this.getStock)
//#ifdef APP-PLUS
uni.getLocation({
type:"gcj02",
geocode:true,
isHighAccuracy:true,
success:res=>{
this.adderss={
...res.address,
longitude:res.longitude,
latitude:res.latitude,
isOk:true
}
}
})
//#endif
},
methods: {
async getHeadImg(){
var res=await request("/base/api/plantCompany/queryCompanyPicById")
if(res.statu){
this.headImgs=res.data
}
},
//获取地块信息
async getMassif(){
if(this.$store.state.baseInfo.id){
var res=await request("/api/plantIndex/queryPlot",{
params:{plantBaseId: this.$store.state.baseInfo.id}
})
if(res.statu){
this.massif={
...res.data,
images:res.data.images.slice(0,3)
}
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取地块信息失败!",
showCancel:false,
})
}
}
},
//获取基地列表
async getPlantBase(){
var res=await request("/api/plantPlot/getAllPlantBaseInfo",{
params:{companyId:this.$store.getters.userInfo.companyId}
})
if(res.statu){
if(res.data.length>0){
this.plantBase=[res.data]
this.$store.commit("setBaseId", {id:res.data[0].id,name:res.data[0].baseName})
}else{
uni.showToast({title:"请在管理端维护基地!",icon:"none",duration:3000})
}
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取基地列表失败!",
showCancel:false,
})
}
},
//获取基地名称
// async getBaseName(plantBaseInfoId){
// var res=await request("/api/purchase/purchaseUserShow",{
// params:{plantBaseInfoId}
// })
// if(res.statu){
// this.$store.commit("setBaseId", {id:plantBaseInfoId,name:res.data.baseName})
// }else{
// uni.showModal({
// title:"提示",
// content:res.msg||"获取基地名称失败!",
// showCancel:false,
// })
// }
// },
async getBaseInfo(){
if(this.$store.state.baseInfo.id){
var res=await request("/api/plantIndex/queryFarmWorkAndInput",{
params:{plantBaseId: this.$store.state.baseInfo.id}
})
if(res.statu){
this.baseInfo=res.data
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取基地管理信息失败!",
showCancel:false,
})
}
}
},
// 获取仓库
async getStock(){
if(this.$store.state.baseInfo.id){
var res=await request("/api/plantIndex/queryWarehouse",{
params:{baseId: this.$store.state.baseInfo.id}
})
if(res.statu){
this.stockList=res.data
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取仓库信息失败!",
showCancel:false,
})
}
}
},
//重新定位
refreshPosition(){
uni.getLocation({
type:"gcj02",
geocode:true,
isHighAccuracy:true,
success:res=>{
this.adderss={
...res.address,
longitude:res.longitude,
latitude:res.latitude,
isOk:true
}
},
fail(){
uni.showModal({
title:"提示",
content:"获取定位失败!",
showCancel:false,
})
},
})
},
},
onUnload(){
this.$provise.off("updateMassif")
this.$provise.off("updateStock")
},
}
</script>