| | |
| | | icon: 'none' |
| | | }); |
| | | } else { |
| | | // 云开发请求 |
| | | if(res.result.indexOf('SJ') >0){ |
| | | cloudApi.queryPost('hazmatList',{code: t.data.searchContent}).then(res=>{ |
| | | if(res.data.length>0){ |
| | | const hazmatId = cloudApi.changeKey(res.data[0]).id |
| | | wx.cloud.callFunction({ |
| | | name: 'getHazmatFlow', |
| | | data: { |
| | | hazmatId: hazmatId |
| | | } |
| | | }).then(res=>{ |
| | | if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){ |
| | | t.setData({ |
| | | dataList: cloudApi.changeKey(res.result.list) |
| | | }) |
| | | } |
| | | }) |
| | | }else { |
| | | wx.showToast({ |
| | | title: '该二维码查询不到相关信息', |
| | | icon: 'error', |
| | | duration: 2000 |
| | | }); |
| | | } |
| | | }) |
| | | }else{ |
| | | cloudApi.queryPost('productList',{code: t.data.searchContent}).then(res=>{ |
| | | if(res.data.length>0){ |
| | | const productId = cloudApi.changeKey(res.data[0]).id |
| | | wx.cloud.callFunction({ |
| | | name: 'getProductFlow', |
| | | data: { |
| | | productId: productId |
| | | } |
| | | }).then(res=>{ |
| | | if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){ |
| | | t.setData({ |
| | | dataList: cloudApi.changeKey(res.result.list) |
| | | }) |
| | | } |
| | | }) |
| | | }else { |
| | | wx.showToast({ |
| | | title: '该二维码查询不到相关信息', |
| | | icon: 'error', |
| | | duration: 2000 |
| | | }); |
| | | } |
| | | }) |
| | | } |
| | | // api请求 |
| | | // api.getHazmatFlowByCode({code: t.data.searchContent}).then(re => { |
| | | // if(re.code == 200) { |
| | | // t.setData({ |
| | | // dataList: re.data ? re.data : [] |
| | | // }); |
| | | // } else { |
| | | // wx.showToast({ |
| | | // title: re.message, |
| | | // icon: 'none' |
| | | // }); |
| | | // } |
| | | // }); |
| | | api.getHazmatFlowByCode({code: t.data.searchContent}).then(re => { |
| | | if(re.code == 200) { |
| | | t.setData({ |
| | | dataList: re.data ? re.data : [] |
| | | }); |
| | | } else { |
| | | wx.showToast({ |
| | | title: re.message, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | |