search.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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:null,
  12. },
  13. onLoad() {
  14. },
  15. onShow(){
  16. this.list(null)
  17. },
  18. // 搜索结果跳页
  19. bindViewSearchEnd() {
  20. // wx.navigateTo({
  21. // url: '../search/search'
  22. // })
  23. },
  24. // 企业详细页
  25. bindViewDetails(e) {
  26. let busEnterpriseId = e.currentTarget.dataset.enterpriseid
  27. wx.navigateTo({
  28. url: '../details/details?busEnterpriseId='+busEnterpriseId
  29. })
  30. },
  31. searchEnterprise(e) {
  32. var obj = new Object()
  33. // obj.businessName = e.detail.value
  34. obj.searchValue=e.detail.value
  35. this.list(obj)
  36. },
  37. bindViewSearchCode(){
  38. let that=this
  39. wx.scanCode({
  40. onlyFromCamera: true,
  41. success: (res) => {
  42. that.setData({
  43. //['details.code']:res.result,
  44. enterpriseCode:res.result
  45. })
  46. var obj = new Object()
  47. obj.enterpriseCode = that.data.enterpriseCode
  48. that.list(obj)
  49. },
  50. fail: (res) => {
  51. // wx.showToast({
  52. // title: '扫描失败请重试',
  53. // icon:'none'
  54. // })
  55. }
  56. })
  57. },
  58. list(data) {
  59. http.post("/system/AppEnterpriseController/getInitEnterpriseList", data, this.getQiyeEnterpriseListSuccess)
  60. },
  61. getQiyeEnterpriseListSuccess(res) {
  62. console.log("@@@",res)
  63. this.setData({
  64. enterpriseList: res.rows
  65. })
  66. }
  67. })