// pages/qiye/qiye.js
import http from '../../base/httputil'
Page({
  /**
   * 组件的初始数据
   */
  onLoad() {
    this.initQiyePage()
  },
  data: {

    weekCount: 0,
    monthCount: 0,
    totalCount: 0,

    enterpriseList: [],


    menulist: [{
        "id": "1",
        "url": "icon-anquanxuncha",
        "title": "巡查",
      },
      {
        "id": "2",
        "url": "icon-xunjian",
        "title": "巡检",
      },
    ],
    mainmodel: {

    }
  },
  // 搜索结果跳页
  bindViewSearchEnd() {
    wx.navigateTo({
      url: '../search/search'
    })
  },
  // 企业详细页
  bindViewDetails(e) {
    let busEnterpriseId = e.currentTarget.dataset.enterpriseid
    wx.navigateTo({
      url: '../details/details?busEnterpriseId=' + busEnterpriseId
    })
  },
  //企业表单详细
  bindViewQiYeMore() {
    wx.navigateTo({
      url: '../qiyemore/qiyemore'
    })
  },

  initQiyePage() {
    http.send_post("/system/AppEnterpriseController/getInitEnterpriseData", null, this.getQiyePageSuccess)
    http.send_post("/system/AppEnterpriseController/getInitEnterpriseList", null, this.getQiyeEnterpriseListSuccess)
  },
  getQiyePageSuccess(res) {
    let enterpriseCount = res.data.enterpriseCount;
    this.setData({
      weekCount: enterpriseCount.weekCount,
      monthCount: enterpriseCount.monthCount,
      totalCount: enterpriseCount.totalCount,
    })
  },
  getQiyeEnterpriseListSuccess(res) {
    this.setData({
      enterpriseList: res.data.rows
    })
  },
  changeSearch(e) {
    console.log(e.detail.value)
  }

})