<div class="layui-fluid layui-anim febs-anim" id="febs-chat-user-perk-list" lay-title="用户收益列表">
|
<div class="layui-row febs-container">
|
<div class="layui-col-md12">
|
<div class="layui-card">
|
<div class="layui-card-body febs-table-full">
|
<form class="layui-form layui-table-form" lay-filter="user-perk-table-form">
|
<div class="layui-row">
|
<div class="layui-col-md10">
|
<div class="layui-form-item">
|
<div class="layui-inline">
|
<label class="layui-form-label">电话号码:</label>
|
<div class="layui-input-inline">
|
<input type="text" placeholder="电话号码" name="phone" autocomplete="off" class="layui-input">
|
</div>
|
</div>
|
<!-- <div class="layui-inline">-->
|
<!-- <label class="layui-form-label">昵称:</label>-->
|
<!-- <div class="layui-input-inline">-->
|
<!-- <input type="text" placeholder="昵称" name="nickName" autocomplete="off" class="layui-input">-->
|
<!-- </div>-->
|
<!-- </div>-->
|
<div class="layui-inline">
|
<label class="layui-form-label">邀请码:</label>
|
<div class="layui-input-inline">
|
<input type="text" placeholder="邀请码(获取团队下的所有成员)" name="inviteId" autocomplete="off" class="layui-input">
|
</div>
|
</div>
|
<!-- <div class="layui-inline">-->
|
<!-- <label class="layui-form-label">用户类型:</label>-->
|
<!-- <div class="layui-input-inline">-->
|
<!-- <select name="isRobot">-->
|
<!-- <option value="">请选择</option>-->
|
<!-- <option value="0">用户</option>-->
|
<!-- <option value="1">机器人</option>-->
|
<!-- </select>-->
|
<!-- </div>-->
|
<!-- </div>-->
|
</div>
|
</div>
|
<div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area">
|
<div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query">
|
<i class="layui-icon"></i>
|
</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>
|
</div>
|
</form>
|
<table lay-filter="userPerkTable" lay-data="{id: 'userPerkTable'}"></table>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<!-- 表格操作栏 start -->
|
<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="edit" shiro:hasPermission="user:update"><i
|
class="layui-icon febs-edit-area febs-blue"></i></a>
|
</script>
|
<script type="text/html" id="switchGetBoom">
|
{{# if(d.getBoom === 1) { }}
|
<input type="checkbox" value={{d.userId}} lay-text="是|否" checked lay-skin="switch" lay-filter="switchGetBoom">
|
{{# } else { }}
|
<input type="checkbox" value={{d.userId}} lay-text="是|否" lay-skin="switch" lay-filter="switchGetBoom">
|
{{# } }}
|
</script>
|
<script type="text/html" id="isRobot-type">
|
{{# if(d.isRobot == 1) { }}
|
<span class="layui-badge febs-bg-green">机器人</span>
|
{{# } else { }}
|
<span class="layui-badge febs-bg-blue">用户</span>
|
{{# } }}
|
</script>
|
<style>
|
.layui-form-onswitch {
|
background-color: #5FB878 !important;
|
}
|
</style>
|
<!--<script type="text/html" id="toolbar">-->
|
<!-- <div class="layui-btn-container">-->
|
<!-- <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="registerMember">添加会员</button>-->
|
<!-- <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="balance">拨付余额</button>-->
|
<!-- </div>-->
|
<!--</script>-->
|
<!-- 表格操作栏 end -->
|
<script data-th-inline="none" type="text/javascript">
|
// 引入组件并初始化
|
layui.use([ 'jquery', 'form', 'table', 'febs'], function () {
|
var $ = layui.jquery,
|
febs = layui.febs,
|
form = layui.form,
|
table = layui.table,
|
$view = $('#febs-chat-user-perk-list'),
|
$query = $view.find('#query'),
|
$reset = $view.find('#reset'),
|
$searchForm = $view.find('form'),
|
sortObject = {field: 'phone', type: null},
|
tableIns;
|
|
form.render();
|
let currPageUser = 1;//首先默认值为1,防止出错
|
//获取当前页
|
currPageUser = $view.find(".layui-laypage-em").next().html();
|
|
// 表格初始化
|
initTable();
|
|
// 查询按钮
|
$query.on('click', function () {
|
var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type});
|
tableIns.reload({where: params, page: {curr: 1}});
|
});
|
|
// 刷新按钮
|
$reset.on('click', function () {
|
$searchForm[0].reset();
|
sortObject.type = 'null';
|
tableIns.reload({where: getQueryParams(), page: {curr: currPageUser}, initSort: sortObject});
|
});
|
|
// 获取查询参数
|
function getQueryParams() {
|
return {
|
phone: $searchForm.find('input[name="phone"]').val().trim(),
|
// nickName: $searchForm.find('input[name="nickName"]').val().trim(),
|
inviteId: $searchForm.find('input[name="inviteId"]').val().trim(),
|
// isRobot: $searchForm.find("select[name='isRobot']").val()
|
};
|
}
|
|
function initTable() {
|
tableIns = febs.table.init({
|
elem: $view.find('table'),
|
id: 'userPerkTable',
|
url: ctx + 'admin/chat/getUserPerkList',
|
// toolbar:"#toolbar",
|
// defaultToolbar:[],
|
totalRow: true ,// 开启合计行
|
cols: [[
|
// {type: 'checkbox'},
|
{field: 'userId', title: '标识', minWidth: 40,align:'center'},
|
{field: 'phone', title: '电话号码', minWidth: 120,align:'center', totalRowText: '合计:'},
|
{field: 'inviteId', title: '邀请码', minWidth: 100,align:'center',},
|
{title: '用户类型', minWidth: 100,templet: '#isRobot-type',align:'center'},
|
{field: 'totalAmount', title: '账户总额', minWidth: 80,align:'center',totalRow: '{{= parseInt(d.totalAmount) }}'},
|
{field: 'avaAmount', title: '账户余额', minWidth: 80,align:'center',totalRow: '{{= parseInt(d.avaAmount) }}'},
|
{field: 'groupRedBagNum', title: '群红包数', minWidth: 80,align:'center'},
|
{field: 'redBagTotalAmount', title: '发红包总额', minWidth: 100,align:'center'},
|
{field: 'redBagAvaAmount', title: '未被领取总额', minWidth: 120,align:'center'},
|
{field: 'getRedbagAmount', title: '领取红包总额', minWidth: 120,align:'center'},
|
{field: 'boomToAmount', title: '中雷扣除', minWidth: 120,align:'center'},
|
{field: 'teamPerkAmount', title: '中雷补偿团队奖励', minWidth: 160,align:'center'},
|
{field: 'getBoom', title: '中雷', templet: '#switchGetBoom', minWidth: 80,align:'center'},
|
{field: 'createTime', title: '注册时间', minWidth: 160,align:'center'},
|
]]
|
});
|
}
|
|
// table.on('toolbar(userPerkTable)', function(obj){
|
// var data = obj.data,
|
// layEvent = obj.event;
|
//
|
// // if (layEvent === 'registerMember') {
|
// // febs.get(ctx + 'admin/chat/registerMember/', null, function () {
|
// // febs.alert.success('操作成功');
|
// // $query.click();
|
// // });
|
// // }
|
//
|
// if (layEvent === 'registerMember') {
|
// var checkData = table.checkStatus('userPerkTable').data;
|
// if (checkData.length <= 0) {
|
// febs.alert.warn('请选择需要的用户');
|
// return;
|
// }
|
// if (checkData.length > 1) {
|
// febs.alert.warn('请选择一个用户');
|
// return;
|
// }
|
// registerMember("添加会员", checkData[0].inviteId, 1);
|
// }
|
//
|
// if (layEvent === 'balance') {
|
// var checkData = table.checkStatus('userPerkTable').data;
|
// if (checkData.length <= 0) {
|
// febs.alert.warn('请选择需要的用户');
|
// return;
|
// }
|
// if (checkData.length > 1) {
|
// febs.alert.warn('请选择一个用户');
|
// return;
|
// }
|
// systemPay("修改余额", checkData[0].userId, 1);
|
// }
|
// });
|
|
function registerMember(text, inviteId, type) {
|
febs.modal.open(text, 'modules/chat/mallRegisterMember/'+ inviteId, {
|
btn: ['提交', '取消'],
|
yes: function (index, layero) {
|
$('#chat-register-member').find('#submit').trigger('click');
|
},
|
btn2: function () {
|
layer.closeAll();
|
}
|
});
|
}
|
|
function systemPay(text, userId, type) {
|
febs.modal.open(text, 'modules/chat/mallSystemPay/'+ userId, {
|
btn: ['提交', '取消'],
|
yes: function (index, layero) {
|
$('#chat-systemPay-update').find('#submit').trigger('click');
|
},
|
btn2: function () {
|
layer.closeAll();
|
}
|
});
|
}
|
|
form.on('switch(switchGetBoom)', function (data) {
|
if (data.elem.checked) {
|
openSwitchGetBoom(data.value);
|
} else {
|
closeSwitchGetBoom(data.value);
|
}
|
})
|
function openSwitchGetBoom(userId) {
|
febs.get(ctx + 'admin/chat/openSwitchGetBoom/' + userId, null, function () {
|
febs.alert.success('操作成功');
|
$reset.click();
|
});
|
}
|
function closeSwitchGetBoom(userId) {
|
febs.get(ctx + 'admin/chat/closeSwitchGetBoom/' + userId, null, function () {
|
febs.alert.success('操作成功');
|
$reset.click();
|
});
|
}
|
|
})
|
</script>
|