admin
2020-11-10 e130e13ef0cc4a827aa2c8d9e47d619a4cea40d0
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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
<!DOCTYPE html>
<html>
    
    <head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="chrome=1"/>
        <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
        <title>客服审核界面</title>
        <link rel="stylesheet" type="text/css" href="../../css/doui.min.css"/>
        <script src="../../js/doui.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="../../js/requestHost.js" type="text/javascript" charset="utf-8"></script>
        <script type="text/javascript">
            doui.importLoad({
                importArray: [
                    // 雷打不动
                    getHostPath() + "js/jquery.min.js",
                    getHostPath() + "js/vue.min.js",
                    // 字体图标
                    getHostPath() + "fontAdmin/iconfont.css",
                    getHostPath() + "font/iconfont.css",
                    // dom模板
                    getHostPath() + "css/admin-all.css",
                    getHostPath() + "js/admin-creat.js",
                ],
            });
        </script>
    </head>
    
    <body class="fontPC" style="display:none;">
        <div class="winSizeBox">
            
            <!-- =============================================================== 搜索筛选(顶部) -->
            <div id="thisHeader" style="width:7.5rem; height:0.85rem; padding:10px; position:fixed;" class="fboxRow Xstart Ystretch index-1x">
                <!-- 返回区域 -->
                <div class="fboxCol Xstart Ystart">
                    <!-- 返回按钮 -->
                    <div class="admin-btn-roundM bg-yellow" @click='doui.pageToUrl({ type: "replace", url: "redpackExchangeList.html" });'>
                        <div><i class="fi fi-left"></i></div>
                        <div class="admin-marginLeft">返回</div>
                    </div>
                </div>
                <!-- 用户信息 -->
                <div v-show="user.show" class="fboxCol Xstart Ystart" style="margin-left:30px;">
                    <!-- 基本信息 -->
                    <div class="fboxRow Xstart Ycenter">
                        <!-- 用户头像 -->
                        <div><img class="admin-imgS border-arc" :src="user.info.img"/></div>
                        <!-- ID、昵称 -->
                        <div class="fboxCol Xcenter Ystart admin-marginLeft">
                            <div class="font15 font-black">{{user.info.name}}</div>
                            <div class="font15 font-gray admin-marginTop">ID:{{sys.uid}}</div>
                        </div>
                    </div>
                    <!-- 提现信息 -->
                    <div class="fboxRow Xstart Ycenter" style="margin-top:20px;">
                        <div class="font15 font-green">本次提现:¥{{user.tiXian.money}}</div>
                        <div class="font15 font-green" style="margin-left:30px;">申请时间:{{user.tiXian.time}}</div>
                    </div>
                    <!-- 统计信息 -->
                    <div class="fboxRow Xstart Ycenter" style="margin-top:20px;">
                        <div class="bg-gray border-round font-white admin-marginRight" style="padding:10px;">正在申请 ¥{{user.moneyed.moneyInit}}</div>
                        <div class="bg-gray border-round font-white admin-marginRight" style="padding:10px;">成功 ¥{{user.moneyed.moneySucceed}}</div>
                        <div class="bg-gray border-round font-white admin-marginRight" style="padding:10px;">拒绝 ¥{{user.moneyed.moneyReject}}</div>
                        <div class="bg-green border-round font-white admin-marginRight" style="padding:10px;">余额 ¥{{user.moneyed.balance}}</div>
                        <div class="bg-gray border-round font-white admin-marginRight" ></div>
                        <div class="bg-gray border-round font-white admin-marginRight" ></div>
                        <div class="bg-gray border-round font-white admin-marginRight" style="padding:10px;">正在申请 {{user.total.countInit}} 次</div>
                        <div class="bg-gray border-round font-white admin-marginRight" style="padding:10px;">成功 {{user.total.countSucceed}} 次</div>
                        <div class="bg-gray border-round font-white admin-marginRight" style="padding:10px;">拒绝 {{user.total.countReject}} 次</div>
                    </div>
                    
                </div>
                <!-- 空白区域 -->
                <div class="flex1"></div>
                <!-- 操作区域 -->
                <div class="fboxCol Xstart Yend">
                    <!-- 输入 -->
                    <div class="fboxRow Xstart Ycenter border-1px border-round" style="position:relative;">
                        <!-- 输入组件 -->
                        <div class="inputShell" style="width:2rem;"><input type="text" placeholder="输入驳回理由" v-model="work.result"/></div>
                        <!-- 展开按钮 -->
                        <div class="fboxRow Xcenter Ycenter font-gray cursor-pointer" style="padding:10px;" @click="work.show=!work.show;">
                            <i class="fi" :class="work.show==true?'fi-up':'fi-down'"></i>
                        </div>
                        <!-- 列表选项 -->
                        <div v-show="work.show" class="admin-list index-1x" style="width:100%; min-width:100%; position:absolute; top:130%; right:0;">
                            <div v-for="item in work.list" class="cursor-default" @click="work.action_click(item)">
                                <div class="font-ell1">{{item}}</div>
                            </div>
                        </div>
                    </div>
                    <!-- 按钮 -->
                    <div class="fboxRow Xend Ycenter admin-marginTop">
                        <div class="admin-btn-roundM bg-green click-translateY admin-marginLeft" @click="work.action_ok()">通过</div>
                        <div class="admin-btn-roundM bg-red click-translateY admin-marginLeft" @click="work.action_no()">驳回</div>
                    </div>
                </div>
            
                <!-- =============================================================== 验证码弹框 -->
                <div v-show="yzm.show" class="layer-dark fboxRow Xcenter Ycenter">
                    <div style="width:2rem; padding:20px; position:relative;" class="bg-white border-round fboxCol Xstart Ycenter">
                        <!-- 关闭按钮 -->
                        <div class="admin-tan-close admin-btn-arcS" @click="yzm.action_close()"><i class="fi fi-no"></i></div>
                        <!-- 标题 -->
                        <div class="font20 font-blue">身份验证</div>
                        <!-- 输入组件 -->
                        <div class="fboxRow Xcenter Ycenter" style="margin-top:0.2rem;">
                            <div>验证码:</div>
                            <div class="inputShell border-1px border-round" style="width:0.8rem;"><input type="text" v-model="yzm.result"/></div>
                            <!-- 发送验证码 -->
                            <div class="admin-btn-roundM admin-marginLeft" :class="yzm.sendType==0?'bg-blue click-color':'bg-gray'" @click="yzm.action_send()">
                                <div v-show="yzm.sendType==0">发送验证码</div>
                                <div v-show="yzm.sendType==1">{{yzm.time}}</div>
                            </div>
                        </div>
                        <!-- 提交按钮 -->
                        <div class="admin-btn-roundL click-scale bg-green" style="margin-top:0.2rem;" @click="yzm.action_submit()">确定验证码</div>
                    </div>
                </div>
                
            </div>
            
            <!-- =============================================================== 表格 -->
            <div id="thisTable" class="admin-main-overHeader" style="padding-top:0.85rem;"></div>
            
        </div>
    </body>
    
</html>
 
 
<script type="text/javascript">
    
    // 顶部vue
    var vm_top = null;
    // ==================================================================================== 页面数据
    doui.onReady({
        success: function ()
        {
            // ----------------------------------------------------- 顶部
            vm_top = new Vue({
                el: "#thisHeader",
                data: {
                    
                    // 系统
                    sys: {
                        tid: null, // 提现申请ID
                        uid: null, // 用户ID
                    },
                    
                    // 用户信息
                    user: {
                        show: false, // 是否显示
                        // 基本信息
                        info: {
                            img: "", // 用户头像
                            name: "", // 用户昵称
                            mark: "", // 备注
                        },
                        // 金额
                        moneyed: {
                            all: 0, // 历史总到账收益
                            moneyInit: 0, // 正在提现
                            moneySucceed: 0, // 成功金额
                            moneyReject: 0, // 拒绝
                            balance: 0, // 当前余额
                        },
                        
                        // 次数
                        total: {
                            countInit: 0, // 正在申请中
                            countSucceed: 0, // 成功
                            countReject: 0, // 拒绝
                        },
                        
                        // 本次提现行为
                        tiXian: {
                            money: 0, // 申请提现数额
                            time: "", // 申请时间
                        },
                        // 请求用户信息
                        request: function ()
                        {
                            // 请求用户信息
                            doui.request({
                                type: "jsonp",
                                url: gethttp() + "/admin/new/api/v1/redpack/getApplyInfo",
                                data: { id: vm_top.sys.tid, },
                                success: function (res) 
                                {
                                    if (res.code != 0) { doui.showToast(res.msg); }
                                    else
                                    {
                                        // 用户信息赋值
                                        vm_top.user.info.img = res.data.userInfo.portrait; // 用户头像
                                        vm_top.user.info.name = res.data.userInfo.nickName; // 用户昵称
                                    
                                        vm_top.user.moneyed.moneyInit = res.data.moneyInit; 
                                        vm_top.user.moneyed.moneySucceed = res.data.moneySucceed; 
                                        vm_top.user.moneyed.moneyReject = res.data.moneyReject; 
                                        vm_top.user.moneyed.balance = res.data.balance; 
                                        
                                        vm_top.user.total.countInit = res.data.countInit;
                                        vm_top.user.total.countSucceed = res.data.countSucceed; 
                                        vm_top.user.total.countReject = res.data.countReject; 
                                    
                                        // 提现行为信息
                                        vm_top.user.tiXian.money = res.data.exchange.money; // 申请提现金额
                                        if (res.data.exchange.createTime) 
                                        {
                                            // 申请时间
                                            doui.timestampToDate({
                                                timestamp: res.data.exchange.createTime.time,
                                                success: function (timeD) { vm_top.user.tiXian.time = timeD; }
                                            });
                                        }
                                        // 显示信息
                                        vm_top.user.show = true;
                                    }
                                },
                            });
                        },
                    },
                    
                    // 审核处理组件相关
                    work: {
                        // 是否展示弹框
                        show: false,
                        // 填写的反驳原因
                        result: "",
                        // 可选择的驳回原因
                        list: [
                            "账户资金异常,请进一步核实后申请提现",
                            "账户涉嫌违规,禁止提现",
                        ],
                        // 原因选择 点击
                        action_click: function (itemC)
                        {
                            // 赋值
                            vm_top.work.result = itemC;
                            // 隐藏弹框
                            vm_top.work.show = false;
                        },
 
                        // 通过 点击
                        action_ok: function () 
                        {
                            // 发起请求
                            doui.showLoading("正在处理");
                            doui.request({
                                type: "jsonp",
                                url: gethttp() + "/admin/new/api/v1/redpack/passExchange",
                                data: { id: vm_top.sys.tid },
                                success: function (res) 
                                {
                                    doui.hideLoading();
                                    // 验证未通过
                                    if (res.code == 3) { vm_top.yzm.state = 0; vm_top.yzm.show = true; }
                                    else if (res.code != 0) { doui.showToast(res.msg); }
                                    else
                                    {
                                        doui.showToast("处理成功");
                                        setTimeout(function()
                                        {
                                            // 回到上一页
                                            doui.pageToUrl({
                                                type: "replace",
                                                url: "redpackExchangeList.html",
                                            });
                                            
                                        }, 800);
                                    }
                                }
                            });
                        },
                        // 驳回 点击
                        action_no: function () 
                        {
                            // 必须填写拒绝原因
                            if (!vm_top.work.result) { doui.showToast("请输入拒绝原因"); return false; }
                            // 发起请求
                            doui.showLoading("正在处理");
                            doui.request({
                                type: "jsonp",
                                url: gethttp() + "/admin/new/api/v1/redpack/rejectExchange",
                                data: { 
                                    id: vm_top.sys.tid,
                                    reason: vm_top.work.result,
                                },
                                success: function (res) 
                                {
                                    doui.hideLoading();
                                    // 验证未通过
                                    if (res.code == 3) { vm_top.yzm.state = 0; vm_top.yzm.show = true; }
                                    else if (res.code != 0) { doui.showToast(res.msg); }
                                    else
                                    {
                                        doui.showToast("处理成功");
                                        setTimeout(function()
                                        {
                                            // 回到上一页
                                            doui.pageToUrl({
                                                type: "replace",
                                                url: "redpackExchangeList.html",
                                            });
                                            
                                        }, 800);
                                    }
                                }
                            });
                        },
                    },
                    
                    // 验证码处理
                    yzm: {
                        state: 1, // 是否已经通过验证,默认通过1,在"允许"/"拒绝"时会接口返回
                        show: false, // 是否显示弹框
                        sendType: 0, // 发送状态:0-未发送    1-刚发送
                        time: 30, // 下次发送倒计时,(s)
                        result: "", // 输入信息
                        // 初始化验证码
                        init: function () 
                        {
                            vm_top.yzm.show = false;
                            vm_top.yzm.sendType = 0;
                            vm_top.yzm.time = 30;
                            vm_top.yzm.result = "";
                        },
                        // 弹框关闭 点击
                        action_close: function () { vm_top.yzm.show = false; vm_top.yzm.result = ""; },
                        // 发送验证码 点击
                        action_send: function () 
                        {
                            // 未发送状态时,才可以执行
                            if (vm_top.yzm.sendType == 0)
                            {
                                // 发起请求
                                doui.showLoading("发送中");
                                doui.request({
                                    type: "jsonp",
                                    url: gethttp() + "/admin/new/api/v1/email/sendExtractCode",
                                    success: function (res)
                                    {
                                        doui.hideLoading();
                                        if (res.code != 0) { doui.showToast(res.msg); }
                                        else 
                                        {
                                            // 修改发送状态
                                            vm_top.yzm.sendType = 1;
                                            // 重发倒计时
                                            var thisInval = setInterval(function()
                                            {
                                                // 倒计时-1
                                                vm_top.yzm.time--;
                                                // 如果倒计时结束,重置发送状态
                                                if (vm_top.yzm.time <= 0)
                                                {
                                                    // 结束定时器
                                                    if (thisInval) { clearInterval(thisInval); }
                                                    // 状态修正
                                                    vm_top.yzm.sendType = 0;
                                                    vm_top.yzm.time = 30;
                                                }
                                                
                                            }, 1000);
                                        }
                                    }
                                });
                            }
                        },
                        // 验证码输入提交 点击
                        action_submit: function ()
                        {
                            if (vm_top.yzm.result.length <= 0) { doui.showToast("请输入验证码"); }
                            else
                            {
                                // 发起请求
                                doui.showLoading("正在处理");
                                doui.request({
                                    type: "jsonp",
                                    url: gethttp() + "/admin/new/api/v1/email/verifyExtractCode",
                                    data: { code: vm_top.yzm.result },
                                    success: function (res) 
                                    {
                                        doui.hideLoading();
                                        if (res.code != 0) { doui.showToast(res.msg); }
                                        else { vm_top.yzm.state = 1; vm_top.yzm.init(); doui.showToast("验证通过,请继续操作"); }
                                    }
                                });
                            }
                        },
                    },
                    
                },
            });
            
            
            // ----------------------------------------------------- 表格
            // 创建表格dom
            adminDom.table.creat({
                el: "#thisTable",
                touchSearch: function(optC)
                {
                    // 发起请求
                    doui.showLoading({ content: "加载列表" });
                    doui.request({
                        type: "jsonp",
                        url: gethttp() + "/admin/new/api/v1/redpack/query",
                        data: {
                            pageIndex: optC.table.page, // 页码
                            pageSize: optC.table.pageSize, // 每页数量
                            key: vm_top.sys.uid, // 用户id
                        },
                        success: function (res)
                        {
                            doui.hideLoading();
                            if (res.code != 0) { doui.showToast({ content: res.msg }); }
                            else 
                            {
                                // 申明 表格内容数据
                                var mo_tr = []; // tr组
                                for (var i = 0, mo = res.data.result_list; i < mo.length; i++)
                                {
                                    // 当前行
                                    var thatTr = {
                                        check: false,
                                        td: [
                                            { title: "申请ID", key: mo[i].id, value: mo[i].id },
                                            { title: "申请金额", key: mo[i].money, value: '¥'+mo[i].money },
                                            { title: "申请时间", key: mo[i].createTime, value: mo[i].createTime, "class": "font-gray" },
                                            { title: "审核状态", key: mo[i].state, value: mo[i].state },
                                            { title: "审核人员", key: mo[i].auditName, value: mo[i].auditName },
                                            { title: "审核时间", key: mo[i].auditTime, value: mo[i].auditTime, "class": "font-gray" },
                                            { title: "原因", key: mo[i].reason, value: mo[i].reason },
                                        ],
                                    };
                                    // 审核状态
                                    if (thatTr.td[3].key == 0) { thatTr.td[3].value = "待审核"; thatTr.td[3]["class"] = "font-orange"; }
                                    else if (thatTr.td[3].key == 1) { thatTr.td[3].value = "已同意"; thatTr.td[3]["class"] = "font-green"; }
                                    else if (thatTr.td[3].key == 2) { thatTr.td[3].value = "已驳回"; thatTr.td[3]["class"] = "font-red"; }
                                    // 将当前行放入tr组
                                    mo_tr.push(thatTr);
                                }
                                // 更新表格的数据
                                adminDom.table.opt({ pageMax: res.data.pe.totalPage }); // 最大页码
                                adminDom.table.tbody({ tr: mo_tr }); // 内容数据
                            }
                        }
                    });
                }
            });
            // 表格设置
            adminDom.table.opt({ pageSize: 20, showCheck: false, });
            // 表格头排
            adminDom.table.thead({
                th: [
                    { title: "申请ID", width: "", orderUp: "", orderDown: "" },
                    { title: "申请金额", width: "", orderUp: "", orderDown: "" },
                    { title: "申请时间", width: "", orderUp: "", orderDown: "" },
                    { title: "审核状态", width: "", orderUp: "", orderDown: "" },
                    { title: "审核人员", width: "", orderUp: "", orderDown: "" },
                    { title: "审核时间", width: "", orderUp: "", orderDown: "" },
                    { title: "原因", width: "", orderUp: "", orderDown: "" },
                ]
            });
            // 工具栏
            adminDom.table.tools({ show: false, });
            
            
            // ----------------------------------------------------- 初始行为
            // 获取传递值
            doui.urlParam({
                success: function (urlD) 
                {
                    // 保存提现id
                    if (urlD.tid) { vm_top.sys.tid = urlD.tid; }
                    // 保存用户id
                    if (urlD.uid) { vm_top.sys.uid = urlD.uid; vm_table.search(); }
                    // 获取用户信息
                    vm_top.user.request();
                },
            });
            
            
            document.body.style.display = "block";
        }
    });
    
</script>