From aeafc67e4c3bd4a0e2e023a40acef0186b3fff93 Mon Sep 17 00:00:00 2001 From: dingtalk_umvbsp Date: Thu, 2 Feb 2023 09:55:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/purchase/specs.vue | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) 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