import http from '../../base/httputil'

Page({
  /**
   * 组件的初始数据
   */
  data: {
    enterpriseList: [],
  },
  onLoad() {
    this.list(null)
  },
  // 搜索结果跳页
  bindViewSearchEnd() {
    wx.navigateTo({
      url: '../search/search'
    })
  },
  // 企业详细页
  bindViewDetails(e) {
    let busEnterpriseId = e.currentTarget.dataset.enterpriseid
    wx.navigateTo({
      url: '../details/details?busEnterpriseId='+busEnterpriseId
    })
  },

  searchEnterprise(e) {
    var obj = new Object()
    obj.businessName = e.detail.value
    this.list(obj)
  },

  list(data) {
    http.post("/system/AppEnterpriseController/getInitEnterpriseList", data, this.getQiyeEnterpriseListSuccess)
  },

  getQiyeEnterpriseListSuccess(res) {
    this.setData({
      enterpriseList: res.rows
    })
  }

})