Browse Source

地块管理 添加交易页面

master
邓宏 2 years ago
parent
commit
8c34eb0074
  1. 89
      pages/massif/add_transaction.vue
  2. 14
      pages/massif/mana/index.vue
  3. 21
      pages/massif/mana/plantPlan.vue
  4. 9
      pages/massif/mana/recovery.vue
  5. 144
      pages/massif/mana/transactions.vue
  6. 11
      router/massif.js
  7. 2
      uni_modules/d-form/components/d-form/d-form.vue

89
pages/massif/add_transaction.vue

@ -0,0 +1,89 @@
<style lang="scss">
.container{
min-height:100%;
background:#f6f6f6;
.info{
.name{
display:flex;
align-items: center;
text{
&:first-child{
color:#fff;
background:#10C176;
border-radius: 0 20rpx 0 20rpx;
padding:0 6rpx;
font-size:20rpx;
height:40rpx;
line-height: 40rpx;
margin-right: 20rpx;
}
}
}
.tip{
display:flex;
align-items: center;
margin-top:6rpx;
text{
&:first-child{
color:#FBA83C;
font-size:24rpx;
margin-right:auto;
}
&:nth-child(2){
color:#999;
font-size:20rpx;
}
}
}
}
}
</style>
<template>
<view class="container">
<view class="card info">
<view class="name">
<text>蔬菜</text> <text>精品小黄瓜</text>
</view>
<view class="tip">
<text>提示当前可交易数量150kg</text> <text>采收日期2022-12-26</text>
</view>
</view>
<view class="card">
<u-form class="inline" errorType="toast" :model="formData" ref="form" :rules="rules" labelWidth="auto">
<d-form label="交易重量" type="digit" suffix="kg"/>
<d-form label="规格" type="digit" suffix="kg"/>
<view style="display:flex;align-items: center;">
<d-form label="交易数量" type="digit" suffix="袋"/>
<text style="margin:45rpx 20rpx 0 20rpx;">/</text>
<d-form style="width:max-content;margin-top:40rpx;" type="select" placeholder=" " :columns="[]" :value="[]"/>
</view>
<d-form label="买方名称"/>
<d-form label="买方类型" type="select" :columns="[]" :value="[]"/>
<d-form label="收货地址" type="textarea"/>
</u-form>
</view>
</view>
</template>
<script>
export default {
data(){
return{
fields:{
weidth:{label:"交易重量",type:"digit",suffix:"kg"},
spcs:{label:"规格",type:"digit",suffix:"kg"},
num:{label:"交易数量",type:"digit",suffix:"袋", selectField:"sdf", columns:[]},
name:{label:"买方名称"},
type:{label:"买方类型",type:'select',columns:[],value:[]},
adder:{label:"收货地址",type:"textarea"}
},
formData:{
},
rules:{
}
}
}
}
</script>

14
pages/massif/mana/index.vue

@ -35,6 +35,9 @@
<swiper-item>
<recovery :plotId="plotId" ref="recovery"/>
</swiper-item>
<swiper-item>
<transactions :plotId="plotId" ref="transactions"/>
</swiper-item>
</swiper>
</view>
</template>
@ -42,17 +45,20 @@
import plantPlan from './plantPlan.vue'
import farmRecord from './farmRecord.vue'
import recovery from './recovery.vue'
import transactions from './transactions.vue'
import request from '@/common/request.js'
import {computeArea} from '@/common/utils'
export default {
components:{plantPlan,farmRecord,recovery},
components:{plantPlan,farmRecord,recovery,transactions},
data(){
return{
tabIndex:0,
tabs:[
{name:"种植计划",},
{name:"农事记录",},
{name:"采收记录",},
{name:"种植计划"},
{name:"农事操作"},
{name:"采收记录"},
{name:"交易记录"},
],
plotId:"",

21
pages/massif/mana/plantPlan.vue

@ -61,8 +61,7 @@
.mu{
display:flex;
align-items: center;
justify-content: space-between;
&>text{
&>text.area{
color:#10C176;
font-size:32rpx;
font-weight: bold;
@ -70,8 +69,17 @@
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!important;
margin:-20rpx 0 -20rpx auto!important;
padding:20rpx;
height: auto;
background: transparent;
@ -123,16 +131,17 @@
<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="`${host}/${v.images}`">
<view slot="error" style="font-size: 24rpx;">加载失败</view>
<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" style="--c:#999;">种植批次号{{v.plantBatch}}</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>{{v.plantArea}}</text>
<text class="area">{{v.plantArea}}</text>
<text class="farm">农事操作{{v.farmNum||0}}</text>
<button class="cu-btn bg-white sm plant-shanchu" v-if="v.status!=2" @click.stop="del(k)">删除</button>
</view>
</view>

9
pages/massif/mana/recovery.vue

@ -117,7 +117,9 @@
closeOnClickOverlay
@close="show=false"
@cancel="show=false"
:value="date"
: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')"
@confirm="searchVal[dateType]=new Date($event.value).format('yyyy-MM-dd');clean();search();show=false"/>
</view>
</template>
@ -146,11 +148,6 @@ export default {
total:0,
}
},
computed:{
date(){
return this.searchVal[this.dateType] || new Date().format('yyyy-MM-dd')
}
},
created(){
this.search()
},

144
pages/massif/mana/transactions.vue

@ -0,0 +1,144 @@
<style lang="scss">
.transaction{
height:100%;
display:flex;
flex-direction: column;
&>.dateRange{
flex-shrink: 0;
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;
color:#333;
border-radius: 8rpx;
padding:0 10rpx;
min-width:226rpx;
box-sizing: border-box;
&:before{
transform: rotate(90deg);
}
&.noDate{
color:#999;
}
}
&:nth-child(2){
color:#999;
padding:0 28rpx;
}
}
}
scroll-view{
flex-grow: 1;
height:1rpx;
.card{
margin-top:0;
display: flex;
.u-transition{
margin-right:20rpx;
}
.title{
font-weight: bold;
margin-bottom:6rpx;
}
.spec,.total{
font-size:24rpx;
color:#999;
margin-top:10rpx;
display:flex;
align-items: center;
text:first-child{
min-width:180rpx;
}
}
.total{
text:first-child{
color:#10C176;
font-weight: bold;
&:after{
content:"("attr(data-unit)")";
font-weight: normal;
}
}
}
}
}
}
</style>
<template>
<view class="transaction">
<view class="dateRange">
<text class="plant-youbian" :class="{noDate:!searchVal.startTime}" @click="dateType='startTime';show=true">{{searchVal.startTime||"请选择开始日期"}}</text>
<text>~</text>
<text class="plant-youbian" :class="{noDate:!searchVal.endTime}" @click="dateType='endTime';show=true">{{searchVal.endTime||"请选择结束日期"}}</text>
</view>
<scroll-view>
<view class="card" @click="$u.route({url:'/pages/massif/add_transaction'})">
<u-image radius="20rpx" width="130rpx" height="118rpx" mode="aspectFill" :src="`${host}/${1}`">
<text slot="error" style="font-size:45rpx;" class="plant-xiaopangchetupianjiazaishibai"/>
</u-image>
<view class="info">
<view class="title">精品小黄瓜</view>
<view class="spec">
<text>规格20kg/</text>
<text>云南云天化股份有限公司</text>
</view>
<view class="total">
<text data-unit="400kg">20</text>
<text>交易日期2022-12-12</text>
</view>
</view>
</view>
</scroll-view>
<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')"
@confirm="searchVal[dateType]=new Date($event.value).format('yyyy-MM-dd');clean();search();show=false"/>
</view>
</template>
<script>
import request,{host} from '@/common/request'
export default {
data(){
return{
show:false,
host:host('imgUrl'),
searchVal:{
startTime:"",
endTime:"",
},
dateType:"startTime",
}
},
created(){},
methods:{
clean(){
this.list=[]
this.total=0
this.searchVal.pageNo=1
},
async search(){
if(this.total==0||this.list.length<this.total){
}
},
}
}
</script>

11
router/massif.js

@ -101,4 +101,15 @@ module.exports=[
}
}
},
{
path:"pages/massif/add_transaction",
style:{
navigationBarTitleText:"交易信息",
navigationBarBackgroundColor:"#10C176",
navigationBarTextStyle:"white",
"app-plus":{
titleNView:true,
}
}
},
]

2
uni_modules/d-form/components/d-form/d-form.vue

@ -212,7 +212,7 @@
<u-form-item :class="{tip:!!tip, parallel:styleType=='parallel'}" :label="label" :prop="field" :required="required">
<view v-if="/^text$|^number$|^digit$|^password$/.test(type)" class="textinput">
<u-input :placeholder="placeholder||`请输入${label}`" :type="type" :disabled="disabled" :value="value" @input="$emit('input',$event)" @blur="/^number$|^digit$/.test(type) && $emit('input', parseFloat($event)||'')">
<text v-if="suffix" slot="suffix">{{suffix}}</text>
<text v-if="suffix" slot="suffix" style="color:#999;">{{suffix}}</text>
</u-input>
<button v-if="btnText || btnIcon" @click="btnFun" class="cu-btn bg-green shadow" :class="btnIcon">{{btnText}}</button>
</view>

Loading…
Cancel
Save