1
0
Files
helper/application/system/view/member/index.html
2020-08-06 14:58:51 +08:00

111 lines
4.1 KiB
HTML

{extend name="public/base" /}
{block name="body"}
<blockquote class="layui-elem-quote">
<button type="button" class="layui-btn layui-btn-small" data-href="{:url('member/add')}" id="add"><i class="layui-icon">&#xe654;</i> 新增用户</button>
<button type="button" class="layui-btn layui-btn-small" data-href="{:url('member/password')}" id="pass"><i class="layui-icon">&#xe642;</i> 重置密码</button>
</blockquote>
<div class="layui-form admin-main">
<table class="layui-table">
<thead>
<tr>
<th width="20"><input type="checkbox" lay-skin="primary" lay-filter="allChoose"></th>
<th width="25"></th>
<th width="50">编号</th>
<th>昵称</th>
<th>用户名</th>
<th>积分</th>
<th>报单</th>
<th width="60">状态</th>
<th width="120">注册时间</th>
<th width="50">登录次数</th>
<th width="120">身份</th>
<th width="110">Vip到期时间</th>
</tr>
</thead>
<tbody>
{volist name="list" id="vo"}
<tr>
<td><input type="checkbox" data-uid="{$vo.id}" lay-filter="uid" lay-skin="primary"></td>
<td><img width="25" height="25" src="{$vo.info.avatar}" alt=""></td>
<td>{$vo.id}</td>
<td>{$vo.info.nickname}</td>
<td>{$vo.username}</td>
<td>{$vo.info.score}</td>
<td>{$vo.junior|default=''}<a class=" layui-btn-small junior" data-href="{:url('member/junior')}?pid={$vo.id}" > 查看</a></td>
<td><input type="checkbox" name="close" data-uid="{$vo.id}" lay-skin="switch" lay-filter="status" {eq name="vo.status" value="1"}checked{/eq} lay-text="正常|禁用"></td>
<td>{$vo.create_time}</td>
<td>{$vo.login}</td>
<td>{$vo.info.vip_text}</td>
<td>{$vo.info.vip_time}</td>
</tr>
{/volist}
</tbody>
</table>
{$list->render();}
</div>
{/block}
{block name="layui"}
<script>
layui.use(['form'], function(){
var $ = layui.jquery, form = layui.form();
form.on('checkbox(allChoose)', function(data) {
var child = $(data.elem).parents('table').find('tbody input[lay-filter="uid"]');
child.each(function(index, item) {
item.checked = data.elem.checked;
});
form.render('checkbox');
});
form.on('switch(status)', function(data) {
$.get("{:url('member/status')}", {uid: $(data.elem).data('uid'), status: data.elem.checked}, function(res) {
layer.msg(res.msg, {icon: Math.abs(res.code - 2), time: 1000});
});
});
$('#pass').on('click', function(e) {
var nodes = getSelected();
if (nodes.length != 1) {
layer.msg('请选择一条要编辑的数据');
} else {
layer.open({
type: 2,
title: $(this).html(),
area: ['400px', '220px'],
content: $(this).data('href') + '?uid=' + nodes[0]
});
}
});
$('#add').on('click', function() {
layer.open({
title:'添加用户',
type: 2,
area: ['400px', '220px'],
content: $(this).data('href')
});
});
$('.junior').on('click', function() {
layer.open({
title:'报单列表',
type: 2,
area: ['100%', '100%'],
content: $(this).data('href')
});
});
function getSelected() {
var child = $('.layui-form').find('tbody input[lay-filter="uid"]:checked');
var idArr = [];
child.each(function(index, item) {
idArr[index] = $(item).data('uid');
});
return idArr;
}
});
</script>
{/block}