<!DOCTYPE html> <html lang="en" xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8"> <title>后台管理系统</title> <meta name="renderer" content="webkit"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <link rel="shortcut icon" th:href="@{/images/logo.jpg}"/> <link rel="stylesheet" th:href="@{/js/layui/css/layui.css}"> <link rel="stylesheet" th:href="@{/js/layui/css/admin.css}"> <link rel="stylesheet" th:href="@{/js/layui/css/my.css}"> <script type="text/javascript" th:src="@{/js/jquery-3.3.1.min.js}"></script> <script th:src="@{/js/layui/layui.js}" charset="utf-8"></script> <style type="text/css"> .layui-table-cell { height: auto !important; } .layui-table img { max-width: 100px } </style> </head> <body> <div class="layui-fluid"> <div class="layui-card"> <div class="layui-form layui-card-header layuiadmin-card-header-auto" id="searchdiv"> <div class="layui-form-item"> <div class="layui-inline"> <label class="layui-form-label">用户昵称</label> <div class="layui-input-block"> <input type="text" name="nickname" class="layui-input" placeholder="用户昵称"> </div> </div> <div class="layui-inline"> <select name="istatus"> <option value="">审核状态</option> <option value="0">待审核</option> <option value="1">已提现</option> <option value="2">已拒绝</option> </select> </div> <div class="layui-inline"> <button class="layui-btn layuiadmin-button-btn" lay-submit lay-filter="The-search"> <i class="layui-icon layui-icon-search layuiadmin-button-btn" title="搜索"> </i> </button> <button class="layui-btn layuiadmin-button-btn" onclick="javascript:location.replace(location.href);"> <i class="layui-icon layui-icon-refresh-3 layuiadmin-button-btn" title="刷新"> </i> </button> </div> </div> </div> </div> <div class="layui-card-body"> <table class="layui-hide" id="tableId" lay-filter="tableId"></table> </div> </div> </div> <script type="text/html" id="table-handle"> {{#if (d.istatus == 0) { }} <i class="layui-icon layui-icon-rmb" lay-event="userAskType1" title="审核通过"></i> <i class="layui-icon layui-icon-close-fill" lay-event="userAskType2" title="拒绝提现"></i> {{# } }} </script> <script type="text/html" id="istatus"> {{#if (d.istatus == 0) { }} <span>待审核</span> {{# }else if(d.istatus == 1){ }} <span>已提现</span> {{# }else if(d.istatus == 2){ }} <span>已拒绝</span> {{# } }} </script> <script> var field = {}; field.itypecash = 1; //提现申请 layui.use(['table', 'form'], function () { var form = layui.form, table = layui.table; //监听搜索 form.on('submit(The-search)', function (data) { field = data.field; //执行重载 // console.log(field) table.reload('tableId', { where: field , page: { curr: 1 } }); }); // table.render({ // elem: '#tableId' // , url: 'getList' // // , where: {"userRole": '[[${userRole}]]'} // , method: 'post' // , height: $(window).height() - $("#searchdiv").height() - 20 // , toolbar: '#toolbarUtil' //开启头部工具栏,并为其绑定左侧模板 // , defaultToolbar: ['filter'] // , cols: [ // [ // {type: 'checkbox', field: 'id'} // , {field: 'nickName', width: 100, title: '用户昵称'} // , {field: 'headLink', title: '微信头像', toolbar: '#headLink'} // , {field: 'userPhone', title: '手机号码'} // , {field: 'tcreatetime', title: '申请时间'} // , {field: 'modifiedTime', title: '审核时间'} // , {field: 'userDeposits', width: 100, title: '账号余额'} // , {field: 'userAskDeposits', width: 100, title: '提现金额'} // , {field: 'userAskType', width: 100, title: '审核状态', toolbar: '#userAskType'} // , {field: '', width: 100, title: '操作', toolbar: '#table-handle', fixed: 'right'} // ] // ] // , cellMinWidth: 20 //全局定义常规单元格的最小宽度,layui 2.2.1 新增 // , skin: 'line ' //表格风格 line (行边框风格)row (列边框风格)nob (无边框风格) // , even: true //隔行换色 // , limit: 20 //每页默认显示的数量 // , method: 'post' //提交方式 // , page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档 // layout: ['count', 'prev', 'page', 'next', 'skip', 'limit'] //自定义分页布局 // , curr: 1 //设定初始在第 5 页 // , groups: 10 //只显示 1 个连续页码 // } // , limits: [10, 20, 50, 100] //每页条数的选择项,默认:[10,20,30,40,50,60,70,80,90]。 // , done: function (res, curr, count) { // $(".layui-table-main tr").each(function (index, val) { // $($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height()); // $($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height()); // }); // $(".layui-table-main tr").each(function (index, val) { // $(".layui-table-fixed").each(function () { // $($(this).find(".layui-table-body tbody tr")[index]).height($(val).height()); // }); // }); // $(".layui-table-main tr").each(function (index, val) { // $(".layui-table-fixed").each(function () { // $($(this).find(".layui-table-body tbody th")[index]).height($(val).height()); // }); // }); // } // }); table.render({ elem: '#tableId' , url: 'findPageList' , where: field , method: 'post' ,contentType: "application/json" // 内容编码, json格式 , height: 500 , toolbar: '#toolbarUtil' //开启头部工具栏,并为其绑定左侧模板 , defaultToolbar: ['filter'] , cellMinWidth: 20 //全局定义常规单元格的最小宽度,layui 2.2.1 新增 , skin: 'line ' //表格风格 line (行边框风格)row (列边框风格)nob (无边框风格) , even: true //隔行换色 , limit: 20 //每页默认显示的数量 , page:true ,request: { pageName: "curpage", // 页码的参数名称,默认:page limitName: "pagesize" // 每页数据量的参数名,默认:limit } ,response: { statusName: "code", // 规定数据状态的字段名称,默认:code statusCode: 0, // 规定成功的状态码,默认:0 msgName: "msg", // 规定状态信息的字段名称,默认:msg countName: "count", // 规定数据总数的字段名称,默认:count dataName: "data" // 规定数据列表的字段名称,默认:data } ,parseData: function(res) { // res 即为原始返回的数据 return { "code": res.code, // 解析接口状态 "msg": res.desc, // 解析提示文本 "count": res.data.pageinfo.totalRecords, // 解析数据长度 "data": res.data.items // 解析数据列表 }; } , limits: [10, 20, 50, 100] //每页条数的选择项,默认:[10,20,30,40,50,60,70,80,90]。 , cols: [ [ {title: '用户信息', templet: function(d) { var str = ""; if (d.customer) { str += "<img style='width: 18px' src=" + d.customer.swximgurl + "> "; } if (d.customer) { str += "<span style=''>" + d.customer.swxnick + "</span>" } return str; } } , {title: '提现类型', templet: function(d) { var str = ""; str += '<div>'; var itype = ""; if (d.idetailtype == 21) itype = "业绩"; if (d.idetailtype == 41) itype = "津贴"; str += ' <span>' + itype + '</span>'; str += '</div>'; return str ? str : ""; } } , {title: '提现金额', templet: function(d) { var str = ""; if (d.idetailtype == 21 && d.drmbout) { str += '<span style="color:red;"> '+ (d.drmbout).toFixed(2)+ '</span>'; } if (d.idetailtype == 41 && d.dcoinout) { str += '<span style="color:red;"> '+ (d.dcoinout).toFixed(2)+ '</span>'; } return str; } } , {field: 'istatus', title: '审核状态', toolbar: '#istatus'} , {field: 'tcreatetime', title: '申请时间'} , {field: '', title: '操作', toolbar: '#table-handle', fixed: 'right'} ] ] , done: function (res, curr, count) { $(".layui-table-main tr").each(function (index, val) { $($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height()); $($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height()); }); $(".layui-table-main tr").each(function (index, val) { $(".layui-table-fixed").each(function () { $($(this).find(".layui-table-body tbody tr")[index]).height($(val).height()); }); }); $(".layui-table-main tr").each(function (index, val) { $(".layui-table-fixed").each(function () { $($(this).find(".layui-table-body tbody th")[index]).height($(val).height()); }); }); } }); //头工具栏事件 table.on('toolbar(tableId)', function (obj) { var checkStatus = table.checkStatus(obj.config.id); switch (obj.event) { case 'distributor': var w = ($(window).width() * 0.4); var h = ($(window).height() * 0.5); layer.open({ type: 2 , title: '分销设置' , content: 'toDistributor' , area: [w + 'px', h + 'px'] , fix: false //不固定 , maxmin: true , shadeClose: true , shade: 0.4 , btn: ['保存', '关闭'] , yes: function (index, layero) { var body = layer.getChildFrame('body', index); //得到iframe页面层的BODY var iframeBtn = body.find('#saveBtn');//得到iframe页面层的提交按钮 iframeBtn.click();//模拟iframe页面层的提交按钮点击 } }); break; case 'del': var data = checkStatus.data; var id = ''; if (data.length > 0) { for (var j = 0; j < data.length; j++) { id = id + "," + data[j].goodsId; } } else { layer.msg("请至少选择一条数据!"); return false; } layer.confirm('确定要彻底删除选中的数据吗?', function (index) { $.ajax({ url: "changeDeleteState", data: {"id": id}, type: "POST", dataType: "json", success: function (result) { if (result.code == 100) { layer.msg(result.msg, {icon: 6, time: 1000}, function () { layer.close(index); table.reload('tableId'); }); } else { layer.msg(result.msg, {icon: 5}); } } }); }); break; } }); //监听行工具事件 table.on('tool(tableId)', function (obj) { var data = obj.data; var id = data.id; //console.log(obj) //同意 if (obj.event === 'userAskType1') { var param = {}; param.id = id; param.istatus = 1; $.ajax({ url: "auditWithDraw", data: JSON.stringify(param), type: "POST", dataType: "json", contentType: "application/json;charset=utf-8", success: function (result) { if (result.code == 0) { console.log(result); layer.msg("恭喜您,操作成功", {icon: 6, time: 1000}, function () { table.reload('tableId', { where: field , page: { curr: 1 } }); }); } else { console.log(result); layer.msg(result.msg, {icon: 5}); } } }) } else if (obj.event === 'userAskType2') { //拒绝 var data = obj.data; var id = data.id; var datas = {}; datas.id = id; datas.istatus = 2; $.ajax({ url: "auditWithDraw", data: JSON.stringify(datas), type: "POST", dataType: "json", contentType: "application/json;charset=utf-8", success: function (result) { if (result.code == 0) { layer.msg("恭喜您,操作成功", {icon: 6, time: 1000}, function () { table.reload('tableId', { where: field , page: { curr: 1 } }); }); } else { layer.msg(result.msg, {icon: 5}); } } }) } }); }); </script> </body> </html>