| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-member" lay-title="用户管理"> |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-member" lay-title="用户列表"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | |
| | | <div class="layui-col-md10"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">邀请码</label> |
| | | <label class="layui-form-label layui-form-label-sm">地址</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" name="inviteId" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">状态</label> |
| | | <div class="layui-input-inline"> |
| | | <select name="accountStatus"> |
| | | <option value=""></option> |
| | | <option value="2">禁用</option> |
| | | <option value="1">有效</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">可兑换</label> |
| | | <div class="layui-input-inline"> |
| | | <select name="changeAble"> |
| | | <option value=""></option> |
| | | <option value="2">否</option> |
| | | <option value="1">是</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">可提现</label> |
| | | <div class="layui-input-inline"> |
| | | <select name="withdrawAble"> |
| | | <option value=""></option> |
| | | <option value="2">否</option> |
| | | <option value="1">是</option> |
| | | </select> |
| | | <input type="text" name="inviteId" autocomplete="off" placeholder="输入地址或邀请码" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary table-action action-more" |
| | | shiro:hasAnyPermissions="user:add,user:update,user:password:reset,user:export"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </form> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script type="text/html" id="user-status"> |
| | | {{# |
| | | var status = { |
| | | 1: {title: '有效', color: 'green'}, |
| | | 2: {title: '禁用', color: 'volcano'} |
| | | }[d.accountStatus]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{status.color}}">{{ status.title }}</span> |
| | | <style> |
| | | .layui-table-cell { |
| | | height: auto !important; |
| | | } |
| | | </style> |
| | | <script type="text/html" id="switchPartner"> |
| | | {{# if(d.nodeType === 1) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="是|否" checked lay-skin="switch" lay-filter="switchPartner"> |
| | | {{# } else { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="是|否" lay-skin="switch" lay-filter="switchPartner"> |
| | | {{# } }} |
| | | </script> |
| | | <script type="text/html" id="change-able"> |
| | | {{# |
| | | var status = { |
| | | 1: {title: '是', color: 'green'}, |
| | | 2: {title: '否', color: 'volcano'} |
| | | }[d.changeAble]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{status.color}}">{{ status.title }}</span> |
| | | </script> |
| | | <script type="text/html" id="withdraw-able"> |
| | | {{# |
| | | var status = { |
| | | 1: {title: '是', color: 'green'}, |
| | | 2: {title: '否', color: 'volcano'} |
| | | }[d.withdrawAble]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{status.color}}">{{ status.title }}</span> |
| | | </script> |
| | | <script type="text/html" id="user-sex"> |
| | | {{# |
| | | var sex = { |
| | | 2: {title: '保密'}, |
| | | 1: {title: '女'}, |
| | | 0: {title: '男'} |
| | | }[d.sex]; |
| | | }} |
| | | <span>{{ sex.title }}</span> |
| | | </script> |
| | | <script type="text/html" id="user-option"> |
| | | <span shiro:lacksPermission="user:view,user:update,user:delete"> |
| | | <span class="layui-badge-dot febs-bg-orange"></span> 无权限 |
| | | </span> |
| | | <a lay-event="detail" shiro:hasPermission="user:view"><i |
| | | class="layui-icon febs-edit-area febs-green"></i></a> |
| | | <a lay-event="edit" shiro:hasPermission="user:update"><i |
| | | class="layui-icon febs-edit-area febs-blue"></i></a> |
| | | <a lay-event="del" shiro:hasPermission="user:delete"><i class="layui-icon febs-edit-area febs-red"></i></a> |
| | | <script type="text/html" id="switchAccountStatus"> |
| | | {{# if(d.accountStatus === 1) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="正常|禁用" checked lay-skin="switch" lay-filter="switchAccountStatus"> |
| | | {{# } else { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="正常|禁用" lay-skin="switch" lay-filter="switchAccountStatus"> |
| | | {{# } }} |
| | | </script> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | | layui.use(['dropdown', 'jquery', 'laydate', 'form', 'table', 'febs', 'treeSelect'], function () { |
| | |
| | | febs = layui.febs, |
| | | form = layui.form, |
| | | table = layui.table, |
| | | treeSelect = layui.treeSelect, |
| | | dropdown = layui.dropdown, |
| | | $view = $('#febs-member'), |
| | | $query = $view.find('#query'), |
| | | $reset = $view.find('#reset'), |
| | | $searchForm = $view.find('form'), |
| | | sortObject = {field: 'createTime', type: null}, |
| | | tableIns, |
| | | createTimeFrom, |
| | | createTimeTo; |
| | | tableIns; |
| | | |
| | | form.render(); |
| | | |
| | | initTable(); |
| | | |
| | | laydate.render({ |
| | | elem: '#user-createTime', |
| | | range: true, |
| | | trigger: 'click' |
| | | }); |
| | | |
| | | dropdown.render({ |
| | | elem: $view.find('.action-more'), |
| | | click: function (name, elem, event) { |
| | | var checkStatus = table.checkStatus('memberTable'); |
| | | if (name === 'add') { |
| | | febs.modal.open('新增用户', 'system/user/add', { |
| | | btn: ['提交', '重置'], |
| | | area: $(window).width() <= 750 ? '95%' : '50%', |
| | | offset: '30px', |
| | | yes: function (index, layero) { |
| | | $('#user-add').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | $('#user-add').find('#reset').trigger('click'); |
| | | return false; |
| | | } |
| | | }); |
| | | } |
| | | if (name === 'delete') { |
| | | if (!checkStatus.data.length) { |
| | | febs.alert.warn('请选择需要删除的用户'); |
| | | } else { |
| | | febs.modal.confirm('删除用户', '确定删除该用户?', function () { |
| | | var userIds = []; |
| | | layui.each(checkStatus.data, function (key, item) { |
| | | userIds.push(item.userId) |
| | | }); |
| | | deleteUsers(userIds.join(',')); |
| | | }); |
| | | } |
| | | } |
| | | if (name === 'reset') { |
| | | if (!checkStatus.data.length) { |
| | | febs.alert.warn('请选择需要重置密码的用户'); |
| | | } else { |
| | | var usernames = []; |
| | | layui.each(checkStatus.data, function (key, item) { |
| | | usernames.push(item.username) |
| | | }); |
| | | febs.post(ctx + 'user/password/reset/' + usernames.join(','), null, function () { |
| | | febs.alert.success('所选用户密码已重置为1234qwer'); |
| | | }); |
| | | } |
| | | } |
| | | if (name === 'export') { |
| | | var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); |
| | | params.pageSize = $view.find(".layui-laypage-limits option:selected").val(); |
| | | params.pageNum = $view.find(".layui-laypage-em").next().html(); |
| | | febs.download(ctx + 'user/excel', params, '用户信息表.xlsx'); |
| | | } |
| | | }, |
| | | options: [{ |
| | | name: 'add', |
| | | title: '新增用户', |
| | | perms: 'user:add' |
| | | }, { |
| | | name: 'delete', |
| | | title: '删除用户', |
| | | perms: 'user:delete' |
| | | }, { |
| | | name: 'reset', |
| | | title: '密码重置', |
| | | perms: 'user:password:reset' |
| | | }, { |
| | | name: 'export', |
| | | title: '导出Excel', |
| | | perms: 'user:export' |
| | | }] |
| | | }); |
| | | |
| | | treeSelect.render({ |
| | | elem: $view.find('#dept'), |
| | | type: 'get', |
| | | data: ctx + 'dept/select/tree', |
| | | placeholder: '请选择', |
| | | search: false |
| | | }); |
| | | |
| | | table.on('tool(memberTable)', function (obj) { |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | if (layEvent === 'detail') { |
| | | febs.modal.view('用户信息', 'system/user/detail/' + data.username, { |
| | | area: $(window).width() <= 750 ? '95%' : '660px' |
| | | }); |
| | | } |
| | | if (layEvent === 'del') { |
| | | febs.modal.confirm('删除用户', '确定删除该用户?', function () { |
| | | deleteUsers(data.userId); |
| | | }); |
| | | } |
| | | if (layEvent === 'edit') { |
| | | febs.modal.open('修改用户', 'system/user/update/' + data.username, { |
| | | area: $(window).width() <= 750 ? '90%' : '50%', |
| | | offset: '30px', |
| | | btn: ['提交', '取消'], |
| | | yes: function (index, layero) { |
| | | $('#user-update').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | |
| | | table.on('sort(memberTable)', function (obj) { |
| | |
| | | elem: $view.find('table'), |
| | | id: 'memberTable', |
| | | url: ctx + 'member/list', |
| | | totalRow: true ,// 开启合计行 |
| | | cols: [[ |
| | | {type: 'checkbox'}, |
| | | {field: 'address', title: '地址', minWidth: 100}, |
| | | {field: 'balance', title: '余额'}, |
| | | {field: 'inviteId', title: '邀请码', minWidth: 165}, |
| | | {field: 'refererId', title: '上级邀请码', minWidth: 180}, |
| | | {title: '账户状态', templet: '#user-status'}, |
| | | {title: '是否可兑换', templet: '#change-able'}, |
| | | {title: '是否可提现', templet: '#withdraw-able'}, |
| | | {field: 'address', title: '地址', minWidth: 400, totalRowText: '合计:'}, |
| | | {field: 'availableAmount', title: '可用金额', minWidth: 80,totalRow: '{{= parseInt(d.availableAmount) }}'}, |
| | | {field: 'usdtBalance', title: '额度', minWidth: 100,totalRow: '{{= parseInt(d.usdtBalance) }}'}, |
| | | {field: 'inviteId', title: '邀请码', minWidth: 100}, |
| | | {field: 'refererId', title: '上级邀请码', minWidth: 100}, |
| | | {field: 'accountStatus', title: '状态', templet:'#switchAccountStatus', minWidth: 120}, |
| | | {field: 'nodeType', title: '节点', templet:'#switchPartner', minWidth: 120}, |
| | | {field: 'createTime', title: '创建时间', minWidth: 180}, |
| | | {title: '操作', toolbar: '#user-option', minWidth: 140} |
| | | ]] |
| | | }); |
| | | } |
| | | |
| | | function getQueryParams() { |
| | | return { |
| | | inviteId: $searchForm.find('input[name="inviteId"]').val().trim(), |
| | | changeAble: $searchForm.find("select[name='changeAble']").val(), |
| | | accountStatus: $searchForm.find("select[name='accountStatus']").val(), |
| | | withdrawAble: $searchForm.find("input[name='withdrawAble']").val(), |
| | | inviteId: $searchForm.find('input[name="inviteId"]').val(), |
| | | nodeType: $searchForm.find("select[name='nodeType']").val(), |
| | | invalidate_ie_cache: new Date() |
| | | }; |
| | | } |
| | | |
| | | function deleteUsers(userIds) { |
| | | var currentUserId = currentUser.userId + ''; |
| | | if (('' + userIds).split(',').indexOf(currentUserId) !== -1) { |
| | | febs.alert.warn('所选用户包含当前登录用户,无法删除'); |
| | | return; |
| | | form.on('switch(switchAccountStatus)', function (data) { |
| | | if (data.elem.checked) { |
| | | changeAccountStatus(data.value); |
| | | } else { |
| | | changeAccountStatus(data.value); |
| | | } |
| | | febs.get(ctx + 'user/delete/' + userIds, null, function () { |
| | | febs.alert.success('删除用户成功'); |
| | | }) |
| | | |
| | | function changeAccountStatus(id) { |
| | | febs.get(ctx + 'member/accountStatus/'+ id, null, function () { |
| | | febs.alert.success('设置成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | |
| | | form.on('switch(switchPartner)', function (data) { |
| | | if (data.elem.checked) { |
| | | changeIdentityYes(4, data.value); |
| | | } else { |
| | | changeIdentityNo(4, data.value); |
| | | } |
| | | }) |
| | | |
| | | function changeIdentityYes(type, id) { |
| | | febs.get(ctx + 'member/changeIdentityYes/' + type + "/" + id, null, function () { |
| | | febs.alert.success('设置成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | function changeIdentityNo(type, id) { |
| | | febs.get(ctx + 'member/changeIdentityNo/' + type + "/" + id, null, function () { |
| | | febs.alert.success('设置成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | </script> |
| | | </script> |