search.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import http from '../../base/httputil'
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 组件的初始数据
  6. */
  7. data: {
  8. host: app.globalData.host,
  9. enterpriseList: [],
  10. enterpriseCode:''
  11. },
  12. onLoad() {
  13. this.list(null)
  14. },
  15. // 搜索结果跳页
  16. bindViewSearchEnd() {
  17. // wx.navigateTo({
  18. // url: '../search/search'
  19. // })
  20. },
  21. // 企业详细页
  22. bindViewDetails(e) {
  23. let busEnterpriseId = e.currentTarget.dataset.enterpriseid
  24. wx.navigateTo({
  25. url: '../details/details?busEnterpriseId='+busEnterpriseId
  26. })
  27. },
  28. searchEnterprise(e) {
  29. var obj = new Object()
  30. obj.businessName = e.detail.value
  31. this.list(obj)
  32. },
  33. bindViewSearchCode(){
  34. let that=this
  35. wx.scanCode({
  36. onlyFromCamera: true,
  37. success: (res) => {
  38. that.setData({
  39. //['details.code']:res.result,
  40. enterpriseCode:res.result
  41. })
  42. var obj = new Object()
  43. obj.enterpriseCode = that.data.enterpriseCode
  44. that.list(obj)
  45. },
  46. fail: (res) => {
  47. // wx.showToast({
  48. // title: '扫描失败请重试',
  49. // icon:'none'
  50. // })
  51. }
  52. })
  53. },
  54. list(data) {
  55. http.post("/system/AppEnterpriseController/getInitEnterpriseList", data, this.getQiyeEnterpriseListSuccess)
  56. },
  57. getQiyeEnterpriseListSuccess(res) {
  58. this.setData({
  59. enterpriseList: res.rows
  60. })
  61. }
  62. })