Browse Source

修改页面

master
邓宏 2 years ago
parent
commit
72ca2f0e26
  1. 55
      pages/purchase/specs.vue

55
pages/purchase/specs.vue

@ -46,7 +46,7 @@
color:#707070; color:#707070;
} }
&:nth-child(2){ &:nth-child(2){
margin:auto; margin-left:20rpx;
font-size:20rpx; font-size:20rpx;
color:#FBA83C; color:#FBA83C;
} }
@ -162,7 +162,7 @@
<view class="name"> <view class="name">
<text>{{formData.detailedParentName}}</text> <text>{{formData.detailedParentName}}</text>
<text>{{formData.goodsName}}</text> <text>{{formData.goodsName}}</text>
<text class="plant-jiantou_zuoyouqiehuan" @click="$refs.dPicker.show=true"/> <text class="plant-jiantou_zuoyouqiehuan" @click="$u.route({type:'back'})"/>
</view> </view>
<view class="company"> <view class="company">
<text>{{formData.detailedType}}</text> <text>{{formData.detailedType}}</text>
@ -200,13 +200,6 @@
@close="show=false" @close="show=false"
@cancel="show=false" @cancel="show=false"
@confirm="searchStock($event.value[0].id);formData.goodsSpecification=$event.value[0].value;formData.specificationId=$event.value[0].id;show=false"/> @confirm="searchStock($event.value[0].id);formData.goodsSpecification=$event.value[0].value;formData.specificationId=$event.value[0].id;show=false"/>
<d-picker :list="goodsList" ref="dPicker" :value="pickerValue" @select="setGoodsVal">
<view slot-scope="{row}" class="purcahse-picker">
<view class="name"><text>{{row.detailedParentName}}</text> <text>{{row.goodsName}}</text></view>
<view class="company" :data-name="row.detailedType" :data-company="row.supplier"/>
</view>
</d-picker>
</view> </view>
</template> </template>
<script> <script>
@ -214,7 +207,6 @@ import request from '@/common/request'
export default{ export default{
data(){ data(){
return{ return{
purchaseId:'',
specList:[[]], specList:[[]],
specStr:"", specStr:"",
dressingUnit:"", dressingUnit:"",
@ -224,7 +216,6 @@ export default{
goodsName:"", goodsName:"",
goodsSpecification:"", goodsSpecification:"",
num:"", num:"",
purchaseId:"",
specificationId:"", specificationId:"",
detailedType:"", detailedType:"",
@ -232,34 +223,24 @@ export default{
supplier:"", supplier:"",
}, },
goodsList:[], goodsDetail:{},
eventChannel:null, eventChannel:null,
} }
}, },
computed:{
pickerValue(){
return this.goodsList.findIndex(v=>v.id==this.purchaseId)
},
},
async onLoad(options){ async onLoad(options){
this.eventChannel=this.getOpenerEventChannel() this.eventChannel=this.getOpenerEventChannel()
this.formData.goodsId=options.id this.eventChannel.on("detail", detail=>{
await this.searchGoods() this.formData.goodsName=detail.goodsName
this.goodsList.forEach(v=>{ this.formData.detailedType=detail.detailedType
if(v.id==options.id){ this.formData.detailedParentName=detail.detailedParentName
this.setGoodsVal(v) this.formData.supplier=detail.supplier
}
}) })
this.formData.goodsId=options.id
this.setGoodsVal()
}, },
methods:{ methods:{
async setGoodsVal(val){ async setGoodsVal(val){
this.purchaseId=val.id
this.formData.goodsName=val.goodsName
this.formData.detailedType=val.detailedType
this.formData.detailedParentName=val.detailedParentName
this.formData.supplier=val.supplier
var res=await request("/api/goods/queryGoodsSpecification",{ var res=await request("/api/goods/queryGoodsSpecification",{
params:{ params:{
goodsName:this.formData.goodsName, goodsName:this.formData.goodsName,
@ -293,7 +274,7 @@ export default{
}, },
toAdd(){ toAdd(){
uni.navigateTo({ uni.navigateTo({
url:`/pages/purchase/newSpecs?goodsId=${this.purchaseId}`, url:`/pages/purchase/newSpecs?goodsId=${this.formData.goodsId}`,
events:{addUnit:e=>{ events:{addUnit:e=>{
this.specList[0].push({label:e.goodsSpecification,value:e.goodsSpecification,id:e.goodsSpecificationId}) this.specList[0].push({label:e.goodsSpecification,value:e.goodsSpecification,id:e.goodsSpecificationId})
this.searchStock(e.goodsSpecificationId) this.searchStock(e.goodsSpecificationId)
@ -317,20 +298,6 @@ export default{
this.eventChannel.emit("submit", this.formData) this.eventChannel.emit("submit", this.formData)
} }
}, },
async searchGoods(){
var res=await request("/api/goods/goodsList",{
params: { goodsName:"",pageNo:1,pageSize:50 }
})
if(res.statu){
this.goodsList=res.data.records
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取农资列表失败!",
showCancel:false,
})
}
},
} }
} }
</script> </script>
Loading…
Cancel
Save