dongfeng-pay/legend/views/area-list.html

137 lines
5.4 KiB
Go
Raw Normal View History

2021-04-27 15:33:49 +08:00
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
<meta charset="UTF-8">
<title>充值商户后台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
2021-05-19 13:46:49 +08:00
{{/* <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />*/}}
2021-04-27 15:33:49 +08:00
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/x-admin/css/font.css">
<link rel="stylesheet" href="../static/x-admin/css/xadmin.css">
<!-- <link rel="stylesheet" href="./css/theme5.css"> -->
<script src="../static/x-admin/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="../static/x-admin/js/xadmin.js"></script>
<script type="text/javascript" src="../static/js/jquery-3.5.1.min.js"></script>
<!-- 让IE8/9支持媒体查询从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
// 是否开启刷新记忆tab功能
// var is_remember = false;
</script>
</head>
<body>
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-card-body">
<table id="demo" lay-filter="test"></table>
</div>
</div>
<script type="text/html" id="toolbarHead">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm" lay-event="create-area"><i class="layui-icon layui-icon-add-1"></i>创建分区</button>
2021-05-19 13:46:49 +08:00
<button class="layui-btn layui-btn-sm" lay-event="flush" onclick="flush()"><i class="layui-icon layui-icon-refresh-3"></i></button>
2021-04-27 15:33:49 +08:00
</div>
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<div class="layui-btn layui-btn-normal" lay-event="imitate-recharge-url">模拟充值</div>
<div class="layui-btn layui-btn-sm" lay-event="edit-area"><i class="layui-icon layui-icon-edit"></i> 编辑</div>
<div class="layui-btn layui-btn-danger" lay-event="delete-area"><i class="layui-icon layui-icon-delete"></i>删除</div>
</div>
</script>
<script>
2021-05-19 13:46:49 +08:00
2021-04-27 15:33:49 +08:00
layui.use('table', function () {
let table = layui.table;
table.render({
elem: "#demo"
,height: 500
2021-05-19 13:46:49 +08:00
,url: '/area/list' //数据接口
2021-04-27 15:33:49 +08:00
,page: true //开启分页
2021-05-19 13:46:49 +08:00
,limits: [10, 20, 30, 50, 100]
2021-04-27 15:33:49 +08:00
,cols: [[ //表头
2021-05-19 13:46:49 +08:00
{field: 'Id', title: 'ID', sort: true, fixed: 'left'}
,{field: 'AreaName', title: '分区名称'}
,{field: 'Uid', title: "分区id"}
,{field: "GroupName", title: "分组名称"}
,{field: 'TemplateName', title: '使用模板', sort: true}
,{field: "NotifyUrl", title: "通知地址"}
,{field: "AttachParams", title:"附加参数"}
,{field: 'CreateTime', title: '创建时间', sort:true}
,{fixed: 'right', title: "操作", width:260, align:'center', toolbar: '#toolbarDemo'}
2021-04-27 15:33:49 +08:00
]]
,toolbar: "#toolbarHead"
});
// 监听行工具事件
table.on('tool(test)', function (data) {
let event = data.event;
if ("imitate-recharge-url" === event) {
2021-05-19 13:46:49 +08:00
// location.href = "https://www.baidu.com";
2021-04-27 15:33:49 +08:00
} else if ("edit-area" === event) {
2021-05-19 13:46:49 +08:00
location.href = "/areaEdit.html" + "?uid=" + data.data.Uid;
2021-04-27 15:33:49 +08:00
} else if ("delete-area" === event) {
layer.confirm("是否要删除该行?", {
btn:["YES", "NO"]
2021-05-19 13:46:49 +08:00
},function (index) {
console.log(data.data)
$.ajax({
url: "/delete/area",
data: {
"uid":data.data.Uid
},
success: function (res) {
if (res.Code !== 0) {
layer.alert("删除分组失败")
} else {
data.del()
table.reload('demo',{
url: "/area/list",
where: {
"page": 1
}
})
}
layer.close(index)
}
})
2021-04-27 15:33:49 +08:00
}, function (index) {
layer.close(index);
return false;
})
}
})
// 监听头工具栏事件
table.on('toolbar(test)', function (data) {
let event = data.event;
if ("create-area" === event) {
location.href = "/areaAddOrEdit.html"
2021-05-19 13:46:49 +08:00
} else if ("flush" === event) {
table.reload('demo', {
url: "/area/list",
where : {
"page":1
}
})
2021-04-27 15:33:49 +08:00
}
})
})
</script>
</div>
</body>
</html>