search.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. keyword:'',
  12. },
  13. onLoad() {
  14. },
  15. onShow(){
  16. var obj = new Object()
  17. // obj.businessName = e.detail.value
  18. obj.searchValue=this.data.keyword,
  19. this.list(obj)
  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. this.data.keyword=e.detail.value,
  31. obj.searchValue=e.detail.value,
  32. this.list(obj)
  33. },
  34. bindViewSearchCode(){
  35. let that=this
  36. wx.scanCode({
  37. onlyFromCamera: true,
  38. success: (res) => {
  39. that.setData({
  40. //['details.code']:res.result,
  41. enterpriseCode:res.result
  42. })
  43. var obj = new Object()
  44. obj.searchValue = that.data.enterpriseCode
  45. that.list(obj)
  46. },
  47. fail: (res) => {
  48. // wx.showToast({
  49. // title: '扫描失败请重试',
  50. // icon:'none'
  51. // })
  52. }
  53. })
  54. },
  55. list(data) {
  56. http.post("/system/AppEnterpriseController/getInitEnterpriseList", data, this.getQiyeEnterpriseListSuccess)
  57. },
  58. getQiyeEnterpriseListSuccess(res) {
  59. this.setData({
  60. enterpriseList: res.rows
  61. })
  62. }
  63. })