Detailed.js
1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
var t = getApp(),
r = t.globalData,
a = t.request,
o = t.globalData.setting,
os = o,
i = require("../../../utils/util.js"),
ut = i,
s = require("../../../utils/common.js");
Page({
/**
* 页面的初始数据
*/
data: {
url: o.imghost,
arrayDetailed: [],//明细数组
page: 1,
pageSize: 20,
isDetailed: 0,
total: 0,
ismore: 0,//数据是否加载完毕
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},
selectDetailed: function() {
var th = this, e = th;
getApp().request.promiseGet("/api/weshop/plus/vip/mem/referee/page", {
data: {
storeId: o.stoid,
userId: r.user_id,
page: th.data.page,
pageSize: th.data.pageSize
}
}).then(res => {
th.setData({isDetailed:1})
if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0) {
th.data.page++;//当前页数+1
var arr1 = th.data.arrayDetailed;//获取明细数组
var arr2 = res.data.data.pageData;//获取当前查询数据
var arr3 = [...arr1, ...arr2];//把当前查询数组拼接到原本数组后面
var ismore = 0;
if (arr3.length == res.data.data.total) ismore = 1 //数据已加载完判断
th.setData({
arrayDetailed: arr3,
total: res.data.data.total,
ismore: ismore,
isDetailed: 1
})
}
}),
wx.stopPullDownRefresh();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
this.selectDetailed();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
if (this.data.total <= this.data.pageSize) return;
if (this.data.ismore) {
t.my_warnning("加载完啦!", 0, this);
return
};
this.selectDetailed();
}
})