punchInhistory.js
4.05 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
var e = getApp(), os = e.globalData.setting;
var utils = require('../../../../utils/util.js');
var regeneratorRuntime = require('../../../../utils/runtime.js');
const request = getApp().request;
let app = getApp();
Page({
filters: {
toFix(val) {
if (val === undefined) return 0;
if (val === null) return 0;
if (isNaN(val)) return 0;
if (val === '') return 0;
return parseFloat(val).toFixed(2);
},
//获取样式
set_def: function (val, def, is_price) {
if (val == undefined) {
if (def) return def;
return "-"
}
if (is_price) {
return parseFloat(val + "").toFixed(2);
}
return val;
},
},
data:{
imghost: app.globalData.setting.imghost,
keyword: '',
list: [],
list2:[],
diffweight:'',
standardweight:'',
howday:'',
},
onLoad(options) {
var that = this;
if (options.customerid != undefined && options.customerid != "" && options.customerid != null) {
that.setData({
customerid:options.customerid,
diffweight:options.diffweight,
standardweight:options.standardweight,
howday:options.howday
})
}
var userInfo = getApp().globalData.userInfo;
if (userInfo) {
that.userInfo = userInfo;
that.loding = 1;
that.init_data();
}
wx.getSystemInfo({
success: function (res) {
var clientWidth = res.windowWidth;
var clientHeight = res.windowHeight;
var rpxR = 750 / clientWidth;
var calc = clientHeight * rpxR;
that.setData({
calc:calc
})
}
})
},
onShow: function () {
if (getApp().globalData.userInfo && !this.userInfo) {
this.setData({
userInfo:userInfo
})
this.loding = 1;
this.init_data();
}
},
//初始化数据
init_data() {
var that = this;
let userInfo = getApp().globalData.userInfo;
let req = {
customerid: that.data.customerid,
store_id: userInfo.store_id, //用户id
//staffid: getApp().globalData.RoleData.StaffId, //商户编号
ApiName: 'api.slimming.clock.registration.sum.query',
};
that.get_list(req);
},
//获取门店报表
get_list(req) {
var that = this;
if (that.loading) {
return false;
}
that.loading = 1;
if (req) {
that.setData({
noMore:false,
list:[],
list2:[]
})
} else {
if (that.noMore) {
that.loading = 0;
return false;
}
req = that.req; //如果不是全选的参数,就是page分页+1
req.page++;
}
//请求参数进行存储
that.req = req;
wx.showLoading({
title: '加载中'
});
var url = '/api/weshop/delphiapi/pageErpApi?accdb='+getApp().globalData.config.erpid;
getApp().request.promiseGet(url, {
data: req
})
.then((res) => {
wx.hideLoading();
that.loading = 0;
if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) {
var list=that.data.list;
for (let i = 0; i < res.data.data.pageData.length; i++) {
list.push(res.data.data.pageData[i]);
}
that.setData({
list:list
})
} else {
getApp().confirmBox(res.data.msg)
}
});
},
})