123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- {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>
- <a href="{$urls}" class="layui-btn layui-btn-xs" lay-event="tzlg">返回</a>
- </div>
- </blockquote>
- </fieldset>
- <table class="layui-table" id="list" lay-filter="list"></table>
- </div>
- </div>
- <script type="text/html" id="action">
- <!-- <a href="{:url('edit')}?id={{d.id}}" class="layui-btn layui-btn-xs" lay-event="edit">{:lang('edit')}</a>-->
- <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 href="{:url('certificateshow')}?user_id={{d.id}}" class="layui-btn layui-btn-xs" lay-event="tzlg">通证记录</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>
- <div id="red" style="background-color: white; border-radius: 10px; text-align: center;display: none">
- <div class="layui-form-item">
- <label class="layui-form-label">设置vip等级</label>
- <div class="layui-input-block">
- <select name="vip_levels" lay-verify="required" id="vip_levels">
- {volist name="$vip" id="vs"}
- <option class="option-{$vs.id}" value="{$vs.id}">{$vs.level}级</option>
- {/volist}
- </select>
- </div>
- </div>
- <div style="height: 1px; background-color: #d5d5d5; margin-top: 10px;"></div>
- <div style="width: 100%; text-align: center;">
- <div style="float: left; width: 49.75%; height: 41px; padding-top: 10px;" lay-event="cancel" onclick="cancel()">取消</div>
- <div style="float: left; width: 1px; height: 41px; background-color: #d5d5d5;"></div>
- <div style="float: right; width: 49.75%; height: 41px; padding-top: 10px;" lay-event="sendRedpacket" onclick="sendRedpacket()">确定</div>
- <div style="clear: both;"></div>
- </div>
- </div>
- {include file="common/footer"/}
- <script>
- let redIndex=0;
- let user_id=0;
- let vip_level=0;
- layui.use(['form', 'table'], function () {
- var $ = layui.jquery,
- form = layui.form,
- table = layui.table;
- let user_id={:$user_id};
- console.log("user_id",user_id)
- var tableIn = table.render({
- elem: '#list',
- url: '{:url("xiaji")}',
- method: 'post',
- where:{user_id:user_id},
- 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,},
- {field: 'maild', title: '邮箱', width: 120,},
- {field: 'phone', title: '手机', width: 120,},
- {field: 'sex', title: '性别', width: 120},
- {field: 'vip_level', title: '会员等级', width: 120,},
- {field: 'image', title: '头像', width: 120, templet: "#avatar"},
- {field: 'status', title: '状态', width: 180, templet: '#status'},
- {field: 'pid', title: '上级id', width: 180},
- {field: 'code', title: '邀请码', width: 180},
- {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},
- {field: 'is_admin', title: '是否代理商账号', width: 180, templet: '#daili'},
- {field: 'add_time', title: '注册时间', width: 180},
- {field: 'update_time', title: '更新时间', width: 180},
- {title: '操作', width: 400, 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
- }
- // layer.msg('[ID: '+ data.id +'] ' + field + ' 字段更改为:'+ value);
- // console.log(da)
- $.post("{:url('update_user_money')}", 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 === 'tzlg') {
- // 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 === "vip_level") {
- user_id=data.id;
- vip_level=data.vip_level;
- $(".option-"+vip_level).attr("selected",true);
- redIndex = layer.open({
- type: 1,
- title: false,
- area: ['80%', ''], //宽高
- closeBtn: 0,
- shadeClose: false,
- skin: $(".yourclass"),
- content: $("#red"),
- });
- }
- });
- 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");
- });
- form.on('switch(is_admin)', function (data) {
- // 修改状态
- loading = layer.load(1, {shade: [0.1, '#fff']});
- $.post("{:url('is_admin')}", {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}});
- })
- });
- // 取消
- function cancel() {
- $("#red").addClass("canel")
- layer.close(redIndex);
- }
- // 确定
- function sendRedpacket() {
- let vip_levels=$("#vip_levels").val()
- let loading = layer.load(1, {shade: [0.1, '#fff']});
- let data={
- id:user_id,
- level:vip_levels
- }
- $.post("{:url('update_leve')}", data, function (res) {
- layer.close(loading);
- layer.close(redIndex);
- if (res.code == 200) {
- window.location.reload()
- layer.msg(res.msg, {time: 1000, icon: 1});
- } else {
- layer.msg(res.msg, {time: 1000, icon: 2});
- }
- },"json");
- }
- </script>
|