Administrator
2018-11-05 2d950dce7919a2bc39464f9d264f7b96b69f6d1e
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<!DOCTYPE html>
<html lang="zh-cn">
 
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>用户管理</title>
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link href="css/maincontent.css" rel="stylesheet">
        <style>
            .img {
                width: 120px;
                height: 120px;
            }
        </style>
    </head>
 
    <body>
        <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
        </nav>
        <div id="mainbody">
            <div id="sidebar">
                <dl>
                </dl>
            </div>
            <div id="neirong">
                <div class="erjidh">
                    <table class="table">
                        <tbody>
                            <tr>
                                <td>
                                    <form class="form-inline" role="form">
                                        <div class="form-group" role="search">
                                            <input type="text" class="form-control searchText" style="width:200px;" placeholder="搜索">
                                        </div>
                                        <button type="button" class="btn btn-default searchBtn">搜索</button>
                                    </form>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="zhuti">
                    <div class="zhutisousuo">
                        <table class="table">
                            <thead>
                                <tr>
                                    <th width="10%">用户头像</th>
                                    <th width="9%">昵称</th>
                                    <th width="7%">ID</th>
                                    <th width="10%">资金明细</th> 
                                    <th width="8%">红包详情</th>
                                    <th width="8%">订单</th>
                                    <th width="8%">足迹</th>
                                    <th width="8%">邀请关系</th>
                                    <th width="7%">分享赚</th>
                                    <th width="7%">邀请赚</th>
                                    <th width="10%">下载</th>
                                    <th width="8%">清除手势密码</th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="liebiao">
                        <table class="table">
                            <tbody>
                                <tr>
                                    <td width="10%">
                                        <div class="imgDiv">
                                            <img class="img"/>
                                        </div>
                                    </td>
                                    <td width="9%" style="text-align:center; line-height:105px;">
                                        <div class="bianhaomingcheng">
                                        </div>
                                    </td>
                                    <td width="7%" style="text-align:center; line-height:105px;">
                                        <div class="uid">
                                        </div>
                                    </td>
                                    <td width="10%" style="text-align:center; line-height:105px;">
                                        <div class="zijin">
                                            <a>资金详情</a>
                                        </div>
                                    </td>
                                    <td width="8%" style="text-align:center; line-height:105px;">
                                        <div class="hongbao">
                                            <a>红包详情</a>
                                        </div>
                                    </td>
                                    <td width="8%" style="text-align:center; line-height:105px;">
                                        <div class="dingdan">
                                            <a>订单详情</a>
                                        </div>
                                    </td>
                                    <td width="8%" style="text-align:center; line-height:105px;">
                                        <div class="zuji">
                                            <a>足迹详情</a>
                                        </div>
                                    </td>
                                    
                                    <td width="8%" style="text-align:center; line-height:105px;">
                                        <div class="fenxiao">
                                            <a>邀请关系</a>
                                        </div>
                                    </td>
                                    <td width="7%" style="text-align:center; line-height:105px;">
                                        <div class="share">
                                            <a>分享赚</a>
                                        </div>
                                    </td>
                                    <td width="7%" style="text-align:center; line-height:105px;">
                                        <div class="invite">
                                            <a>邀请赚</a>
                                        </div>
                                    </td>
                                    <td width="10%" style="text-align:center; line-height:105px;">
                                        <a class="down" download="1.xls">下载</a>
                                    </td>
                                    <td width="10%" style="text-align:center; line-height:105px;">
                                        <a href="#" class="cleanPassword">清除</a>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="bottom">
                    <div class="page">
                        <ul class="pagination">
                            <li class="disabled pre">
                                <a href="#">&laquo;</a>
                            </li>
                            <li>
                                <a href="#" class="next">&raquo;</a>
                            </li>
                        </ul>
                        <div class="form-group">
                            <div class="tzan">
                                <button type="button" class="btn btn-primary">跳转</button>
                            </div>
                            <div class="tz">
                                <input class="form-control" type="text" id="customPage" placeholder="页数">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script src="js/jquery.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
        <script src="js/page.js"></script>
        <script src="js/nav.js"></script>
        <script src="layer/layer.js"></script>
        <script src="js/utli.js"></script>
        <script>
            var trHTML;
            $(function(){
                
                var $tbody = $(".liebiao > .table > tbody");
                trHTML = $tbody.html();
                
                $(".searchBtn").bind("click",function(){
                    getUserData(1);
                });
                var uid = getArgsFromHref(location.href,"uid");
                var uname = getArgsFromHref(location.href,"uname");
                var ipage = getArgsFromHref(location.href,"page");
                if(ipage==""){
                    ipage=1;
                }
                if(uid == ""){
                    getUserData(ipage);
                }else{
                    $(".searchText").val(decodeURI(uname));
                    getUserDataByUid(uid);
                }
                
            });
        </script>
        <script>
            var dateTime = getDateTime();
            
            function getUserDataByUid(uid) {
                var key = $(".searchText").val();
                $.post("api/v1/user/getUserListByUid", { "uid": uid }, function(data) {
                    if(data.code == 0) {
                        setUserData(data,1);
                    }
                }, 'json');    
            } 
            
            function getUserData(pageIndex) {
                var key = $(".searchText").val();
                $.post("api/v1/user/getUserList", { "pageIndex": pageIndex , "key":key }, function(data) {
                    if(data.code == 0) {
                        setUserData(data,pageIndex);
                        fillPage(data.data.pe, function(pageIndex) {
                            getUserData(pageIndex);
                        });
                    }
                }, 'json');    
            } 
            
            function setUserData(data,pageIndex){
                
                pageIndex = pageIndex - 1;
                var $tbody = $(".liebiao > .table > tbody");
                $(".liebiao tbody").empty();
                var pageSize = data.data.pe.pageSize;
                var totalCount = data.data.pe.totalCount;
                var len = (pageSize < totalCount - (pageIndex * pageSize)) ? pageSize : totalCount - (pageIndex * pageSize);
                len = (pageIndex * pageSize) + len;
                var ii = pageIndex * pageSize;
                for(var mm = 0; ii < len && ii <  totalCount; ii++,mm++) {
                    var  id = data.data.userList[mm].id;
                    var  name = data.data.userList[mm].nickName;
                    var  imgPath = data.data.userList[mm].portrait;
                    var  myHongBao = data.data.userList[mm].myHongBao;
                    $tbody.append(trHTML);
                    var $curTr = $tbody.find("tr").eq(mm);
                    $curTr.find(".imgDiv img").attr("src",imgPath);
                    $curTr.find(".bianhaomingcheng").text(name);
                    $curTr.find(".uid").text(id);
                    $curTr.find(".down").attr("href","api/v1/user/downDetailedExcel?uid="+id);
                    //$curTr.find(".down").attr("download",name+dateTime+".xls")
                    $curTr.find(".down").attr("key",name);
                    $curTr.find(".cleanPassword").attr("key",id)
                    
                    $curTr.find(".zijin a").text("¥ "+myHongBao.toFixed(2));
                    $curTr.find(".zijin a").attr("href","zijin-yonghu_zijin.html?key="+id+"&uname="+encodeURI(name));
                    $curTr.find(".hongbao a").attr("href","zijin-yonghu_hb.html?key="+id+"&uname="+encodeURI(name));
                    $curTr.find(".dingdan a").attr("href","zijin-yonghu_dingdan.html?key="+id+"&uname="+encodeURI(name));
                    $curTr.find(".zuji a").attr("href","zijin-yonghu_zuji.html?key="+id+"&uname="+encodeURI(name)+"&page="+(pageIndex+1));
                    $curTr.find(".fenxiao a").attr("href","zijin-yonghu_fenxiao_detail.html?uid="+id);
                    $curTr.find(".share a").attr("href","zijin-yonghu_share_detail.html?key="+id+"&uname="+encodeURI(name));
                    $curTr.find(".invite a").attr("href","zijin-yonghu_invite_detail.html?key="+id+"&uname="+encodeURI(name));
                }
                
                
                $(".cleanPassword").bind("click",function(){
                    var id = $(this).attr("key");
                    var $obj = $(this);
                    $.post("api/v1/user/cleanPassword",{"id":id},function(data){
                        if(data.code==0){
                            layer.alert('操作成功!', {
                                    icon: 1,
                                    skin: 'layer-ext-seaing' 
                                });
                        }else{
                            layer.alert('操作失败!', {
                                    icon: 2,
                                    skin: 'layer-ext-seaing' 
                                });
                        }
                    },'json')
                    
                });
                
                $(".down").bind("click",function(){
                    var name = $(this).attr("key");
                    dateTime=getDateTime();
                    $(this).attr("download",name + "_" + dateTime+".xls");
                    var download = $(this).attr("download");
                });
            }
            
            function getDateTime() {
                var date = new Date();
                this.year = date.getFullYear();
                this.month = date.getMonth() + 1;
                this.date = date.getDate();
                this.hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
                this.minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
                this.second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
                var dateTime=  this.year + "" + this.month + "" + this.date + "" + this.hour + "" + this.minute + "" + this.second;
                return dateTime;
            }
        </script>
    </body>
 
</html>