kefu/application/admin/view/users/index.html

231 lines
9.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>客服列表</title>
<link rel="shortcut icon" href="favicon.ico">
<link href="__CSS__/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<link href="__FONT__/font-awesome.min.css?v=4.4.0" rel="stylesheet">
<link href="__CSS__/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<link href="__CSS__/animate.min.css" rel="stylesheet">
<link href="__CSS__/style.min.css?v=4.1.0" rel="stylesheet">
<style>
#user_payment .bootstrap-table .table>tbody>tr>td {
padding-left: 20px !important;
}
#user_payment .th-inner {
padding-left: 20px !important;
}
</style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
<!-- Panel Other -->
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>客服列表</h5>
</div>
<div class="ibox-content">
<!--搜索框开始-->
<form id='commentForm' role="form" method="post" class="form-inline pull-right">
<div class="content clearfix m-b">
<div class="form-group">
<label>客服名称:</label>
<input type="text" class="form-control" id="username" name="user_name">
</div>
<div class="form-group">
<button class="btn btn-primary" type="button" style="margin-top:5px" id="search"><strong>
</strong>
</button>
</div>
</div>
</form>
<!--搜索框结束-->
<div class="example-wrap">
<div class="example">
<table id="cusTable">
<thead>
<th data-field="id">客服ID</th>
<th data-field="user_name">客服名称</th>
<th data-field="user_avatar">客服头像</th>
<th data-field="recharge_amount">总充值金额(元)</th>
<th data-field="remaining_amount">剩余充值额度(元)</th>
<th data-field="show_payment">使用中支付账号</th>
<th data-field="kf_type_name">客服类型</th>
<th data-field="group">所属平台</th>
<th data-field="organize_name">所属分组</th>
<th data-field="status">客服状态</th>
<th data-field="user_log">客服操作记录</th>
<!--<th data-field="online">是否在线</th>-->
<th data-field="operate">操作</th>
</thead>
</table>
</div>
</div>
<!-- End Example Pagination -->
</div>
</div>
</div>
<div class="layui-row" id="user_payment" style="display:none;padding-left:15px;padding-right:15px;">
<h3 style="margin:15px 0px;padding-left:20px;">使用中支付账号</h3>
<table id="show_user_payment" class="custables">
<thead>
<th data-field="type_name" style="padding-left:10px;">支付类型</th>
<th data-field="account_num" style="padding-left:10px;">支付账号</th>
</thead>
</table>
</div>
<!-- End Panel Other -->
<script src="__JS__/jquery.min.js?v=2.1.4"></script>
<script src="__JS__/bootstrap.min.js?v=3.3.6"></script>
<script src="__JS__/content.min.js?v=1.0.0"></script>
<script src="__JS__/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="__JS__/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="__JS__/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="__JS__/plugins/layer/layer.min.js"></script>
<script src="__JS__/layui/layui.js"></script>
<script type="text/javascript">
function initTable() {
//先销毁表格
$('#cusTable').bootstrapTable('destroy');
//初始化表格,动态从服务器加载数据
$("#cusTable").bootstrapTable({
method: "get", //使用get请求到服务器获取数据
url: "{:url('users/index')}", //获取数据的地址
striped: true, //表格显示条纹
pagination: true, //启动分页
pageSize: 10, //每页显示的记录数
pageNumber: 1, //当前第几页
pageList: [5, 10, 15, 20, 25], //记录数可选列表
sidePagination: "server", //表示服务端请求
paginationFirstText: "首页",
paginationPreText: "上一页",
paginationNextText: "下一页",
paginationLastText: "尾页",
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageNumber: params.pageNumber,
pageSize: params.pageSize,
searchText: $('#username').val()
};
return param;
},
onLoadSuccess: function (res) { //加载成功时执行
if (111 == res.code) {
window.location.reload();
}
// layer.msg("加载成功", {time : 1000});
},
onLoadError: function () { //加载失败时执行
layer.msg("加载数据失败");
}
});
}
$(document).ready(function () {
//调用函数,初始化表格
initTable();
//当点击查询按钮的时候执行
$("#search").bind("click", initTable);
});
function userDel(id) {
layer.confirm('确认删除此客服?', { icon: 3, title: '提示' }, function (index) {
//do something
$.getJSON("{:url('users/delUser')}", { 'id': id }, function (res) {
if (1 == res.code) {
layer.msg(res.msg, { time: 1000 }, function () {
window.location.reload();
});
} else if (111 == res.code) {
window.location.reload();
} else {
layer.msg(res.msg, { time: 1000 });
}
});
layer.close(index);
})
}
function chageStatus(id, type) {
var hint = type == 1 ? '启用' : '禁用';
layer.confirm(`确认${hint}此客服?`, { icon: 3, title: '提示' }, function (index) {
//do something
$.getJSON("{:url('users/chageStatus')}", { 'id': id, type: type }, function (res) {
if (1 == res.code) {
layer.msg(res.msg, { time: 1000 }, function () {
window.location.reload();
});
} else {
layer.msg(res.msg, { time: 1000 });
}
});
layer.close(index);
})
}
function getPayment(paymentId) {
layer.open({
title: false,
type: 1,
content: $("#user_payment"),
area: ['500px', '400px']
});
var uri = "{:url('users/getPayment')}";
initTablePayment(uri, paymentId);
}
//初始化表格来获取对应客服和对应用户的历史会话记录
function initTablePayment(url, paymentId) {
//先销毁表格
$('#show_user_payment').bootstrapTable('destroy');
$("#show_user_payment").bootstrapTable({
title: '客服使用中的支付账号',
method: "get", //使用get请求到服务器获取数据
url: url, //获取数据的地址
striped: true, //表格显示条纹
pagination: false, //启动分页
sidePagination: "server", //表示服务端请求
queryParamsType: "undefined",
showColumns: false,
uniqueId: "id", //每一行的唯一标识,一般为主键列
queryParams: function queryParams(params) {
//设置查询参数
var param = {
id: paymentId,
};
return param;
},
onLoadSuccess: function (res) { //加载成功时执行
// layer.msg("加载成功", {time : 1000});
},
onLoadError: function () { //加载失败时执行
layer.msg("加载数据失败");
}
});
}
// 客服操作记录列表
function getUserLog(id) {
layer.open({
type: 2,
// area: ['auto', '850px'],
area: ['100%', '100%'],
content: "/admin/Users/user_log_list/?id=" + id,
});
}
</script>
</body>
</html>