currency.page.js
1.66 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
/**
* [个人中心]有货币
* @author: jiangmin
* @date: 2016/07/11
*/
var type = 0;
var page = 1;
var Bll = {
// 获取路由中的请求参数
getQueryString: function() {
var queryArr = location.search.substr(1).split('&');
var query = {};
var i;
var arr = [];
for (i = 0; i < queryArr.length; i++) {
arr = queryArr[i].split('=');
query[arr[0]] = arr[1];
}
return query;
},
typeMap: {
all: 0,
paying: 1,
delivering: 2
},
getDataList: function(type1, page1, beginTime1) {
var query = ['page=' + page1, 'queryType=' + type1, 'beginTime=' + beginTime1];
location.search = query.join('&');
},
getTime: function(time, a) {
var newDate = new Date(time.getFullYear(), time.getMonth() + 1, time.getDate() - 30 * a);
return newDate.getFullYear() + '-' + newDate.getMonth() + '-' + newDate.getDate();
}
};
var beginTime = Bll.getTime(new Date(), 3);
require('./me');
// tab切换
$('.tabs li').on('click', function() {
var $this = $(this);
type = Bll.typeMap[$this.data('type')];
page = 1;
beginTime = Bll.getQueryString().beginTime || beginTime;
if (!$this.hasClass('active')) {
$('.tabs li.active').removeClass('active');
$this.addClass('active');
Bll.getDataList(type, page, beginTime);
}
});
// 时间控件切换
$('#begin-time').on('change', function() {
var months = parseInt($(this).val(), 10);
type = Bll.getQueryString().queryType || 1;
page = 1;
beginTime = Bll.getTime(new Date(), months);
Bll.getDataList(type, page, beginTime);
});