import HTTP from "../../../../requestFn/Api"
const app = getApp();
Page({

  data: {
    garden_id: null,
    house_id: null,
    manager_list: []
  },
  onLoad(options) {
    const {
      garden_id,
      house_id
    } = app.globalData;
    if (garden_id && house_id) {
      this.setData({
        garden_id,
        house_id
      })
    }
    this.getManager();
  },
  async getManager() {
    wx.showNavigationBarLoading()
    //loading 提示框
    wx.showLoading({
      title: 'Loading...',
    })
    const {
      garden_id,
      house_id
    } = this.data;
    const res = await HTTP.GetBuildManger({
      garden_id,
      house_id
    });
    this.setData({
      manager_list: res.list
    })
    setTimeout(function () {
      wx.hideLoading();
      wx.hideNavigationBarLoading();
      //停止下拉刷新
      wx.stopPullDownRefresh();
    }, 1000)
  },
  callphone(e) {
    const {
      phone
    } = e.currentTarget.dataset;
    wx.makePhoneCall({
      phoneNumber: phone,
    })
  },
  onPullDownRefresh: function () {
    this.getManager();
  },
})