You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dongfeng-pay/jhboss/views/confirm.html

261 lines
9.8 KiB
Go

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../static/css/basic.css">
<link src="../static/lib/bootstrap/css/bootstrap.min.css">
<script src="../static/js/jquery.min.js"></script>
<script src="../static/lib/bootstrap/js/bootstrap.min.js"></script>
<script src="../static/js/filter.js"></script>
<style>
.panel-body label {
font-weight: normal;
margin-right: 20px;
}
.margin-bottom{
margin-bottom: 20px;
}
</style>
</head>
<body>
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title"></h3>
</div>
<div class="panel-body">
<div class="margin-bottom">
<label for="">
<input type="radio" name="confirm" value="payfor_road" checked>
</label>
<label for="">
<input type="radio" name="confirm" value="payfor_refuse">
</label>
<label for="">
<input type="radio" name="confirm" value="payfor_hand">
</label>
<label for="">
<input type="text" id="remark" value=""><span class="color-red"> *</span>
</label>
<input type="button" class="btn btn-success" value="确定" onclick="yes();">
</div>
<div class="margin-bottom" id="road">
<label for="">
<input type="text" value="" id="road-name"><span class="color-red"> *</span>
<input type="button" class="btn btn-info" value="搜索" id="road-search">
</label>
<label for="">
<input type="text" value="" id="balance">
<button type="button" class="btn btn-primary" onclick="getBalance();">
</label>
</div>
</div>
</div>
{{/*展示通道列表*/}}
<div class="road-list">
<div class="menu-table table-responsive">
<table>
<thead class="thead-dark">
<tr>
<th></th>
<th></th>
<th>uid</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody id="table-body">
</tbody>
</table>
</div>
<!-- -->
<div class="cut_page">
<li>
<select id="display_count">
<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 type="text" name="jump_page" value=""> <button type="button" class="btn btn-default">Go</button></li>
</div>
</div>
<script>
$("input[name='confirm']").change(function () {
let confirmType = $("input[name='confirm']:checked").val();
if (confirmType != "allow") {
$("#road").hide();
$(".road-list").hide();
} else if (confirmType == "allow") {
$("#road").show();
ajaxRoadList(getCutPageValues());
$(".road-list").show();
}
});
function getCutPageValues() {
let displayCount = $("#display_count").val();
let currentPage = $(".current_page").html();
let totalPage = $(".total_page").html();
let jumpPage = $(".jump_page input").val();
let roadName = $("#road-name").val();
return {
"displayCount":displayCount,
"currentPage":currentPage,
"totalPage":totalPage,
"jumpPage":jumpPage,
"roadName":roadName
};
}
//当每页显示数更改后,执行的操作
$("#display_count").change(function() {
let dataJSON = getCutPageValues();
ajaxRoadList(dataJSON);
});
//点击上一页的按钮
$(".pre_page").click(function() {
let dataJSON = getCutPageValues();
if (dataJSON["currentPage"] == 1) {
return;
}
dataJSON["currentPage"] = parseInt(dataJSON["currentPage"]) - 1;
ajaxRoadList(dataJSON);
});
//点击下一页的按钮时
$(".next_page").click(function() {
let dataJSON = getCutPageValues();
if (dataJSON["currentPage"] == dataJSON["totalPage"]) {
return;
}
dataJSON["currentPage"] = parseInt(dataJSON["currentPage"]) + 1;
ajaxRoadList(dataJSON);
});
//点击跳转那一页的按钮
$(".jump_page button").click(function() {
let dataJSON = getCutPageValues();
if (dataJSON["jumpPage"].length <= 0) {
return;
}
ajaxRoadList(dataJSON);
});
function setCutPageValues(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 randRoadList(res) {
setCutPageValues(res);
let str = "";
for (let i = 0; i < res.RoadInfoList.length; i ++) {
let v = res.RoadInfoList[i];
let tmp = "<tr>" + "<th>" + (res.StartIndex+i+1) + "</th>" +
"<th>" + v.RoadName + "</th>" + "<th>" + v.RoadUid + "</th>" + "<th>" + v.ProductName + "</th>" +
"<th>" + v.Status + "</th>" + "<th>" + v.CreateTime + "</th>";
tmp = tmp.replace("unactive", "不可用").replace("active", "正常");
tmp = tmp +'<th>' + '<button type="button" value="' + v.RoadName +'" class="btn btn-default" onclick="save(this.value);">'+ "确定" +'</button>' + '</th></tr>';
str = str + tmp;
$("#table-body").html(str);
}
}
function ajaxRoadList(dataJSON) {
$.ajax({
url: "/get/road",
data: dataJSON,
success: function (res) {
if (res.Code == 404) {
window.parent.location = "/login.html";
} else {
randRoadList(res);
}
},
error: function () {
alert("系统异常,请稍后再试")
}
});
}
function getBalance() {
let roadName = $("#road-name").val();
$.ajax({
url: "/get/balance",
data: {
"roadName":roadName
},
success: function (res) {
if (res.Code == 404) {
window.parent.location = "/login.html";
} else {
$("#balance").val(res.Balance);
}
},
error: function () {
alert("查询异常");
}
});
}
function yes() {
let roadName = $("#road-name").val();
let remark = $("#remark").val();
let bankOrderId = $("#main-bank-order-id").val();
let confirmType = $("input[name='confirm']:checked").val();
if (remark.length == 0 ) {
alert("备注不能为空")
return
}
$.ajax({
url:"/choose/payfor/road",
data: {
"roadName":roadName,
"bankOrderId":bankOrderId,
"remark":remark,
"confirmType":confirmType
},
success: function (res) {
if (res.Code == 404) {
window.parent.location = "/login.html";
} else if (res.Code == -1){
alert(res.Msg);
} else {
alert("下发已经受理");
loadMainContent("/payfor_record.html");
}
},
error: function () {
alert("系统异常,请稍后再试")
}
});
}
function save(roadName) {
$("#road-name").val(roadName);
}
//搜索列表
$("#road-search").click(function () {
let dataJSON = getCutPageValues();
ajaxRoadList(dataJSON);
});
$(function () {
let dataJSON = getCutPageValues();
ajaxRoadList(dataJSON)
});
</script>
</body>
</html>