points_list.js
1.61 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
var t = function(t) {
return t && t.__esModule ? t : {
default: t
};
}(require("../../../utils/LoadMore.js")), e = getApp(), a = new t.default(), i = require("../../../utils/util.js");
Page({
data: {
url: e.globalData.setting.url,
resourceUrl: e.globalData.setting.resourceUrl,
categories: [ {
name: "全部",
type: "all"
}, {
name: "赚取",
type: "plus"
}, {
name: "消费",
type: "minus"
} ],
activeType: "all",
points: null,
currentPage: 1
},
onLoad: function(t) {
var e = void 0 === t.type ? this.data.activeType : t.type;
a.init(this, "", "points"), this.requestPointList(e);
},
changeTab: function(t) {
a.resetConfig(), this.data.points = null, this.data.currentPage = 1, this.requestPointList(t.currentTarget.id);
},
requestPointList: function(t) {
var e = this, n = "/api/user/points_list/type/" + t + "?p=" + e.data.currentPage;
this.setData({
activeType: t
}), a.request(n, function(t) {
e.data.currentPage++, t.data.result.forEach(function(t, e, a) {
t.changeTimeFommat = i.format(t.change_time, "yyyy-MM-dd hh:mm");
}), wx.stopPullDownRefresh();
});
},
onReachBottom: function() {
a.canloadMore() && this.requestPointList(this.data.activeType);
},
onPullDownRefresh: function(t) {
this.data.points = null, this.data.currentPage = 1, a.resetConfig(), this.requestPointList(this.data.activeType);
}
});