diff --git a/pages/purchase/specs.vue b/pages/purchase/specs.vue index c4ebfd6..00e0f16 100644 --- a/pages/purchase/specs.vue +++ b/pages/purchase/specs.vue @@ -190,27 +190,17 @@ export default{ return this.goodsList.findIndex(v=>v.id==this.purchaseId) }, }, - onLoad(options){ + async onLoad(options){ this.eventChannel=this.getOpenerEventChannel() this.formData.specificationId=options.id - this.init(options.id) - this.searchGoods() + await this.searchGoods() + this.goodsList.forEach(v=>{ + if(v.id==options.id){ + this.setGoodsVal(v) + } + }) }, methods:{ - async init(id){ - var res=await request("/api/goods/goodsList",{ - params:{id} - }) - if(res.statu && res.data.records[0]){ - this.setGoodsVal(res.data.records[0]) - }else{ - uni.showModal({ - title:"提示", - content:res.msg||"获取农资详情失败!", - showCancel:false, - }) - } - }, async setGoodsVal(val){ this.purchaseId=val.id this.formData.goodsName=val.goodsName @@ -269,7 +259,7 @@ export default{ }, async searchGoods(){ var res=await request("/api/goods/goodsList",{ - params: { goodsName:"",pageNo:1,pageSize:30 } + params: { goodsName:"",pageNo:1,pageSize:50 } }) if(res.statu){ this.goodsList=res.data.records