| | |
| | | page: true, |
| | | limit: 16, |
| | | limits: [16, 30, 50, 100, 200, 500], |
| | | toolbar: '#toolbar', |
| | | toolbar: '#orderToolbar', |
| | | height: 'full-100', |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | size: 'lg', |
| | | done: function(res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | |
| | | if (obj.event === 'edit') { // 修改 |
| | | showEditModel2(obj.data); |
| | | } else if (obj.event === 'del') { // 删除 |
| | | doDel2(obj); |
| | | var ids = []; |
| | | ids.push(obj.id) |
| | | doDelOrder({ids: ids}); |
| | | } |
| | | }); |
| | | |
| | |
| | | if (obj.event === 'add') { // 添加 |
| | | showEditModel2(); |
| | | } else if (obj.event === 'del') { // 删除 |
| | | var checkRows = table.checkStatus('dictDataTable'); |
| | | var checkRows = table.checkStatus('orderTable'); |
| | | if (checkRows.data.length === 0) { |
| | | layer.msg('请选择要删除的数据', {icon: 2}); |
| | | return; |
| | | } |
| | | var ids = checkRows.data.map(function (d) { |
| | | return d.dictDataId; |
| | | return d.id; |
| | | }); |
| | | doDel2({ids: ids}); |
| | | doDelOrder({ids: ids}); |
| | | } |
| | | }); |
| | | |
| | |
| | | }); |
| | | } |
| | | |
| | | /* 删除2 */ |
| | | function doDel2(obj) { |
| | | /* 删除订单 */ |
| | | function doDelOrder(obj) { |
| | | layer.confirm('确定要删除选中数据吗?', { |
| | | skin: 'layui-layer-admin', |
| | | shade: .1 |
| | | }, function (i) { |
| | | layer.close(i); |
| | | var loadIndex = layer.load(2); |
| | | $.get('../../json/ok.json', { |
| | | id: obj.data ? obj.data.dictDataId : '', |
| | | ids: obj.ids ? obj.ids.join(',') : '' |
| | | }, function (res) { |
| | | layer.close(loadIndex); |
| | | if (200 === res.code) { |
| | | layer.msg(res.msg, {icon: 1}); |
| | | insTb2.reload({page: {curr: 1}}); |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | $.ajax({ |
| | | url: baseUrl+"/orders/delete/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {ids: obj.ids}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | layer.msg(res.msg, {icon: 1}); |
| | | $(".layui-laypage-btn")[0].click(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }, 'json'); |
| | | }) |
| | | |
| | | }); |
| | | } |
| | | |