New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-red-bag-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="group-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="name" autocomplete="off" class="layui-input"> |
| | | </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="redBagTable" lay-data="{id: 'redBagTable'}"></table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!--1:成功 2:失败 3:进行中--> |
| | | <script type="text/html" id="status-type"> |
| | | {{# |
| | | var status = { |
| | | 1: {title: '-', color: ''}, |
| | | 2: {title: '成功', color: 'green'}, |
| | | 3: {title: '进行中', color: 'orange'}, |
| | | }[d.status]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{status.color}}">{{ status.title }}</span> |
| | | </script> |
| | | <script type="text/html" id="switchUseRobot"> |
| | | {{# if(d.useRobot === 1) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="是|否" checked lay-skin="switch" lay-filter="switchUseRobot"> |
| | | {{# } else { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="是|否" lay-skin="switch" lay-filter="switchUseRobot"> |
| | | {{# } }} |
| | | </script> |
| | | <script type="text/html" id="switchAutoSend"> |
| | | {{# if(d.autoSend === 1) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="是|否" checked lay-skin="switch" lay-filter="switchAutoSend"> |
| | | {{# } else { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="是|否" lay-skin="switch" lay-filter="switchAutoSend"> |
| | | {{# } }} |
| | | </script> |
| | | <script type="text/html" id="isMsgType"> |
| | | {{# if(d.msgType === 'SINGLE') { }} |
| | | <span>个人</span> |
| | | {{# } else { }} |
| | | <span>群聊</span> |
| | | {{# } }} |
| | | </script> |
| | | <style> |
| | | .layui-form-onswitch { |
| | | background-color: #5FB878 !important; |
| | | } |
| | | </style> |
| | | <!-- 表格操作栏 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-red-bag-list'), |
| | | $query = $view.find('#query'), |
| | | $reset = $view.find('#reset'), |
| | | $searchForm = $view.find('form'), |
| | | sortObject = {field: 'phone', type: null}, |
| | | tableIns; |
| | | |
| | | form.render(); |
| | | |
| | | // 表格初始化 |
| | | initTable(); |
| | | table.on('tool(redBagTable)', function (obj) { |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | if (layEvent === 'editGroup') { |
| | | febs.modal.open('编辑', 'modules/chat/groupInfo/' + data.id, { |
| | | btn: ['提交', '取消'], |
| | | // area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-group-edit').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | // 查询按钮 |
| | | $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: 1}, initSort: sortObject}); |
| | | }); |
| | | |
| | | // 获取查询参数 |
| | | function getQueryParams() { |
| | | return { |
| | | name: $searchForm.find('input[name="name"]').val().trim(), |
| | | }; |
| | | } |
| | | |
| | | function initTable() { |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'redBagTable', |
| | | url: ctx + 'admin/chat/redBagList', |
| | | cols: [[ |
| | | {field: 'id', title: '编号', minWidth: 100,align:'center'}, |
| | | {field: 'nickName', title: '发送方', minWidth: 100,align:'center'}, |
| | | {templet:"#isMsgType", title: '类型', minWidth: 100,align:'center'}, |
| | | {field: 'groupName', title: '接收方', minWidth: 200,align:'center'}, |
| | | {field: 'totalCnt', title: '红包总个数', minWidth: 100,align:'center'}, |
| | | {field: 'avaCnt', title: '剩余个数', minWidth: 100,align:'center'}, |
| | | {field: 'amount', title: '金额', minWidth: 100,align:'center'}, |
| | | {field: 'amountAva', title: '剩余金额', minWidth: 100,align:'center'}, |
| | | {field: 'boomNum', title: '雷', minWidth: 100,align:'center'}, |
| | | {field: 'createTime', title: '创建时间', minWidth: 180,align:'center'}, |
| | | // {title: '操作', |
| | | // templet: function (d) { |
| | | // return '<button class="layui-btn layui-btn-normal layui-btn-xs layui-btn-success" lay-event="editGroup" shiro:hasPermission="editGroup:info">编辑</button>' |
| | | // },minWidth: 150,align:'center'} |
| | | ]] |
| | | }); |
| | | } |
| | | form.on('switch(switchAutoSend)', function (data) { |
| | | if (data.elem.checked) { |
| | | openSwitchAutoSend(data.value); |
| | | } else { |
| | | closeSwitchAutoSend(data.value); |
| | | } |
| | | }) |
| | | function openSwitchAutoSend(id) { |
| | | febs.get(ctx + 'admin/chat/openSwitchAutoSend/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | function closeSwitchAutoSend(id) { |
| | | febs.get(ctx + 'admin/chat/closeSwitchAutoSend/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | form.on('switch(switchUseRobot)', function (data) { |
| | | if (data.elem.checked) { |
| | | openSwitchUseRobot(data.value); |
| | | } else { |
| | | closeSwitchUseRobot(data.value); |
| | | } |
| | | }) |
| | | function openSwitchUseRobot(id) { |
| | | febs.get(ctx + 'admin/chat/openSwitchUseRobot/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | function closeSwitchUseRobot(id) { |
| | | febs.get(ctx + 'admin/chat/closeSwitchUseRobot/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | </script> |