|
@ -39,67 +39,79 @@ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
.company{ |
|
|
} |
|
|
text{ |
|
|
|
|
|
font-size:24rpx; |
|
|
.u-popup{ |
|
|
&:first-child{ |
|
|
.u-popup__content{ |
|
|
color:#FBA83C; |
|
|
&>.btns{ |
|
|
margin-right:16rpx; |
|
|
display:flex; |
|
|
} |
|
|
justify-content: space-between; |
|
|
&:nth-child(2){ |
|
|
padding:10rpx; |
|
|
color:#999; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
picker-view{ |
|
|
|
|
|
height:500rpx; |
|
|
|
|
|
picker-view-column{ |
|
|
|
|
|
view.item{ |
|
|
|
|
|
padding:0 30rpx; |
|
|
|
|
|
display:flex; |
|
|
|
|
|
flex-direction: column; |
|
|
|
|
|
justify-content: space-evenly; |
|
|
|
|
|
.name{ |
|
|
|
|
|
display:flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
text{ |
|
|
|
|
|
font-size:16rpx; |
|
|
|
|
|
&:first-child{ |
|
|
|
|
|
color:#fff; |
|
|
|
|
|
background:#10C176; |
|
|
|
|
|
border-radius:0 20rpx 0 20rpx; |
|
|
|
|
|
width:80rpx; |
|
|
|
|
|
height:34rpx; |
|
|
|
|
|
text-align: center; |
|
|
|
|
|
line-height: 34rpx; |
|
|
|
|
|
margin-right:16rpx; |
|
|
|
|
|
} |
|
|
|
|
|
&:nth-child(2){ |
|
|
|
|
|
font-weight: bold; |
|
|
|
|
|
font-size:20rpx; |
|
|
|
|
|
} |
|
|
|
|
|
&:nth-child(3){ |
|
|
|
|
|
color:#999; |
|
|
|
|
|
margin-left:6rpx; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
.company{ |
|
|
|
|
|
font-size:16rpx; |
|
|
|
|
|
&:before{ |
|
|
|
|
|
content:attr(data-name); |
|
|
|
|
|
color:#FBA83C; |
|
|
|
|
|
margin-right:20rpx; |
|
|
|
|
|
} |
|
|
|
|
|
&:after{ |
|
|
|
|
|
content:attr(data-company); |
|
|
|
|
|
color:#999999; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// .u-popup{ |
|
|
|
|
|
// .u-popup__content{ |
|
|
|
|
|
// &>.btns{ |
|
|
|
|
|
// display:flex; |
|
|
|
|
|
// justify-content: space-between; |
|
|
|
|
|
// padding:10rpx; |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// picker-view{ |
|
|
|
|
|
// height:500rpx; |
|
|
|
|
|
// picker-view-column{ |
|
|
|
|
|
// view.item{ |
|
|
|
|
|
// padding:0 30rpx; |
|
|
|
|
|
// display:flex; |
|
|
|
|
|
// flex-direction: column; |
|
|
|
|
|
// justify-content: space-evenly; |
|
|
|
|
|
// .name{ |
|
|
|
|
|
// display:flex; |
|
|
|
|
|
// align-items: center; |
|
|
|
|
|
// text{ |
|
|
|
|
|
// font-size:16rpx; |
|
|
|
|
|
// &:first-child{ |
|
|
|
|
|
// color:#fff; |
|
|
|
|
|
// background:#10C176; |
|
|
|
|
|
// border-radius:0 20rpx 0 20rpx; |
|
|
|
|
|
// width:80rpx; |
|
|
|
|
|
// height:34rpx; |
|
|
|
|
|
// text-align: center; |
|
|
|
|
|
// line-height: 34rpx; |
|
|
|
|
|
// margin-right:16rpx; |
|
|
|
|
|
// } |
|
|
|
|
|
// &:nth-child(2){ |
|
|
|
|
|
// font-weight: bold; |
|
|
|
|
|
// font-size:20rpx; |
|
|
|
|
|
// } |
|
|
|
|
|
// &:nth-child(3){ |
|
|
|
|
|
// color:#999; |
|
|
|
|
|
// margin-left:6rpx; |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// .company{ |
|
|
|
|
|
// font-size:16rpx; |
|
|
|
|
|
// &:before{ |
|
|
|
|
|
// content:attr(data-name); |
|
|
|
|
|
// color:#FBA83C; |
|
|
|
|
|
// margin-right:20rpx; |
|
|
|
|
|
// } |
|
|
|
|
|
// &:after{ |
|
|
|
|
|
// content:attr(data-company); |
|
|
|
|
|
// color:#999999; |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
.agr-picker{ |
|
|
.agr-picker{ |
|
|
padding:0 30rpx; |
|
|
padding:0 30rpx; |
|
|
display:flex; |
|
|
display:flex; |
|
@ -109,37 +121,37 @@ |
|
|
display:flex; |
|
|
display:flex; |
|
|
align-items: center; |
|
|
align-items: center; |
|
|
text{ |
|
|
text{ |
|
|
font-size:16rpx; |
|
|
|
|
|
&:first-child{ |
|
|
&:first-child{ |
|
|
|
|
|
flex-shrink: 0; |
|
|
color:#fff; |
|
|
color:#fff; |
|
|
|
|
|
font-size:20rpx; |
|
|
|
|
|
border-radius: 0px 20rpx 0px 20rpx; |
|
|
background:#10C176; |
|
|
background:#10C176; |
|
|
border-radius:0 20rpx 0 20rpx; |
|
|
|
|
|
width:80rpx; |
|
|
width:80rpx; |
|
|
height:34rpx; |
|
|
height:40rpx; |
|
|
text-align: center; |
|
|
text-align: center; |
|
|
line-height: 34rpx; |
|
|
line-height: 40rpx; |
|
|
margin-right:16rpx; |
|
|
margin-right:10rpx; |
|
|
} |
|
|
} |
|
|
&:nth-child(2){ |
|
|
&:nth-child(2){ |
|
|
|
|
|
flex-grow: 1; |
|
|
|
|
|
display:flex; |
|
|
|
|
|
align-items: center; |
|
|
font-weight: bold; |
|
|
font-weight: bold; |
|
|
font-size:20rpx; |
|
|
margin-right:20rpx; |
|
|
} |
|
|
|
|
|
&:nth-child(3){ |
|
|
|
|
|
color:#999; |
|
|
|
|
|
margin-left:6rpx; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
.company{ |
|
|
.company{ |
|
|
font-size:16rpx; |
|
|
text{ |
|
|
&:before{ |
|
|
font-size:24rpx; |
|
|
content:attr(data-name); |
|
|
&:first-child{ |
|
|
color:#FBA83C; |
|
|
color:#FBA83C; |
|
|
margin-right:20rpx; |
|
|
margin-right:16rpx; |
|
|
} |
|
|
} |
|
|
&:after{ |
|
|
&:nth-child(2){ |
|
|
content:attr(data-company); |
|
|
color:#999; |
|
|
color:#999999; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -148,32 +160,29 @@ |
|
|
<template> |
|
|
<template> |
|
|
<view class="container"> |
|
|
<view class="container"> |
|
|
<d-navbar style="--bg:#10C176;--c:#fff;" isBack text="农资规格"> |
|
|
<d-navbar style="--bg:#10C176;--c:#fff;" isBack text="农资规格"> |
|
|
<button slot="right" class="cu-btn round">确定</button> |
|
|
<button slot="right" class="cu-btn round" @click="submit">确定</button> |
|
|
</d-navbar> |
|
|
</d-navbar> |
|
|
|
|
|
|
|
|
<view class="card info"> |
|
|
<view class="card info"> |
|
|
<view class="name"> |
|
|
<view class="name"> |
|
|
<text>化肥</text> <text>中量元素水溶肥</text> <text @click="$refs.dPicker.show=true" class="plant-jiantou_zuoyouqiehuan"/> |
|
|
<text>{{agrDetail.parentName}}</text> <text>{{agrDetail.name}}</text> <text @click="$u.route({type:'navigateBack'})" class="plant-jiantou_zuoyouqiehuan"/> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="company"> |
|
|
|
|
|
<text>{{agrDetail.typeOne}}</text> <text>{{agrDetail.supplier}}</text> |
|
|
</view> |
|
|
</view> |
|
|
<view style="color:#707070;font-size:20rpx;">云南云天化股份有限公司</view> |
|
|
|
|
|
</view> |
|
|
</view> |
|
|
<view class="card"> |
|
|
<view class="card"> |
|
|
<u-form class="inline" labelWidth="auto" :model="formData" :rules="rules"> |
|
|
<u-form class="inline" labelWidth="auto" ref="form" errorType="toast" :model="formData" :rules="rules"> |
|
|
<d-form |
|
|
<d-form |
|
|
v-for="(v,k) in fields" |
|
|
v-for="(v,k) in fields" |
|
|
:key="k" |
|
|
:key="k" |
|
|
v-bind="v" |
|
|
v-bind="v" |
|
|
:field="k" |
|
|
:field="k" |
|
|
:required="!!rules[k]"/> |
|
|
:required="!!rules[k]" |
|
|
|
|
|
@input="formData[k]=$event" |
|
|
|
|
|
@select="fields[k].value=$event.value.map(v=>v.value);formData[k]=$event.value[0].value"/> |
|
|
</u-form> |
|
|
</u-form> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<d-picker :list="agrList" ref="dPicker"> |
|
|
|
|
|
<view slot-scope="{row}" class="agr-picker"> |
|
|
|
|
|
<view class="name"><text>{{row.agriculturalGoods}}</text><text>{{row.substanceName}}</text><text>({{row.specDescribe}})</text></view> |
|
|
|
|
|
<view class="company" :data-name="row.detailType" :data-company="row.supplierName"/> |
|
|
|
|
|
</view> |
|
|
|
|
|
</d-picker> |
|
|
|
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
|
<script> |
|
|
<script> |
|
@ -182,41 +191,76 @@ export default { |
|
|
data(){ |
|
|
data(){ |
|
|
return{ |
|
|
return{ |
|
|
fields:{ |
|
|
fields:{ |
|
|
specs:{label:"规格",tip:"库存:2袋(200kg)",type:"select"}, |
|
|
specificationId:{label:"规格",tip:"",type:"select",columns:[[]],value:[]}, |
|
|
num:{label:"投入数量",suffix:"kg"}, |
|
|
inputQuantity:{label:"投入数量",type:"digit",suffix:""}, |
|
|
|
|
|
}, |
|
|
|
|
|
formData:{ |
|
|
|
|
|
specificationId:"", |
|
|
|
|
|
inputQuantity:"", |
|
|
|
|
|
inventoryId:"", |
|
|
}, |
|
|
}, |
|
|
formData:{}, |
|
|
|
|
|
rules:{ |
|
|
rules:{ |
|
|
|
|
|
specificationId:{required:true,message:"规格必选!"}, |
|
|
|
|
|
inputQuantity:{required:true,type:"number",message:"投入数量必填!"}, |
|
|
}, |
|
|
}, |
|
|
|
|
|
agrDetail:{}, |
|
|
agrList:[], |
|
|
eventChannel:null, |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
onLoad(){ |
|
|
computed:{ |
|
|
this.searchAgr() |
|
|
specsVal(){ |
|
|
|
|
|
var specs=(this.fields.specificationId.columns[0]?.find?.(v=>v.value==this.formData.specificationId)||{}).label||"" |
|
|
|
|
|
return{ |
|
|
|
|
|
specs:(specs.match(/(\d+)(.+?)\/(.+?)/)||[]).slice(1,4), |
|
|
|
|
|
num:this.formData.inputQuantity |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
watch:{ |
|
|
|
|
|
specsVal(n){ |
|
|
|
|
|
this.fields.inputQuantity.suffix=n.specs[2] |
|
|
|
|
|
if(n.num>0 && n.specs[0]>0){ |
|
|
|
|
|
this.$set(this.fields.inputQuantity, "tip", `共${parseFloat(n.num)*parseFloat(n.specs[0])}${n.specs[1]}`) |
|
|
|
|
|
}else{ |
|
|
|
|
|
this.$set(this.fields.inputQuantity, "tip", "") |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
async onLoad(options){ |
|
|
|
|
|
this.eventChannel=this.getOpenerEventChannel() |
|
|
|
|
|
this.eventChannel.on("detail", e=>this.agrDetail=e) |
|
|
|
|
|
this.formData.inventoryId=options.id |
|
|
|
|
|
this.init() |
|
|
}, |
|
|
}, |
|
|
methods:{ |
|
|
methods:{ |
|
|
async searchAgr(){ |
|
|
async init(){ |
|
|
var res=await request("/api/OutInManageApi/queryCollectingList",{ |
|
|
var res=await request("/api/plantFarming/getSpecification",{ |
|
|
method:"post", |
|
|
params:{goodsId: this.agrDetail.goodsId} |
|
|
body:{ |
|
|
|
|
|
baseId: "1611250480973049857"||this.$store.state.plantBaseInfoId, |
|
|
|
|
|
search:"", |
|
|
|
|
|
pageNo:1, |
|
|
|
|
|
pageSize:100, |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
}) |
|
|
if(res.statu){ |
|
|
if(res.statu){ |
|
|
this.agrList=res.data.list |
|
|
this.fields.specificationId.columns=[res.data.listSpec.map(v=>({label:v.goodsSpecification,value:v.id}))] |
|
|
|
|
|
this.fields.specificationId.tip=res.data.inventory |
|
|
}else{ |
|
|
}else{ |
|
|
uni.showModal({ |
|
|
uni.showModal({ |
|
|
title:"提示", |
|
|
title:"提示", |
|
|
content:res.msg||"获取已领用农资列表失败!", |
|
|
content:res.msg||"获取规格选项失败!", |
|
|
showCancel:false, |
|
|
showCancel:false, |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
submit(){ |
|
|
|
|
|
this.$refs.form.validate().then(async valid=>{ |
|
|
|
|
|
if(valid){ |
|
|
|
|
|
this.eventChannel.emit("update", { |
|
|
|
|
|
...this.formData, |
|
|
|
|
|
unit:this.specsVal.specs[1], |
|
|
|
|
|
parentName: this.agrDetail.parentName, |
|
|
|
|
|
name: this.agrDetail.name, |
|
|
|
|
|
}) |
|
|
|
|
|
uni.navigateBack() |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |