kefu/application/service/view/index/son/changeWorker.html

170 lines
5.1 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>交接工作</title>
<link href="__CDN__/static/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<link href="/static/admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
<link href="__CDN__/static/admin/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<link href="__CDN__/static/admin/css/animate.min.css" rel="stylesheet">
<link href="__CDN__/static/admin/css/style.min.css?v=4.1.0" rel="stylesheet">
<link rel="stylesheet" href="/static/admin/js/layui/css/layui.css" media="all">
</head>
<body>
<div class="layui-collapse" lay-accordion>
<!-- <div style="text-align: center;
color: #a2a1a1;
font-size: 10px;
margin: 5px auto;">* 重新选用后请刷新下聊天页面</div> -->
<div>
<button type="button" class="layui-btn" style="
margin: 10px 0 0 10px;
" onclick="add()">添加工作者</button>
</div>
<table class="layui-table">
<colgroup>
<col>
<col>
<col>
<col>
<col>
<!-- <col width="80"> -->
</colgroup>
<thead>
<tr>
<th>工作者</th>
<th>上班时间</th>
<th>下班时间</th>
<th>充值金额</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{foreach name="list" item="vo"}
<tr>
<td>{$vo['name']}</td>
<td>{$vo['start_date']}</td>
<td>{$vo['end_date']}</td>
<td>{$vo['money']}</td>
<td>
{if condition="$vo.is_use eq false"}
<button class="layui-btn layui-btn-radius" style="
height: 22px;
line-height: 22px;
text-align: center;
font-size: 12px;
">工作中</button>
{else /}
<button class="layui-btn layui-btn-radius layui-btn layui-btn-primary" style="
height: 22px;
line-height: 22px;
text-align: center;
font-size: 12px;
" onclick="work({$vo['id']}, 1, '{$vo['name']}')">上班</button>
{/if}
<button class="layui-btn layui-btn-radius layui-btn layui-btn-primary" style="
height: 22px;
line-height: 22px;
text-align: center;
font-size: 12px;
" onclick="work({$vo['id']}, 2)">下班</button>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
<script src="__CDN__/static/admin/js/layui/layui.js"></script>
<script src="__CDN__/static/admin/js/jquery.min.js?v=2.1.4"></script>
<script>
layui.use('element', function () {
var element = layui.element;
});
layui.use('form', function () {
var form = layui.form;
form.render();
});
/**
* 选用账号
*/
function select(id, name = "") {
var msg = '交接';
layer.confirm(`确定${msg}吗?`, function () {
var layerMsg = layer.load(1, {
icon: 0,
shade: [0.5, 'black']
});
$.post('{:url("index/changeWorker")}', { id: id }, function (res) {
// console.log(res);
layer.close(layerMsg);
if (1 == res.code) {
parent.$('#worker_name').val(name);
layer.msg(`${msg}成功`, { time: 1000 }, function () {
window.history.go(0);
});
// parent.location.reload(); // 父页面刷新
} else {
layer.msg(res.msg);
}
});
});
}
/**
* 添加
*/
function add() {
layer.prompt(function (value, index, elem) {
if (!value) {
layer.msg('请输入工作者姓名');
return false;
}
$.post('{:url("index/addWorker")}', { name: value }, function (res) {
console.log(res);
if (1 == res.code) {
// parent.select_pay_type = true;
// layer.msg(`${msg}成功`, { time: 1000 }, function () {
window.history.go(0);
// });
// parent.location.reload(); // 父页面刷新
} else {
layer.msg(res.msg);
}
});
layer.close(index);
});
}
/**
* 工作
*/
function work(id, type, name = "") {
var msg = type == 1 ? '上班' : '下班';
layer.confirm(`确定${msg}吗?`, function () {
$.post('{:url("index/changeWorkStatus")}', { id: id, type: type }, function (res) {
// console.log(res);
if (1 == res.code) {
if (msg == '下班') {
parent.$('#worker_name').val('');
} else {
parent.$('#worker_name').val(name);
}
layer.msg(`${msg}成功`, { time: 1000 }, function () {
window.history.go(0);
});
// parent.location.reload(); // 父页面刷新
} else {
layer.msg(res.msg);
}
});
});
}
</script>
</body>
</html>