|  |  |  | 
|---|
|  |  |  | <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"> | 
|---|
|  |  |  | 
|---|
|  |  |  | <input type="checkbox" value={{d.userId}} lay-text="是|否" lay-skin="switch" lay-filter="switchIsRobot"> | 
|---|
|  |  |  | {{# } }} | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | <script type="text/html" id="switchModelType"> | 
|---|
|  |  |  | {{# if(d.modelType === 1) { }} | 
|---|
|  |  |  | <input type="checkbox" value={{d.userId}} lay-text="简单模式|困难模式" checked lay-skin="switch" lay-filter="switchModelType"> | 
|---|
|  |  |  | {{# } else { }} | 
|---|
|  |  |  | <input type="checkbox" value={{d.userId}} lay-text="简单模式|困难模式" lay-skin="switch" lay-filter="switchModelType"> | 
|---|
|  |  |  | {{# } }} | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | <script type="text/html" id="switchCreateGroup"> | 
|---|
|  |  |  | {{# if(d.createGroup === 1) { }} | 
|---|
|  |  |  | <input type="checkbox" value={{d.userId}} lay-text="是|否" checked lay-skin="switch" lay-filter="switchCreateGroup"> | 
|---|
|  |  |  | {{# } else { }} | 
|---|
|  |  |  | <input type="checkbox" value={{d.userId}} lay-text="是|否" lay-skin="switch" lay-filter="switchCreateGroup"> | 
|---|
|  |  |  | {{# } }} | 
|---|
|  |  |  | </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="registMember">添加会员</button>--> | 
|---|
|  |  |  | <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> | 
|---|
|  |  |  | 
|---|
|  |  |  | tableIns; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | form.render(); | 
|---|
|  |  |  | let currPageUser = 1;//首先默认值为1,防止出错 | 
|---|
|  |  |  | //获取当前页 | 
|---|
|  |  |  | currPageUser = $view.find(".layui-laypage-em").next().html(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 表格初始化 | 
|---|
|  |  |  | initTable(); | 
|---|
|  |  |  | 
|---|
|  |  |  | $reset.on('click', function () { | 
|---|
|  |  |  | $searchForm[0].reset(); | 
|---|
|  |  |  | sortObject.type = 'null'; | 
|---|
|  |  |  | tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); | 
|---|
|  |  |  | 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(), | 
|---|
|  |  |  | status: $searchForm.find("select[name='status']").val() | 
|---|
|  |  |  | 
|---|
|  |  |  | totalRow: true ,// 开启合计行 | 
|---|
|  |  |  | cols: [[ | 
|---|
|  |  |  | {type: 'checkbox'}, | 
|---|
|  |  |  | // {field: 'userId', title: '标识', minWidth: 150,align:'left'}, | 
|---|
|  |  |  | {field: 'nickName', title: '昵称', minWidth: 100,align:'left', totalRowText: '合计:',align:'center'}, | 
|---|
|  |  |  | {field: 'inviteId', title: '邀请码', minWidth: 100,align:'left',align:'center'}, | 
|---|
|  |  |  | {field: 'phone', title: '注册号码', minWidth: 150,align:'left',align:'center'}, | 
|---|
|  |  |  | {field: 'totalAmount', title: '账户总额', minWidth: 80,align:'left',totalRow: '{{= parseInt(d.totalAmount) }}',align:'center'}, | 
|---|
|  |  |  | {field: 'avaAmount', title: '账户余额', minWidth: 80,align:'left',totalRow: '{{= parseInt(d.avaAmount) }}',align:'center'}, | 
|---|
|  |  |  | {field: 'userId', title: '标识', minWidth: 40,align:'center', totalRowText: '合计:'}, | 
|---|
|  |  |  | {field: 'phone', title: '注册号码', minWidth: 150,align:'center'}, | 
|---|
|  |  |  | {field: 'nickName', title: '昵称', minWidth: 100}, | 
|---|
|  |  |  | {field: 'inviteId', title: '邀请码', minWidth: 100,align:'center'}, | 
|---|
|  |  |  | {field: 'totalAmount', title: '账户总额', minWidth: 80,totalRow: '{{= parseInt(d.totalAmount) }}',align:'center'}, | 
|---|
|  |  |  | {field: 'avaAmount', title: '账户余额', minWidth: 80,totalRow: '{{= parseInt(d.avaAmount) }}',align:'center'}, | 
|---|
|  |  |  | {field: 'status', title: '账号状态', templet: '#switchStatus', minWidth: 80,align:'center'}, | 
|---|
|  |  |  | {field: 'isRobot', title: '机器人', templet: '#switchIsRobot', minWidth: 80,align:'center'}, | 
|---|
|  |  |  | {field: 'modelType', title: '模式', templet: '#switchModelType', minWidth: 80,align:'center'}, | 
|---|
|  |  |  | {field: 'createGroup', title: '允许建群', templet: '#switchCreateGroup', minWidth: 80,align:'center'}, | 
|---|
|  |  |  | {field: 'createTime', title: '注册时间', minWidth: 180,align:'center'}, | 
|---|
|  |  |  | ]] | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | 
|---|
|  |  |  | var data = obj.data, | 
|---|
|  |  |  | layEvent = obj.event; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // if (layEvent === 'registMember') { | 
|---|
|  |  |  | //     febs.modal.open( '添加会员', 'modules/mallMember/addMember', { | 
|---|
|  |  |  | //         btn: ['提交', '取消'], | 
|---|
|  |  |  | //         yes: function (index, layero) { | 
|---|
|  |  |  | //             $('#member-add').find('#submit').trigger('click'); | 
|---|
|  |  |  | //         }, | 
|---|
|  |  |  | //         btn2: function () { | 
|---|
|  |  |  | //             layer.closeAll(); | 
|---|
|  |  |  | //         } | 
|---|
|  |  |  | // if (layEvent === 'registerMember') { | 
|---|
|  |  |  | //     febs.get(ctx + 'admin/chat/registerMember/', null, function () { | 
|---|
|  |  |  | //         febs.alert.success('操作成功'); | 
|---|
|  |  |  | //         $query.click(); | 
|---|
|  |  |  | //     }); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //     return; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var checkData = table.checkStatus('userChatTable').data; | 
|---|
|  |  |  | if (checkData.length <= 0) { | 
|---|
|  |  |  | febs.alert.warn('请选择需要的用户'); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | if (layEvent === 'registerMember') { | 
|---|
|  |  |  | var checkData = table.checkStatus('userChatTable').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('userChatTable').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, { | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | form.on('switch(switchCreateGroup)', function (data) { | 
|---|
|  |  |  | if (data.elem.checked) { | 
|---|
|  |  |  | openCreateGroup(data.value); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | closeCreateGroup(data.value); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | function openCreateGroup(userId) { | 
|---|
|  |  |  | febs.get(ctx + 'admin/chat/openCreateGroup/' + userId, null, function () { | 
|---|
|  |  |  | febs.alert.success('操作成功'); | 
|---|
|  |  |  | $reset.click(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | function closeCreateGroup(userId) { | 
|---|
|  |  |  | febs.get(ctx + 'admin/chat/closeCreateGroup/' + userId, null, function () { | 
|---|
|  |  |  | febs.alert.success('操作成功'); | 
|---|
|  |  |  | $reset.click(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | form.on('switch(switchModelType)', function (data) { | 
|---|
|  |  |  | if (data.elem.checked) { | 
|---|
|  |  |  | openModelType(data.value); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | closeModelType(data.value); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | function openModelType(userId) { | 
|---|
|  |  |  | febs.get(ctx + 'admin/chat/openModelType/' + userId, null, function () { | 
|---|
|  |  |  | febs.alert.success('操作成功'); | 
|---|
|  |  |  | $reset.click(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | function closeModelType(userId) { | 
|---|
|  |  |  | febs.get(ctx + 'admin/chat/closeModelType/' + userId, null, function () { | 
|---|
|  |  |  | febs.alert.success('操作成功'); | 
|---|
|  |  |  | $reset.click(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | form.on('switch(switchStatus)', function (data) { | 
|---|
|  |  |  | if (data.elem.checked) { | 
|---|
|  |  |  | openAccount(data.value); | 
|---|
|  |  |  | 
|---|
|  |  |  | function openAccount(userId) { | 
|---|
|  |  |  | febs.get(ctx + 'admin/chat/openAccount/' + userId, null, function () { | 
|---|
|  |  |  | febs.alert.success('操作成功'); | 
|---|
|  |  |  | $query.click(); | 
|---|
|  |  |  | $reset.click(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | function closeAccount(userId) { | 
|---|
|  |  |  | febs.get(ctx + 'admin/chat/closeAccount/' + userId, null, function () { | 
|---|
|  |  |  | febs.alert.success('操作成功'); | 
|---|
|  |  |  | $query.click(); | 
|---|
|  |  |  | $reset.click(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | function openSwitchIsRobot(userId) { | 
|---|
|  |  |  | febs.get(ctx + 'admin/chat/openSwitchIsRobot/' + userId, null, function () { | 
|---|
|  |  |  | febs.alert.success('操作成功'); | 
|---|
|  |  |  | $query.click(); | 
|---|
|  |  |  | $reset.click(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | function closeSwitchIsRobot(userId) { | 
|---|
|  |  |  | febs.get(ctx + 'admin/chat/closeSwitchIsRobot/' + userId, null, function () { | 
|---|
|  |  |  | febs.alert.success('操作成功'); | 
|---|
|  |  |  | $query.click(); | 
|---|
|  |  |  | $reset.click(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|