function pullLoading(allPages, currentPage, url) {
  var that = this;
  var loadMoreDate = '';
  // 当前页是最后一页
  if (currentPage == allPages) {
    // that.setData({
    //   loadMoreData: '已经到顶'
    // })
     loadMoreDate='已经到顶'
    return loadMoreDate;
  }else{
    setTimeout(function () {
      console.log('上拉加载更多');
      var tempCurrentPage = currentPage;
      tempCurrentPage = tempCurrentPage + 1;
      that.setData({
        currentPage: tempCurrentPage,
        hideBottom: false
      })
      loadMoreDate = that.getData(currentPage, urlpagesize, currentPage, lat, lon, index);
    }, 300);
    return loadMoreDate;
  }

}

function getData(pagesize, currentPage, lat, lon, index) {
  var that = this;
  var pageIndex = currentPage;
  wx.request({
    url: url,
    data: {
      lat: lat,
      lon: lon,
      pageNumber: currentPage,
      pageSize: pagesize,
      searchOption: index
    },
    success: function(res) {
      var result = res.results;
      return result;
      // 加载更多
    },
    fail: function() {

    }
  })
}


module.exports = {
  pullLoading: pullLoading
}