Browse Source

Merge remote-tracking branch 'origin/master'

master
马景富 2 years ago
parent
commit
f2ac3c8788
  1. 43
      pages/baseMana/formReacord.vue
  2. 59
      pages/home/index.vue
  3. 2
      pages/home/my.vue
  4. 227
      pages/home/news.vue
  5. 88
      pages/home/newsDetail.vue
  6. 5
      pages/massif/add_farming.vue
  7. 25
      pages/massif/mana/farmRecord.vue
  8. 234
      pages/massif/myPlant.vue
  9. 18
      pages/massif/pestRecord.vue
  10. 16
      pages/massif/pestType.vue
  11. 22
      router/home.js
  12. 11
      router/massif.js
  13. 1
      store/index.js
  14. 2
      uni.scss
  15. 57
      uni_modules/d-search/components/d-search/d-search.vue

43
pages/baseMana/formReacord.vue

@ -2,6 +2,36 @@
.container{
height:100%;
background:#f6f6f6;
&>.d-search{
&/deep/ .want_search{
.title{
color:#999;
font-size:24rpx;
font-weight: normal;
}
.content{
display:flex;
flex-wrap: wrap;
margin:14rpx -20rpx -20rpx 0;
text{
height:48rpx;
line-height: 48rpx;
border-radius: 30rpx;
width:calc(100%/5 - 20rpx);
text-align: center;
font-size:24rpx;
margin:0 20rpx 20rpx 0;
transition: all 0.3s;
color:#999;
background:#EEEEEE;
&.active{
color:#fff;
background:#10C176;
}
}
}
}
}
.date-range{
flex-shrink: 0;
@ -122,7 +152,12 @@
</style>
<template>
<view class="container flex">
<d-search :btn="false" v-model="searchVal.search" :selectVal="searchVal.value" :list="typeList" @select="searchVal.value=$event" @search="clean();search()"/>
<d-search :btn="false" popup ref="dSearch" v-model="searchVal.search" :selectVal="searchVal.value" @select="searchVal.value=$event" @search="clean();search()">
<text class="title">猜你想搜</text>
<view class="content">
<text v-for="(v,k) in typeList" :class="{active:v.value==searchVal.value}" :key="k" @click="select(v.value)">{{v.label}}</text>
</view>
</d-search>
<view class="date-range">
<picker mode="date" class="plant-youbian" :class="{noData:!searchVal.startTime}" :end="searchVal.endTime" @change="searchVal.startTime=$event.detail.value;clean();search()" >{{searchVal.startTime||"请选择开始时间"}}</picker>
@ -183,6 +218,12 @@ import request from '@/common/request.js'
this.search()
},
methods:{
select(e){
this.$refs.dSearch.show=false
this.searchVal.value=this.searchVal.value==e?'':e
this.clean()
this.search()
},
async init(){
var res=await request("/api/plantFarming/listFarmName")
if(res.statu){

59
pages/home/index.vue

@ -65,6 +65,41 @@
}
}
.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;
text{
&:before{
color:#31C888;
margin-right:14rpx;
}
&.line{
width:5rpx;
height: 52rpx;
background:rgba(216, 216, 216, 0.2);
margin:0 30rpx 0 auto;
}
}
}
}
&.mana{
width:calc(50% - 46rpx);
flex-shrink: 0;
@ -272,7 +307,21 @@
</swiper>
<image v-else class="head" src="@/static/banner.png" mode="aspectFit"/>
<swiper class="data" :display-multiple-items="2" circular>
<view class="area card">
<table>
<tr class="title"> <td>地块个数()</td><td>地块面积()</td><td>在种品种()</td><td>在种面积()</td> </tr>
<tr class="value"> <td>{{massif.plotNum}}</td><td>{{massif.totalArea}}</td><td>{{massif.plantArea}}</td><td>{{massif.productCount}}</td> </tr>
</table>
<view class="article">
<text class="plant-bijibenjilutongxunlu" @click="$u.route({url:'pages/massif/myPlant'})"/>
<text class="line"/>
<text class="plant-nongzi" style="margin-right:64rpx;" @click="$u.route({url:'pages/stock/mana'})">库存</text>
<text class="plant-caigou" @click="$u.route({url:'pages/purchase/apply'})">采购</text>
</view>
</view>
<!-- <swiper class="data" :display-multiple-items="2" circular>
<swiper-item>
<view data-title="地块个数()" style="--c:16, 193, 118;">
<text class="value">{{massif.plotNum}}</text>
@ -297,7 +346,7 @@
<text class="plant-zhongzhipinzhong"/>
</view>
</swiper-item>
</swiper>
</swiper> -->
<view style="display:flex;">
<view class="card mana">
<view class="title">
@ -318,7 +367,7 @@
<u-empty :show="stockList.length<=0" text=" " width="60%" icon="/static/noData.png"/>
</view>
</view>
<view style="display:flex;">
<!-- <view style="display:flex;">
<view class="card stock" style="margin-right:0px;--c:#10C176;" @click="$u.route({url:'pages/stock/mana'})">
<view class="title">库存管理</view>
@ -331,7 +380,7 @@
<view class="item warehousing">入库管理</view>
<view class="item lssue">出库管理</view>
</view>
</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>
@ -362,7 +411,7 @@
</template>
<script>
import request,{host} from '@/common/request.js'
import request,{host} from '@/common/request'
export default {
data() {
return {

2
pages/home/my.vue

@ -70,7 +70,7 @@
<view class="item" @click="$u.route({url:'/pages/stock/already'})">
<text class="plant-kufangguanli-lingyongguihuan"/> <text>领用记录</text> <text class="plant-youbian"/>
</view>
<view class="item">
<view class="item" @click="$u.route({url:'/pages/home/news'})">
<text class="plant-xitongxiaoxi"/> <text>系统消息</text> <text class="plant-youbian"/>
</view>
<view class="item" @click="$store.commit('outLogin')">

227
pages/home/news.vue

@ -0,0 +1,227 @@
<style lang="less" scoped>
.container{
height:100%;
background:#f6f6f6;
&>.d-search{
.u-tabs{
margin-top:-20rpx;
}
.tabs{
display:flex;
flex-wrap: wrap;
margin:20rpx -20rpx -15rpx 0;
text{
height:48rpx;
line-height: 48rpx;
background:rgba(238, 238, 238, 0.4);
color:#999;
font-size:24rpx;
border-radius: 48rpx;
min-width:110rpx;
padding:0 10rpx;
box-sizing: border-box;
text-align: center;
transition: all 0.3s;
margin:0 20rpx 15rpx 0;
&.active{
color:#fff;
background:#10C176;
}
}
}
}
scroll-view{
flex-grow: 1;
height:1rpx;
.card{
margin-top:0;
&>.info{
display:flex;
align-items: center;
&>.plant-xitongxiaoxi{
background:#10C176;
color:#fff;
width:90rpx;
height:90rpx;
line-height: 90rpx;
text-align: center;
border-radius: 50%;
position:relative;
margin-right:16rpx;
&:after{
content:"";
position:absolute;
background:red;
width:12rpx;
height:12rpx;
border-radius: 50%;
top:9rpx;
right:9rpx;
}
}
&>view{
flex-grow: 1;
width:1rpx;
.title{
display:flex;
align-items: center;
text{
&:first-child{
font-weight: bold;
}
&:nth-child(2){
margin:0 20rpx 0 18rpx;
color:#fff;
background:#10C176;
border-radius: 4rpx 40rpx 4rpx 40rpx;
height:34rpx;
line-height: 34rpx;
padding:0 10rpx;
min-width:80rpx;
text-align: center;
font-size:20rpx;
}
&:nth-child(3){
margin-left:auto;
}
}
}
.tabs{
display:flex;
flex-wrap: wrap;
margin:12rpx -18rpx -16rpx 0;
text{
border-radius: 44rpx;
margin:0 18rpx 16rpx 0;
font-size:24rpx;
height:44rpx;
line-height: 44rpx;
background-position: 20rpx 12rpx;
background-repeat: no-repeat;
color:rgba(var(--c),1);
background-color:rgba(var(--c),0.1);
padding-right:20rpx;
}
.germinate{
--c:15, 194, 119;
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAALCAYAAAB24g05AAAAAXNSR0IArs4c6QAAAYZJREFUKFOdkU1IVHEUxc957yE45YwKSRnUpp24dKELZ4YCMdFNJNWyRdDOr3lBkMzK0PmIEsFVqzDMlRsXBcObaBuCgRjMphREUOq9USqc9z/igGKKMHi3554f955D1DCXC8/aLNu8pNgFoonSqsA5v8m8YQ1+NBZTgcB6AN8oXRF5lYAjaakKuFQcbnfgDEHoAlkHaPlfxYz+vZ37AYGxz+4aoe8S7oIwMhxRuPe+fGdmhzEv9RTA9KEAYAPALwA3INh+ItOMD/ftaMvNOYvWIIC9CszAbjxbOLqcMc+doKV9iR0EegUJ4FcJpSAx9TDqua8rDiYdKa6K+VRO5rZPvv1fBg3eWL9Nzgq4BnEeMCuw2O53Zx6dl9XZENNpq74zuP6nJ78e+ei22nXmQTmRzdcOOLXZWEw9/h3PvL0wIOaNTfiJ7POaAZEvbqsT4okl3QMZGKlEoB+EF8K82936uYjBhfC4hVNkRgujL2jbfYBuEWyu6oIvahPkssL98SD5qnTkOwB+A5pVJ9wdJQAAAABJRU5ErkJggg==);
background-size:30rpx 22rpx;
padding-left:30rpx+25rpx;
}
.organ{
--c:248, 203, 54;
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAANCAYAAACdKY9CAAAAAXNSR0IArs4c6QAAAQ9JREFUKFOlUrtKA1EQPedeHxERFAQRCYK9GCW7Ivb+hEUqsbONhZVFCm0kYCPoD9gFS4tgYeFVsLBLmyaNWO5qmCOYjYJuksJphnmcmTMPIpPkIXoGuda3f7QEoSVgbyoOd+wH0sfoCKL/DZA0A+IAQLMQhR0moVwHXPFv5cxjuJTTIYHpQhTWmYRYA5O/AjoDUAIw+w+A0AV0QcemmTZIVAFm8+V2sBOjzq2bpnJ+fowTVwTjHtWBlGQATgHcSjgmuTUCkD+6YDVPNWjOj8fhfviWhNZrp12aW1jadbK3yc2n6xEA1QW8kFoF3IqXauy9BJbzCAlqOOpG8hVAi864//0aw473EcrbEt8NqnwCf8mG+U/vRGMAAAAASUVORK5CYII=);
background-size:26rpx 24rpx;
padding-left:26rpx+25rpx;
}
.type{
--c:235, 67, 118;
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAAXNSR0IArs4c6QAAASBJREFUKFN9kD0vQ2EYhq/7bUUklUhEYxAMNfsDJk0TGxN/wWJ0EpvExmjpajMYTAaDxSIWg1ERFh/toCGpr55bzkk1qmmf8cl9PR+XqvPRHfY+QRH9KvY2YkXVYmTgEFjCNIBmi8sghv7MSDNtwHapfv8+OlPZ/UhCV4W1wZHJoSpiuAV1AgltxxVJL0nA9ogUCj03YC8iPWBixDiQ/fdS10lz+ZOdsSRULUanwFxfIH0IPhMD2ANIj2rGURzClsT0r5hOS62Rtq8F5aZ9miHMWo4kXXZYSrW2AZ7q942p7MSrklYu5M8Qtz0B7POBz8zCV/Z7+Y3aXi6MHSHV+2xwjZhNiUnsG4I2kC5S4Lm4fqBYxwRWwekJ3aVEdtmi9AMqTJE6K1mcKgAAAABJRU5ErkJggg==);
background-size:24rpx 22rpx;
padding-left:24rpx+25rpx;
}
}
}
}
&>.content{
display:flex;
align-items: center;
margin-top:10rpx;
.fruit,.food{
margin-right:16rpx;
border-radius: 8rpx;
flex-shrink: 0;
height:44rpx;
line-height: 44rpx;
color:rgba(var(--c),1);
background:rgba(var(--c),0.1);
display:flex;
align-items: center;
padding:0 5rpx;
&:before{
content:"";
flex-shrink: 0;
margin-right:4rpx;
}
&:after{
flex-shrink: 0;
}
}
.fruit{
--c:248, 203, 54;
&:before{
width:29rpx;
height:21rpx;
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAALCAYAAACgR9dcAAAAAXNSR0IArs4c6QAAAitJREFUKFNVkV1Ik3EUxp//ecdm84ttMFHDGMYSbKaIbTPISTYzeJmDdiNUUhdZVHRRBEUXel1UBN6EF2LRRdEXIyiyG5sGGqkFUYph4i6knBs13Lv3/Z/YcsLOzTk8D7/DwzkCW6WqqtXutodGb40+Kmi5fjAUau/1Jf3js6WvUtoO98SzJy8KvsgN4fBRt6ZJf01D/Tm54bg2MjI0ntM7VLXt5OHkh/6uDXo7VyqjC/VxW+0P7+DpWDzn5+HW1tZql6tlyOl0RyrLa4zllY/Di4uxO2dPlKz2dSQtZhMjnSFMyAak06nUg5n3XU8vpabzcCAQMHn2hpbMZmtFWbnDvLAwuRmPf/r97t7a7u+zOu5SFezLVgQDNthShPJUevpXZu14HgZAp/oH32SySZ+mbaIzMGCdmbwiRnpfA/w/X1bfB8lN0AwdFos0Plds7C/A+Q2NjY325uaeaGXFTn9d7a7E1T1hW05nHUha6mSitIn0kqpMwmTr9B64ObUNHztz/vKh7iMDzCwAJiHIUISuFC7LTBJExBKSAf4yP5fdhtuDYSeb+YYQKGOIhACbpOSXRNTHzA8ZbIWAiyBaWPJ9kOIpiu1Tw9cJsELwOiTapNRuk2JRNWGMKUAdoDgUhoeZ/0iDxopgb09vUFHQzUATwN8YPAWQuvXTOcGoZgEHgPWp6PMLRXAkElFW/moXhUI+SKwKYXxlQd78O0BLzNIuWeiKMA3Hoo9//gNbO95NYH+HjwAAAABJRU5ErkJggg==);
}
&:after{
content:"水果";
}
}
.food{
--c:16, 193, 118;
&:before{
width:24rpx;
height:24rpx;
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAAXNSR0IArs4c6QAAAkRJREFUKFM1kF9IU2EYxr/v/Nk52s7cGp45qSTMMbNAmDRFCwSXHOtiSQhGkWVddFEXYRde1FUQNaOrLhIMQS8kb3YROOjCZJFRRoWKiLV0Ttf+tu0c5znnO9+3OELP5fs8P3ifBwIAgL9faldaitf2mwsDwtfaqep1x8zi2/Bn0zshSRzTnYtiQbMxBX4b+np6anK3d34rbRmHGTBln3f/4qa9ravvZxWfz8dqEv9RPaq4IYEl6H3etpC7sHWG0mhClRmCq4wK4AgrTnsWLm97UR5pSlTY9SCXirFVr8Cml63fdHdZZBQLZ9gQYrIWHdWVuZM/GnITxS4vIgS/SMRnP2ysDhVFkYKnRs49Tt5ZHa1ZrMtiq0EohQZyR9r+cCy401slOqPFvzip618eTU1I5rvQL/UfKQTi41qD3FGhgQowUDuXmvaulzz1K0xMrxeL1HqWXYmsVd/8FAlvQpPyDQdu5friIeGnM39X67NpShnJ2i7laSxCwFYBou/DpQT3/Vlo5jwcvHf/qYW3dCqOQqOI7HS78ziLCEZbpU22qZ79PxxIZA24vI1eQenqjdeS1NutaxqgaRZACAEh+CBIUTSoVCoAYwQsHA/m5iLz0H/xUtfQlcF3G7EY73K5AMswwDCMA4BhGIAMA6RSKdDibVbHJycDZgdq+MHosiiKx3jOgmmaIaqqUSbA8xzB2KBUTafT6XR8IvTk9EHps8GBYG3t4THBKgg2wUYnU3/2zLvbVXeoJJewrMhyJpMfiYbfhP8BZDwCZS4yOV4AAAAASUVORK5CYII=);
}
&:after{
content:"蔬菜";
}
}
.cause,.date{
color:#999;
font-size:24rpx;
}
}
}
}
}
</style>
<template>
<view class="container flex">
<d-search :btn="false" popup>
<u-tabs :list="[{name:'消息类型'},{name:'作物类型'}]" lineColor="#10C176" :activeStyle="{color:'#10C176'}" :inactiveStyle="{color:'#999'}" :itemStyle="{height:'60rpx'}" lineHeight="6rpx" lineWidth="96rpx"/>
<view class="tabs">
<text>害虫</text>
<text class="active">害虫</text>
</view>
</d-search>
<scroll-view scroll-y>
<view class="card" @click="$u.route({url:'/pages/home/newsDetail',params:{intoPage:'news'}})">
<view class="info">
<text class="plant-xitongxiaoxi"/>
<view>
<view class="title">
<text class="over">阳光玫瑰</text>
<text>病害</text>
<text class="plant-youbian"/>
</view>
<view class="tabs">
<text class="germinate">发芽</text>
<text class="organ"></text>
<text class="type">变色</text>
</view>
</view>
</view>
<view class="content">
<text class="fruit"/>
<text class="food"/>
<text class="cause over">由于叶子部位病变需要使用水溶肥部位病变需要使用水溶肥</text>
<text class="date">2023/2/27</text>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
export default {
data(){
return{
}
}
}
</script>

88
pages/home/newsDetail.vue

@ -0,0 +1,88 @@
<style lang="less" scoped>
.container{
padding:0 30rpx;
&>view{
display:flex;
align-items: center;
justify-content: space-between;
padding:20rpx 0;
&+view{
border-top:2rpx solid rgba(216, 216, 216, 0.2);
}
text{
&:first-child{
color:var(--b,#777);
margin-right:20rpx;
}
&:nth-child(2){
color:var(--f,#333);
font-size:var(--size,28rpx);
&.agr{
color:#10C176;
margin-top:13rpx;
}
&.account{
margin-top:13rpx;
padding:30rpx;
border-radius: 24rpx;
color:#999;
background: #F7F7F7;
}
}
}
&.info{
--b:#333;
--f:#777;
--size:24rpx;
}
&.vertical{
flex-direction: column;
align-items: flex-start;
}
}
}
</style>
<template>
<view class="container">
<view class="info">
<text>基本信息</text> <text>推送时间2023-02-28 10:23:56</text>
</view>
<view>
<text>品种名称</text> <text class="over">阳光玫瑰</text>
</view>
<view>
<text>作物类型</text> <text class="over">葡萄</text>
</view>
<view>
<text>生长过程</text> <text class="over">发芽</text>
</view>
<view>
<text>病虫害部位</text> <text class="over"></text>
</view>
<view>
<text>显著症状</text> <text class="over">变色</text>
</view>
<view class="vertical">
<text>推荐农资</text> <text class="agr">水溶肥复合肥氮肥</text>
</view>
<view class="vertical">
<text>推荐理由</text> <text class="account">由于叶子部位病变需要使用水溶肥内容这里是产品介绍内容这里是产品介绍内容这里是产品介绍内容这里是产品介绍内容这里是产品介绍内容</text>
</view>
</view>
</template>
<script>
export default {
data(){
return{
eventChannel:null,
}
},
onLoad(options){
this.eventChannel=this.getOpenerEventChannel()
uni.setNavigationBarTitle({
title:({farming:"农事记录",news:"消息详情"})[options.intoPage]
})
},
}
</script>

5
pages/massif/add_farming.vue

@ -208,7 +208,7 @@
<text class="title">操作</text> <text class="record">病虫害记录</text><text class="plant-youbian"/>
</view>
<view class="value" v-if="formData.farmPests">
过程:{{formData.farmPests.growthProcessLabel}}病虫害部位:{{formData.farmPests.pestSite}}症状{{formData.farmPests.symptomLabel}}({{formData.farmPests.pestName}})
过程:{{formData.farmPests.growthProcessLabel}}病虫害部位:{{formData.farmPests.pestSite}}症状{{formData.farmPests.symptomLabel}}({{formData.farmPests.pestName.map(v=>v.name).join(',')}})
</view>
</view>
<u-form class="inline" errorType="toast" :model="formData" :rules="rules" ref="form" labelWidth="auto">
@ -355,7 +355,8 @@ export default {
method:"post",
body:{
...this.formData,
images: this.fields.images.value
images: this.fields.images.value,
farmPests: Object.assign(this.formData.farmPests||{},{pestName:this.formData.farmPests?.pestName?.map?.(v=>v.id).join(",")||''})
}
})
if(res.statu){

25
pages/massif/mana/farmRecord.vue

@ -138,10 +138,10 @@
<text class="add" @click="toAdd">+添加农事</text>
</view>
<scroll-view scroll-y @scrolltolower="search">
<view class="card" v-for="(v,k) in list" :key="k">
<view class="card" v-for="(v,k) in list" :key="k" @click="toDetail(v.id)">
<template v-if="v.inputName">
<view class="name">
<text>{{v.type}}</text> <text>{{v.inputName}}</text> <text>{{v.inputTotal||0}}{{v.unit}}</text>
<text>{{v.type}}</text> <text>{{v.inputName}}</text> <text>{{v.inputTotal||0}}{{v.unit}}</text> <text class="plant-youbian"/>
</view>
<view class="tabs" v-if="v.growthProcess">
<text class="germinate">{{v.growthProcess}}</text>
@ -233,7 +233,26 @@ export default {
})
}
}
}
},
async toDetail(id){
var res=await request("/api/plantFarming/queryFarmDetailByFarmId",{
params:{id}
})
if(res.statu){
uni.navigateTo({
url:`/pages/home/newsDetail?id=${id}&intoPage=farming`,
success(res){
// res.ev
}
})
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取农事详情失败!",
showCancel:false,
})
}
},
}
}
</script>

234
pages/massif/myPlant.vue

@ -0,0 +1,234 @@
<style lang="less">
.container{
height:100%;
background:#f6f6f6;
scroll-view{
height:100%;
.items{
padding:30rpx 30rpx 0;
&+.items{
padding-bottom:30rpx;
}
}
.card{
margin:0;
&>.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{
display:flex;
align-items: center;
&>text.area{
color:#10C176;
font-size:32rpx;
font-weight: bold;
&:after{
content:"亩";
}
}
&>.farm{
font-size:22rpx;
color:#10C176;
height:40rpx;
line-height: 40rpx;
margin-left:18rpx;
background: rgba(16, 193, 119, 0.1);
padding:0 6rpx;
}
button{
margin:-20rpx 0 -20rpx auto!important;
padding:20rpx;
height: auto;
background: transparent;
}
}
}
}
&>.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;
}
}
}
}
}
</style>
<template>
<view class="container">
<scroll-view scroll-y @scrolltolower="search">
<view class="items" v-for="(v,k) in list" :key="k">
<view class="card">
<view class="info" @click="$u.route({url:'/pages/massif/mana/index',params:{id:v.plotId}})">
<u-image :data-type="v.plantType" radius="20rpx" width="170rpx" height="140rpx" mode="aspectFill" :src="`${host}/${v.images}`">
<text slot="error" style="font-size:45rpx;" class="plant-xiaopangchetupianjiazaishibai"/>
</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 over" style="--c:#999;">种植批次号{{v.plantBatch}}</view>
<view class="recovery" style="--c:#FFC760;">已采收{{v.harvested}}kg</view>
<view class="mu">
<text class="area">{{v.plantArea}}</text>
<text class="farm">农事操作{{v.farmNum||0}}</text>
</view>
</view>
</view>
<view class="date">
<text>预估采收日期{{v.harvestTime}}</text>
<button v-if="v.status==1" class="cu-btn" style="--c:255, 196, 87;" @click.stop="finishPlant(k)">结束种植</button>
<text v-else-if="v.status==2" class="over">已结束</text>
</view>
</view>
</view>
<u-empty v-if="list.length==0" text="为查询到相关信息" width="70%" icon="/static/noData.png"/>
</scroll-view>
</view>
</template>
<script>
import request,{host} from '@/common/request.js'
export default {
data(){
return{
host:host('imgUrl'),
list:[],
total:0,
searchVal:{
pageNo:1,
pageSize:6
},
}
},
onLoad(){
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,
baseId: this.$store.state.baseInfo.id,
}
})
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"})
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取地块列表失败!",
showCancel:false,
})
}
}
},
finishPlant(index){
uni.showModal({
title:"提示",
content:"确定结束种植!",
success: async e=>{
if(e.confirm){
var res=await request("/api/plantPlan/finishPlant",{
params:{plantPlanId:this.list[index].id}
})
if(res.statu){
uni.showToast({title:"结束成功!",duration:1500})
if(this.list.length>this.searchVal.pageSize+2){
this.list.splice(index,1)
}else{
this.clean()
this.search()
}
}else{
uni.showModal({
title:"提示",
content:res.msg||"结束种植失败!",
showCancel:false,
})
}
}
}
})
},
},
}
</script>

18
pages/massif/pestRecord.vue

@ -14,7 +14,7 @@
:field="k"
v-bind="v"
:required="!!rules[k]"
:value="/^checkBox$/.test(v.type)?fields[k].value:formData[k]"
:value="/^checkBox$|^navigate$/.test(v.type)?fields[k].value:formData[k]"
@input="formData[k]=$event"
@checkBox="fields[k].value=$event;formData[k]=$event.join(',')"
@select="formData[k]=$event[0].value;fields[k].value=$event[0].label"
@ -32,7 +32,16 @@ export default {
pestSite:{label:"病虫害部位",type:"checkBox",value:[],columns:[{label:"根",value:"根"},{label:"茎",value:"茎"},{label:"叶",value:"叶"}]},
growthProcess:{label:"作物生长过程",type:"select-tab",dictCode:"growth_process"},
symptom:{label:"显著症状",type:"select-tab",dictCode:"symptom"},
pestName:{label:"害虫名称",type:"navigate",btnFun:()=>uni.navigateTo({url:"/pages/massif/pestType",events:{type:e=>this.formData.pestName=e}})},
pestName:{label:"害虫名称",type:"navigate",value:"",btnFun:()=>uni.navigateTo({
url:"/pages/massif/pestType",
events:{type:e=>{
this.formData.pestName=e
this.fields.pestName.value=e.map(v=>v.name).join(",")
}},
success:res=>{
res.eventChannel.emit("ids",this.formData.pestName)
}
})},
medicationArea:{label:"农资作用面积",type:"digit",suffix:"亩"},
pic:{label:"凭证",type:"upImg",value:""},
description:{label:"病虫害描述",type:"textarea"},
@ -41,7 +50,7 @@ export default {
growthProcess:'',
pestSite:'',
symptom:"",
pestName:"",
pestName:[],
medicationArea:"",
pic:[],
description:"",
@ -50,7 +59,7 @@ export default {
growthProcess:{required:true,message:"请选择作物生长过程!",trigger:['blur','change']},
pestSite:{required:true,message:"请选择病虫害部位!",trigger:['blur','change']},
symptom:{required:true,message:"请选择显著症状!",trigger:['blur','change']},
pestName:{required:true,message:"请选择害虫!",trigger:['blur','change']},
pestName:{required:true,message:"请选择害虫!",type:"array",trigger:['blur','change']},
medicationArea:{required:true,message:"请输入农资作用面积!",type:"number",trigger:['blur','change']},
pic:{required:true,validator:(rule,val,call)=>{
if(!this.fields.pic.value)call(new Error("请选择凭证!"));
@ -67,6 +76,7 @@ export default {
this.fields.pestSite.value=e?.pestSite?.split?.(",")?.filter?.(v=>v)||[]
this.fields.growthProcess.value=e?.growthProcessLabel||""
this.fields.symptom.value=e?.symptomLabel||""
this.fields.pestName.value=e?.pestName?.map(v=>v.name).join(',')
this.formData=Object.assign(this.formData,{
...e,
pic:e?.pic?.split?.(",")?.filter?.(v=>v)||[]

16
pages/massif/pestType.vue

@ -112,7 +112,7 @@
<view class="title">害虫种类 <button class="cu-btn round sm" v-if="searchVal.value" @click="show=true">自定义+</button></view>
<scroll-view scroll-y>
<view class="items">
<text :class="{active:select==v}" v-for="(v,k) in list" :key="k" @click="select=v">{{v}}</text>
<text :class="{active:select.some(i=>i.id==v.id)}" v-for="(v,k) in list" :key="k" @click="selectPest(v)">{{v.name}}</text>
</view>
<u-empty :show="list.length<=0" text="为查询到相关信息" width="70%" icon="/static/noData.png"/>
</scroll-view>
@ -134,7 +134,7 @@ export default {
value:"",//
search:"",
},
select:"",
select:[],
eventChannel:null,
show:false,
}
@ -146,6 +146,7 @@ export default {
},
onLoad(){
this.eventChannel=this.getOpenerEventChannel()
this.eventChannel.on("ids",e=>this.select=e)
this.init()
},
methods:{
@ -168,7 +169,6 @@ export default {
async inputSearch(){
if(this.searchVal.search){
this.searchVal.value=""
this.select=""
var res=await request("/api/plantFarming/getPestByLike",{
params: {
@ -191,7 +191,6 @@ export default {
async agrSearch(e){
if(e){
this.searchVal={ value:e, search:"" }
this.select=""
if(typeof e=='string'){
var res=await request("/api/plantFarming/getPestByLike",{
params: {
@ -215,7 +214,7 @@ export default {
}
},
submit(){
if(this.select){
if(this.select.length>0){
this.eventChannel.emit("type", this.select)
uni.navigateBack()
}else{
@ -244,6 +243,13 @@ export default {
})
}
},
selectPest(e){
if(this.select.some(v=>v.id==e.id)){
this.select=this.select.filter(v=>v.id!=e.id)
}else{
this.select.push(e)
}
},
}
}
</script>

22
router/home.js

@ -66,4 +66,26 @@ module.exports=[
}
}
},
{
path:"pages/home/news",
style:{
navigationBarTitleText:"消息",
navigationBarBackgroundColor:"#10C176",
navigationBarTextStyle:"white",
"app-plus":{
titleNView:true
}
}
},
{
path:"pages/home/newsDetail",
style:{
navigationBarTitleText:"",
navigationBarBackgroundColor:"#10C176",
navigationBarTextStyle:"white",
"app-plus":{
titleNView:true
}
}
},
]

11
router/massif.js

@ -143,4 +143,15 @@ module.exports=[
}
}
},
{
path:"pages/massif/myPlant",
style:{
navigationBarTitleText:"我的种植",
navigationBarBackgroundColor:"#10C176",
navigationBarTextStyle:"white",
"app-plus":{
titleNView:true,
}
}
},
]

1
store/index.js

@ -6,7 +6,6 @@ export default new Vuex.Store({
state:{
userInfo:{},
token:"",
plantBaseInfoId:"",
baseInfo:{
id:"",
name:"",

2
uni.scss

@ -77,7 +77,7 @@ $uni-font-size-paragraph:15px;
@import '@/common/main.css';
@import 'uview-ui/theme.scss';
@import url('https://at.alicdn.com/t/c/font_3852037_8frcz777lb4.css');
@import url('https://at.alicdn.com/t/c/font_3852037_huussxt3ujw.css');
[class*=plant-]{
font-family: "plantMana" !important;
font-size: 16px;

57
uni_modules/d-search/components/d-search/d-search.vue

@ -40,36 +40,10 @@
transition: all 0.2s;
opacity:0;
&.show{
z-index: 320;
z-index: 310;
transform: scale(1);
opacity:1;
}
.title{
color:#999;
font-size:24rpx;
font-weight: normal;
}
.content{
display:flex;
flex-wrap: wrap;
margin:14rpx -20rpx -20rpx 0;
text{
height:48rpx;
line-height: 48rpx;
border-radius: 30rpx;
width:calc(100%/5 - 20rpx);
text-align: center;
font-size:24rpx;
margin:0 20rpx 20rpx 0;
transition: all 0.3s;
color:#999;
background:#EEEEEE;
&.active{
color:#fff;
background:#10C176;
}
}
}
}
&>.mask{
position:fixed;
@ -89,20 +63,17 @@
}
</style>
<template>
<view class="d-search" @click="isShow=false">
<view class="d-search" @click="show=false">
<view class="search" @click.stop="" :style="{'--bg':background}">
<u-icon name="search" color="#999999" size="20"/>
<input placeholder="请输入搜索内容" :value="(list.find(v=>v.value==value)||{label:''}).label||value" auto-blur @focus="isShow=true" @input="$emit('input',$event.detail.value)" @confirm="isShow=false;$emit('search')"/>
<input placeholder="请输入搜索内容" :value="value" auto-blur @focus="show=true" @input="$emit('input',$event.detail.value)" @confirm="show=false;$emit('search')"/>
<text class="plant-zengjia" v-if="value" @click="$emit('input','');$emit('search')"/>
<u-button type="primary" shape="circle" v-if="btn" color="#10C176" text="搜索" size="mini" @click="$emit('search')"/>
</view>
<view v-if="list.length>0" @click.stop="" class="want_search card" :class="{show:isShow}">
<text class="title">猜你想搜</text>
<view class="content">
<text v-for="(v,k) in list" :class="{active:v.value==selectVal}" :key="k" @click="$emit('select', v.value==selectVal?'':v.value);$emit('search')">{{v.label}}</text>
</view>
<view v-if="popup" @click.stop="" class="want_search card" :class="{show:show}">
<slot/>
</view>
<view class="mask" :class="{show:isShow}" v-if="list.length>0"/>
<view class="mask" :class="{show:show}" v-if="popup"/>
</view>
</template>
<script>
@ -112,14 +83,6 @@ export default {
type:String,
default:""
},
list:{
type:Array,
default:()=>[]
},
selectVal:{
type:[String,Number],
default:''
},
btn:{
type:Boolean,
default:true
@ -127,11 +90,15 @@ export default {
background:{
type:String,
default:"#fff"
}
},
popup:{
type:Boolean,
default:false
},
},
data(){
return{
isShow: false,
show: false,
}
},
methods:{

Loading…
Cancel
Save