109 lines
2.0 KiB
JavaScript
109 lines
2.0 KiB
JavaScript
// packageH/region/my_agency/my_agency.js
|
|
const app = getApp();
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
list: [],
|
|
current_page: 1,
|
|
last_page: 1,
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.getData()
|
|
},
|
|
getData(){
|
|
app._postNetWork({
|
|
url: app.getNetAddresss('plugin.area-merchant.frontend.modules.agent.controllers.records.index'),
|
|
success:(res)=> {
|
|
if (res.data.result == 1) {
|
|
this.setData({
|
|
list:res.data.data.page_list.data,
|
|
last_page: res.data.data.page_list.last_page
|
|
})
|
|
}
|
|
},
|
|
fail(err) {
|
|
console.log(err)
|
|
}
|
|
})
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
if(this.data.current_page>=this.data.last_page){
|
|
return
|
|
}else{
|
|
this.getMoreData()
|
|
}
|
|
},
|
|
getMoreData(){
|
|
let page = this.data.current_page + 1;
|
|
app._postNetWork({
|
|
url: app.getNetAddresss('plugin.area-merchant.frontend.modules.agent.controllers.records.index'),
|
|
data:{page},
|
|
success:(res)=> {
|
|
let {page_list} = res.data.data;
|
|
if (res.data.result == 1) {
|
|
let list = this.data.list.concat(page_list.data);
|
|
this.setData({
|
|
current_page:page,
|
|
last_page: page_list.last_page,
|
|
list
|
|
})
|
|
}
|
|
},
|
|
fail(err) {
|
|
console.log(err)
|
|
}
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
}
|
|
}) |