Files
kami_boss/views/agent_to_merchant.html
danial c3906e940e refactor(account): 重构账户管理页面布局和样式
-精简HTML结构,优化`account.html`,`apple-card/account.html`,和`t-mall-game/account.html`中iframe的布局。
- 调整CSS样式,以增强用户界面的一致性和可读性。
- 优化`account_history.html`中的表格和搜索栏的样式与对齐。

fix(controller): 修正新增控制器参数顺序

- 修正`addController.go`中的参数顺序,确保交易类型正确传递给服务层。
- 更新数据库插入操作,确保UUID正确分配给新记录,防止SQL错误。
2024-09-04 09:54:18 +08:00

208 lines
6.5 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>管理后台</title>
<link href="../static/css/basic.css" rel="stylesheet" type="text/css">
<link href="../static/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="../static/lib/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet"
type="text/css">
<script src="../static/js/filter.js"></script>
<script src="../static/js/jquery.min.js"></script>
<script src="../static/lib/bootstrap/js/bootstrap.min.js"></script>
<script src="../static/lib/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script src="../static/lib/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="../static/js/basic.js"></script>
<style>
.search label {
font-weight: normal;
}
#select-agent-name, #select-merchant-name {
margin-right: 20px;
}
.search label select {
height: 30px;
line-height: 30px;
}
</style>
</head>
<body>
<div class="search">
<label for="">
代理名称:
<select id="select-agent-name" name=""></select>
</label>
<label for="">
商户名称:
<select id="select-merchant-name" name=""></select>
</label>
<input class="btn btn-primary" onclick="search(getValues());" type="button" value="开始">
</div>
<div class="menu-table">
<table>
<thead class="thead-dark">
<tr>
<th>序列号</th>
<th>代理名称</th>
<th>代理uid</th>
<th>代理商户名</th>
<th>代理商户uid</th>
<th>操作</th>
</tr>
</thead>
<tbody id="table-body">
</tbody>
</table>
</div>
<!-- 分页插件 -->
<div class="cut_page">
<li>
每页显示
<select id="display_count">
<option value="4">4</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
</li>
<li class="current_total_page"><span class="current_page">0</span>/<span class="total_page">0</span></li>
<li class="pre_page">上一页</li>
<li class="next_page">下一页</li>
<li class="jump_page">跳转 <input name="jump_page" type="text" value="">
<button class="btn btn-default" type="button">Go</button>
</li>
</div>
<script>
//当每页显示数更改后,执行的操作
$("#display_count").change(function () {
let dataJSON = getValues();
search(dataJSON);
});
//点击上一页的按钮
$(".pre_page").click(function () {
let dataJSON = getValues();
if (dataJSON["currentPage"] == 1) {
return;
}
dataJSON["currentPage"] = parseInt(dataJSON["currentPage"]) - 1;
search(dataJSON);
});
//点击下一页的按钮时
$(".next_page").click(function () {
let dataJSON = getValues();
if (dataJSON["currentPage"] == dataJSON["totalPage"]) {
return;
}
dataJSON["currentPage"] = parseInt(dataJSON["currentPage"]) + 1;
search(dataJSON);
});
//点击跳转那一页的按钮
$(".jump_page button").click(function () {
let dataJSON = getValues();
if (dataJSON["jumpPage"].length <= 0) {
return;
}
search(dataJSON);
});
function getValues() {
let displayCount = $("#display_count").val();
let currentPage = $(".current_page").html();
let totalPage = $(".total_page").html();
let jumpPage = $(".jump_page input").val();
let agentUid = $("#select-agent-name").val();
let merchantUid = $("#select-merchant-name").val();
return {
"displayCount": displayCount,
"currentPage": currentPage,
"totalPage": totalPage,
"jumpPage": jumpPage,
"agentUid": agentUid,
"merchantUid": merchantUid
};
}
function clearCutValues(res) {
$(".current_page").html(res.CurrentPage);
$(".total_page").html(res.TotalPage);
$("#display_count option").each(function () {
if ($(this).text() == res.DisplayCount) {
$(this).attr('selected', true);
}
});
$(".jump_page input").val("");
}
function randAgentToMerchant(res) {
clearCutValues(res);
let str = "";
for (let i = 0; i < res.MerchantList.length; i++) {
let v = res.MerchantList[i];
let tmp = "<tr>" + "<th>" + (res.StartIndex + i + 1) + "</th>" +
"<th>" + v.BelongAgentName + "</th>" + "<th>" + v.BelongAgentUid + "</th>" + "<th>" + v.MerchantName + "</th>" + "<th>" + v.MerchantUid + "</th>";
tmp = tmp + "<th>" + '<div class="btn-group" role="group" aria-label="...">' +
'<button type="button" value="' + v.MerchantUid + '" class="btn btn-default" onclick="deleteRelation(this.value);"><span class="glyphicon glyphicon-trash"></span></button>' +
'</div>' + "</th>" + "</tr>";
str = str + tmp;
}
$("#table-body").html(str);
}
function deleteRelation(merchantUid) {
if (!confirm("是否删除?")) {
return
}
$.ajax({
url: "/delete/agent/merchant/relation",
data: {
"merchantUid": merchantUid
},
success: function (res) {
if (res.Code == 404) {
window.parent.location = "/login.html";
} else if (res.Code == -1) {
alert("删除失败");
} else {
alert("删除成功");
search(getValues());
}
}
});
}
function search(dataJSON) {
$.ajax({
url: "/get/agent/to/merchant",
data: dataJSON,
success: function (res) {
if (res.Code == 404) {
window.parent.location = "/login.html";
} else {
randAgentToMerchant(res);
}
},
error: function () {
alert("系统异常,请稍后再试");
}
});
}
$(function () {
setMerchant();
setAgent();
search(getValues());
});
</script>
</body>
</html>