import HTTP from '../../../../../requestFn/Api'
Page({
  data: {
    house_list: []
  },
  onShow(options) {
    this.getRenthouse()
  },
  async getRenthouse() {
    const res = await HTTP.RentHouse({
      is_me: true
    })
    this.setData({
      house_list: res.list
    })
  },
  addRenthouse() {
    wx.navigateTo({
      url: '../addrent/addrent',
    })
  },
  goDetail(e) {
    const {id} = e.currentTarget;
    const {house_list} = this.data;
    const [house_info] = house_list.filter(item=>item.id==id);
    wx.navigateTo({
      url: '../addrent/addrent',
      success: function (res) {
        res.eventChannel.emit('acceptDataFromOpenerPage',  house_info)
      }
    })
  }
})