1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
| $(function () { $('#OplogData').layTable({ even: true, height: 'full', sort: {field: 'id', type: 'desc'}, cols: [[ // 字段渲染板块 {checkbox: true}, {field: 'id', title: 'ID', width: 60, sort: true, align: 'center'}, {field: 'uid', title: 'X-UID', minWidth: 60, sort: true, align: 'center'}, {field: 'nickname', title: '昵称', minWidth: 80, sort: true, align: 'center'}, {field: 'phone', title: '手机号码', minWidth: 50, templet: '#ViewPhoneTpl', event: "viewPhone"}, {field: 'channel', title: '渠道', minWidth: 80}, {field: 'origin_channel', title: '归因渠道', minWidth: 30}, {field: 'system', title: '操作系统', minWidth: 60}, {field: 'versionname', title: 'APP版本', minWidth: 50}, {field: 'versioncode', title: 'APP版本值', minWidth: 50}, {field: 'is_vip', title: 'VIP状态', minWidth: 40, align: 'center'}, {field: 'vip_type', title: 'VIP类型', minWidth: 40, align: 'center'}, {field: 'created_at', title: '添加时间', minWidth: 160, align: 'center'}, {field: 'expired_at', title: 'vip到期时间', minWidth: 160, align: 'center'}, {field: 'state', title: '状态', minWidth: 110, align: 'center', templet: '#StatusSwitchTpl'}, {toolbar: '#toolbar', title: '操作面板', minWidth: 250, align: 'center'}, ]], // 对某些字段的处理 判断、css属性 done: function(res, curr, count) { $("[data-field='is_vip']").children().each(function() { if ($(this).text() == 1) { $(this).text("是").css('color', 'red'); } if ($(this).text() == 0) { $(this).text("否").css('color', '#ccc'); } }); $("[data-field='vip_type']").children().each(function (){ if ($(this).text() == 1) { $(this).text("天会员").css('color', '#00FF00'); } if ($(this).text() == 2) { $(this).text("月会员").css('color', '#008000'); } if ($(this).text() == 3) { $(this).text("季会员").css('color', '#FFFF00'); } if ($(this).text() == 4) { $(this).text("年会员").css('color', '#FF8C00'); } if ($(this).text() == 6) { $(this).text("临时会员").css('color', '#20B2AA'); } if ($(this).text() == 10) { $(this).text("永久会员").css('color', '#DC143C'); } if ($(this).text() == 0) { $(this).text("暂无").css('color', '#ccc'); } }); } }); layui.table.on('tool(table)', function (result) { let event = result.event; let row = result.data; if (event === "viewPhone") { layer.confirm('确定要查看该用户手机号码吗?', { btn: ['确定', '取消'] //按钮 }, function () { $.form.load("{:url('viewphone')}", {id: row.id}, 'post', function (ret) { if (ret.code < 1) { $.msg.error(ret.info, 3, function () { layer.alert(ret.info, {icon: 1}); }); } else { result.update({ 'phone': ret.data }); } layer.closeAll(); return false; }, false); }, function () { layer.closeAll(); }); } })
layui.form.on('switch(StatusSwitch)', function (obj) { $.form.load("{:url('state')}", { id: obj.value, state: obj.elem.checked > 0 ? 1 : 2 }, 'post', function (ret) { if (ret.code < 1) $.msg.error(ret.info, 3, function () { $('#RoleData').trigger('reload'); }); return false; }, false); }); });
|