|  |  |  | 
|---|
|  |  |  | <div class="layui-col-md10"> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <label class="layui-form-label layui-form-label-sm">名称</label> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <input type="text" placeholder="名称" name="name" autocomplete="off" class="layui-input"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </form> | 
|---|
|  |  |  | <table lay-filter="userTable" lay-data="{id: 'userTable'}"></table> | 
|---|
|  |  |  | <style type="text/css"> | 
|---|
|  |  |  | .layui-table-cell{ | 
|---|
|  |  |  | text-align:center; | 
|---|
|  |  |  | height: auto; | 
|---|
|  |  |  | white-space: normal; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .layui-table img{ | 
|---|
|  |  |  | max-width:100px | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ::-webkit-scrollbar { | 
|---|
|  |  |  | height: 20px !important; | 
|---|
|  |  |  | background-color: #f4f4f4; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </style> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | 
|---|
|  |  |  | table.on('tool(userTable)', function (obj) { | 
|---|
|  |  |  | var data = obj.data, | 
|---|
|  |  |  | layEvent = obj.event; | 
|---|
|  |  |  | if (layEvent === 'close') { | 
|---|
|  |  |  | febs.modal.confirm('禁用', '确认禁用该账号?', function () { | 
|---|
|  |  |  | closeAccount(data.id); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (layEvent === 'open') { | 
|---|
|  |  |  | febs.modal.confirm('开启', '确认开启该账号?', function () { | 
|---|
|  |  |  | openAccount(data.id); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (layEvent === 'see') { | 
|---|
|  |  |  | febs.modal.open('编辑', 'modules/product/categoryUpdate/' + data.id, { | 
|---|
|  |  |  | btn: ['提交', '取消'], | 
|---|
|  |  |  | yes: function (index, layero) { | 
|---|
|  |  |  | $('#user-update').find('#submit').trigger('click'); | 
|---|
|  |  |  | $('#categary-update').find('#submit').trigger('click'); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | btn2: function () { | 
|---|
|  |  |  | layer.closeAll(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (layEvent === 'delCategary') { | 
|---|
|  |  |  | febs.modal.confirm('删除', '确认删除?', function () { | 
|---|
|  |  |  | delCategary(data.id); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (layEvent === 'seeImges') { | 
|---|
|  |  |  | var t = $view.find('#seeImges'+data.id+''); | 
|---|
|  |  |  | //页面层 | 
|---|
|  |  |  | layer.open({ | 
|---|
|  |  |  | type: 1, | 
|---|
|  |  |  | title: "图片", | 
|---|
|  |  |  | skin: 'layui-layer-rim', //加上边框 | 
|---|
|  |  |  | area: ['80%', '80%'], //宽高 | 
|---|
|  |  |  | shadeClose: true, //开启遮罩关闭 | 
|---|
|  |  |  | end: function (index, layero) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | content: '<div style="text-align:center"><img src="' + $(t).attr('src') + '" /></div>' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | function closeAccount(id) { | 
|---|
|  |  |  | febs.get(ctx + 'admin/mallMember/closeAccount/' + id, null, function () { | 
|---|
|  |  |  | febs.alert.success('禁用成功'); | 
|---|
|  |  |  | $query.click(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | function openAccount(id) { | 
|---|
|  |  |  | febs.get(ctx + 'admin/mallMember/openAccount/' + id, null, function () { | 
|---|
|  |  |  | febs.alert.success('开启成功'); | 
|---|
|  |  |  | $query.click(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function delCategary(id) { | 
|---|
|  |  |  | febs.get(ctx + 'admin/goodsCategory/delCategary/' + id, null, function () { | 
|---|
|  |  |  | febs.alert.success('操作成功'); | 
|---|
|  |  |  | $query.click(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 查询按钮 | 
|---|
|  |  |  | $query.on('click', function () { | 
|---|
|  |  |  | 
|---|
|  |  |  | febs.modal.open('新增', 'modules/product/categoryAdd/', { | 
|---|
|  |  |  | btn: ['提交', '取消'], | 
|---|
|  |  |  | yes: function (index, layero) { | 
|---|
|  |  |  | $('#user-add').find('#submit').trigger('click'); | 
|---|
|  |  |  | $('#categary-add').find('#submit').trigger('click'); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | btn2: function () { | 
|---|
|  |  |  | layer.closeAll(); | 
|---|
|  |  |  | 
|---|
|  |  |  | cols: [[ | 
|---|
|  |  |  | {field: 'name', title: '名称', minWidth: 150,align:'left'}, | 
|---|
|  |  |  | {field: 'parentName', title: '父级名称', minWidth: 150,align:'left'}, | 
|---|
|  |  |  | {field: 'image', title: '图片', | 
|---|
|  |  |  | templet: function (d) { | 
|---|
|  |  |  | return '<a lay-event="seeImges"><img id="seeImges'+d.id+'" src="'+d.image+'" alt=""></a>'; | 
|---|
|  |  |  | }, minWidth: 100,align:'center'}, | 
|---|
|  |  |  | {field: 'indexNum', title: '排序', minWidth: 150,align:'left'}, | 
|---|
|  |  |  | {title: '操作', | 
|---|
|  |  |  | templet: function (d) { | 
|---|
|  |  |  | return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="see" shiro:hasPermission="user:update">编辑</button>' | 
|---|
|  |  |  | +'<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="delCategary" shiro:hasPermission="user:update">删除</button>' | 
|---|
|  |  |  | },minWidth: 300,align:'center'} | 
|---|
|  |  |  | ]] | 
|---|
|  |  |  | }); | 
|---|