yujian
2019-01-22 88b54772dbcf5ecab1e2316e4e4626ac901b8908
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
<!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>
            #editdialog {
                padding: 20px;
                height: 220px;
                display: none;
            }
            
            #editdialog div {
                margin-bottom: 30px;
            }
        </style>
 
        <!--[if lt IE 9]>
      <script src="js/html5shiv.js"></script>
      <script src="js/respond.min.js"></script>
    <![endif]-->
    </head>
 
    <body>
        <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
 
        </nav>
        <div id="mainbody">
            <div id="sidebar">
                <dl>
                    <dd>
                    </dd>
                </dl>
            </div>
            <div id="neirong">
                <div class="erjidh">
                    <table class="table">
                        <tbody>
                            <tr>
                                <td class="xiala">
                                    <select name="select" class="form-control">
                                        <option value="0">全部</option>
                                        <option value="1">未到时间不可领取</option>
                                        <option value="2">可领取</option>
                                        <option value="3">已经领取</option>
                                        <option value="4">红包失效</option>
                                    </select>
                                </td>
 
                                <td>
                                    <button type="submit" class="btn btn-default searchBtn">搜索</button>
                                </td>
 
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="zhuti">
                    <div class="liebiao">
                        <table class="table">
                            <thead>
                                <th width="7%">选择</th>
                                <th width="7%">红包编号</th>
                                <th width="8%">红包类型</th>
                                <th width="8%">红包金额(元)</th>
                                <th width="15%">红包终端用户ID</th>
                                <th width="5%">红包状态</th>
                                <th width="13%">创建时间</th>
                                <th width="13%">红包打开时间</th>
                                <!--<th width="4%">编辑</th>-->
                            </thead>
                            <tbody>
                                <tr>
                                    <td>
                                        <div class="xuanze">
                                            <label>
                    <input type="checkbox" value="#">
                  </label>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="bianhao bianhaoid"></div>
                                    </td>
                                    <td>
                                        <div class="bianhao hbtype">
                                        </div>
                                    </td>
                                    <td>
                                        <div class="bianhao jine">
                                        </div>
                                    </td>
                                    <td>
 
                                        <div class="bianhao uid">
                                        </div>
 
                                    </td>
 
                                    <td>
                                        <div class="bianhao state">
                                        </div>
                                    </td>
                                    <td>
                                        <div class="bianhao createtime">
                                        </div>
                                    </td>
                                    <td>
                                        <div class="bianhao opentime">
                                        </div>
                                    </td>
                                    <!--<td>
                                        <div class="anniu">
                                            <a key="370" href="#" class="edit"><img src="image/bianji.png"></a>
                                        </div>
                                    </td>-->
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="bottom">
                    <!--<div class="qx">
                        <div class="checkbox">
                            <label>
          <input type="checkbox" value="#">
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;全选</label>
                        </div>
                    </div>-->
                    <!--<button class="btn btn-warning" type="button">批量删除</button>-->
                    <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>
            $(function() {
                trHtml = $(".zhuti tbody").html();
                $(".searchBtn").bind("click", function(){
                        getHongBaoData(1);
                    });
                    getHongBaoData(1);
                    
                function getHongBaoData(pageindex) {
                    var lay = layer.load(0, {
                        'shade': false
                    });
                    
                    var state = $(".xiala select option:checked").val();
                    
                    $.post("api/v1/haobao/getHongBaoList", { "pageIndex": pageindex,"state": state}, function(data) {
                        if(data.code == 0) {
                            setHongBaoData(pageindex, data);
                            fillPage(data.data.pe, function(pageindex) {
                                getHongBaoData(pageindex);
                            });
                        } else {
                            layer.msg("数据访问出错");
                        }
                        layer.close(lay);
                    }, 'json');
 
                }    
                
                function setHongBaoData(index,data){
                    $(".zhuti tbody").empty();
                    index = index - 1;
                    var pageSize = data.data.pe.pageSize;
                    var totalCount = data.data.pe.totalCount;
                    var len = (pageSize < totalCount - (index * pageSize)) ? pageSize : totalCount - (index * pageSize);
                    len = (index * pageSize) + len;
                    var tt = index * pageSize;
                    for(var ii = 0; tt < len && tt <  totalCount < pageSize; ii++, tt++) {
                        var hongbao = data.data.hongBaoList[ii];
                        var id = hongbao.id;
                        var type = hongbao.type;
                        if(type==1){
                            type="淘宝订单";
                        }else if(type==2){
                            type="京东订单";
                        }else if(type==3){
                            type="活动红包";
                        }else if(type==4){
                            type="新人红包";
                        }
                        var money = hongbao.money;
                        var uid = hongbao.userInfo.id;
                        var state = hongbao.state;
                        var preGettime = hongbao.preGettime;
                        if(state==1){
                            state="未到时间不可领取";
                        }else if(state==2){
                            state="可领取";
                        }else if(state==3){
                            state="已经领取";
                        }else if(state==4){
                            state="红包失效";
                        }
                        var money = hongbao.money;
                        var createtime = hongbao.createtime;
                        var getTime = hongbao.getTime;
                        $(".zhuti tbody").append(trHtml);
                        var $curTr = $(".zhuti tbody tr").eq(ii);
                        $curTr.find(".xuanze input").attr("key", id);
                        $curTr.find(".hbtype").text(type);
                        $curTr.find(".bianhaoid").text(id);
                        $curTr.find(".uid").text(uid);
                        $curTr.find(".jine").text(money);
                        $curTr.find(".state").text(state);
                        var cdate = new Date(parseInt(createtime)).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ");
                        $curTr.find(".createtime").text(cdate);
                        var opentime = new Date(parseInt(getTime)).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ");
                        $curTr.find(".opentime").text(getTime==0?"":opentime);
                        var kg = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                    }
                }
            });
        </script>
    </body>
 
</html>