123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- {include file="common/header"/}
- <style>
- .yourclass {
- display: block;
- }
- .canel {
- display: none;
- }
- </style>
- <div class="LM-container">
- <div class="LM-main">
- <fieldset class="layui-elem-field layui-field-title">
- <legend>后台账号列表</legend>
- <blockquote class="layui-elem-quote">
- <div class="LM-table">
- <div class="layui-inline">
- <input type="text" id='keys' name="keys" lay-verify="required"
- placeholder="{:lang('pleaseEnter')}" autocomplete="off" class="layui-input">
- </div>
- <a href="javascript:;" class="layui-btn data-add-btn layui-btn-sm" lay-submit="" lay-filter="add"
- id="search">
- {:lang('search')}
- </a>
- <div class="layui-inline">
- <input type="text" id='name' name="name" lay-verify="required"
- placeholder="账号呢称" autocomplete="off" class="layui-input">
- </div>
- <a href="javascript:;" class="layui-btn data-add-btn layui-btn-sm" lay-submit="" lay-filter="add"
- id="addUser">添加用户
- </a>
- </div>
- </blockquote>
- </fieldset>
- <table class="layui-table" id="list" lay-filter="list"></table>
- </div>
- </div>
- <script type="text/html" id="action">
- <!--<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="vip_level">设置会员等级</a>-->
- <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除账号</a>
- <a class="layui-btn layui-btn-xs" lay-event="update_pwd">重置密码</a>
- <a href="{:url('showuser')}?user_id={{d.id}}" class="layui-btn layui-btn-xs" >查看收款信息</a>
- </script>
- <script type="text/html" id="status">
- <input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-text="正常|禁止" lay-filter="status" {{ d.status== 0 ? 'checked' : '' }}>
- </script>
- <script type="text/html" id="daili">
- <input type="checkbox" name="is_admin" value="{{d.id}}" lay-skin="switch" lay-text="是|否" lay-filter="is_admin" {{ d.is_admin== 1 ? 'checked' : '' }}>
- </script>
- <script type="text/html" id="avatar">
- {{d.image}}<img src="/static/admin/images/image.gif"
- onmouseover="layer.tips('<img src={{d.image}}>',this,{tips: [1, '#fff']});"
- onmouseout="layer.closeAll();">
- </script>
- {include file="common/footer"/}
- <script>
- layui.use(['form', 'table'], function () {
- var $ = layui.jquery,
- form = layui.form,
- table = layui.table;
- var tableIn = table.render({
- elem: '#list',
- url: '{:url("adminuser")}',
- method: 'post',
- title: '用户数据表',
- // toolbar: '#toolbar', //开启头部工具栏,并为其绑定左侧模板
- defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可
- title: '提示'
- , layEvent: 'LAYTABLE_TIPS'
- , icon: 'layui-icon-tips'
- }],
- cols: [[
- // {checkbox: true, fixed: true},
- {field: 'id', title: 'ID', width: 80, sort: true},
- {field: 'name', title: '名字', width: 120,edit:"text"},
- {field: 'mail', title: '邮箱', width: 120,edit:"text"},
- {field: 'phone', title: '手机', width: 120,edit:"text"},
- {field: 'status', title: '状态', width: 180, templet: '#status'},
- {field: 'money', title: '通证余额', width: 180,edit:"text"},
- {field: 'ensure_money', title: '保证金', width: 180,edit:"text"},
- {field: 'push_money', title: '可售额度', width: 180,edit:"text"},
- {field: 'pool_money', title: '矿池矿金', width: 180,edit:"text"},
- {title: '操作', width: 300, toolbar: '#action', align: "center"},
- ]],
- limits: [10, 15, 20, 25, 50, 100],
- limit: 15,
- page: true
- });
- //监听单元格编辑
- table.on('edit(list)', function(obj){
- var value = obj.value //得到修改后的值
- ,data = obj.data //得到所在行所有键值
- ,field = obj.field; //得到字段
- let da={
- id:data.id,
- field:field,
- value:value
- }
- $.post("{:url('update_user_admin')}", da, function (res) {
- if (res.code ==200) {
- layer.msg(res.msg, {time: 1000, icon: 1});
- } else {
- tableIn.reload()
- layer.msg(res.msg, {time: 1000, icon: 2});
- }
- },"json");
- });
- table.on('tool(list)', function (obj) {
- var data = obj.data;
- if (obj.event === 'del') {
- layer.confirm('您确定要删除该账号吗', function (index) {
- loading = layer.load(1, {shade: [0.1, '#fff']});
- $.post("{:url('delete_user')}", {id: data.id}, function (res) {
- layer.close(loading);
- layer.close(index);
- if (res.code ==200) {
- layer.msg(res.msg, {time: 1000, icon: 1});
- obj.del();
- } else {
- layer.msg(res.msg, {time: 1000, icon: 2});
- }
- },"json");
- });
- }
- if (obj.event === 'update_pwd') {
- layer.prompt({title: '请填写新密码', formType: 3}, function(text, index){
- layer.close(index);
- if (!text){
- layer.msg("请填写新密码", {time: 1000, icon: 1});
- return ;
- }
- let datas={
- id:data.id,
- pwd:text
- }
- loading = layer.load(1, {shade: [0.1, '#fff']});
- $.post("{:url('update_pwd')}", datas, function (res) {
- layer.close(loading);
- if (res.code ==200) {
- layer.msg(res.msg, {time: 1000, icon: 1});
- // obj.del();
- } else {
- layer.msg(res.msg, {time: 1000, icon: 2});
- }
- },"json");
- });
- }
- });
- form.on('switch(status)', function (data) {
- // 修改状态
- loading = layer.load(1, {shade: [0.1, '#fff']});
- $.post("{:url('fenhao')}", {id: data.value}, function (res) {
- layer.close(loading);
- if (res.code == 200) {
- layer.msg(res.msg, {time: 1000, icon: 1});
- } else {
- layer.msg(res.msg, {time: 1000, icon: 2});
- }
- }, "json");
- });
- $('#search').click(function () {
- var $keys = $('#keys').val();
- if (!$keys) {
- return layer.msg('请输入关键词');
- }
- tableIn.reload({page: {page: 1}, where: {keys: $keys}});
- })
- // 添加账号
- $("#addUser").click(function () {
- let name=$("#name").val()
- if (!name){
- return layer.msg('请输入呢称');
- }
- let data={
- name:name
- }
- loading = layer.load(1, {shade: [0.1, '#fff']});
- $.post("{:url('add_admin_user')}", data, function (res) {
- layer.close(loading);
- if (res.code == 200) {
- layer.msg(res.msg, {time: 1000, icon: 1});
- tableIn.reload()
- } else {
- layer.msg(res.msg, {time: 1000, icon: 2});
- }
- }, "json");
- })
- });
- </script>
|