关闭初始化充值明细

This commit is contained in:
dragon
2024-11-29 14:03:30 +08:00
parent 369bf84a1f
commit 212498b6be

View File

@@ -104,7 +104,8 @@ export default {
format: "yyyy-mm-dd hh:ii:00",
autoclose: true,
});
$("#table").bootstrapTable("destroy");
// 初始化表格,但不设置 `ajax` 方法,也不绑定 `url`,只提供列配置
$("#table").bootstrapTable({
columns: [
{ field: "erbanNo", title: "平台号", align: "center", width: "5%" },
@@ -154,11 +155,7 @@ export default {
align: "center",
width: "5%",
formatter: function (val, row, index) {
if (val == 2) {
return "充值成功";
} else {
return "发起充值";
}
return val == 2 ? "充值成功" : "发起充值";
},
},
{
@@ -167,11 +164,7 @@ export default {
align: "center",
width: "5%",
formatter: function (val, row, index) {
if (val) {
return "是";
} else {
return "否";
}
return val ? "是" : "否";
},
},
{
@@ -189,41 +182,42 @@ export default {
pagination: true,
pageList: [20, 50, 100, 200, 300, 500],
search: false,
sidePagination: "server", //表示服务端请求
sidePagination: "server",
queryParamsType: "undefined",
queryParams: function queryParams(params) {
//设置查询参数
var param = {
pageNumber: params.pageNumber,
pageSize: params.pageSize,
erbanNo: $("#qErbanNo").val(),
channel: $("#qChannel").val(),
startTime: $("#qStartTime").val(),
endTime: $("#qEndTime").val(),
status: $("#qStatus").val(),
newUser: $("#qNewUser").val(),
appChannel: $("#qAppChannel").val(),
};
return param;
},
ajax: function (request) {
//使用ajax请求
$.ajax({
type: "GET",
url: "/admin/chargeRecord/list",
contentType: "application/json;charset=utf-8",
dataType: "json",
data: request.data,
success: function (res) {
apiResult(res);
request.success({
data: [], // 初始化为空数据
});
// 查询刷新
$("#btnSearch").on("click", function () {
const params = {
pageNumber: 1,
pageSize: 20,
erbanNo: $("#qErbanNo").val(),
channel: $("#qChannel").val(),
startTime: $("#qStartTime").val(),
endTime: $("#qEndTime").val(),
status: $("#qStatus").val(),
newUser: $("#qNewUser").val(),
appChannel: $("#qAppChannel").val(),
};
// 手动加载数据
$.ajax({
type: "GET",
url: "/admin/chargeRecord/list",
contentType: "application/json;charset=utf-8",
dataType: "json",
data: params,
success: function (res) {
if (apiResult(res)) {
$("#table").bootstrapTable("load", {
rows: res.data.rows,
total: res.data.total,
});
$("#mapObjHtml span").remove();
$("#mapObjHtml span").remove();
const totalMap = res.data.totalMap;
let str = "";
// 提前处理,将 "总充值{USD}" 放到第一位
const sortedKeys = Object.keys(totalMap).sort((keyA, keyB) => {
return keyA === "总充值{USD}"
? -1
@@ -231,33 +225,18 @@ export default {
? 1
: 0;
});
// 遍历排序后的键值对
for (const key of sortedKeys) {
str += `
<span style="margin-right:10px;display: inline-block;font-size: 18px;color: #2049a9;" type="text">${key}: ${totalMap[key]}, </span>
`;
<span style="margin-right:10px;display: inline-block;font-size: 18px;color: #2049a9;" type="text">${key}: ${totalMap[key]}, </span>
`;
}
$("#mapObjHtml").append(str);
},
error: function (req) {
serverError(req);
},
});
},
toolbar: "#toolbar",
onLoadSuccess: function () {
//加载成功时执行
console.log("load success");
},
onLoadError: function () {
//加载失败时执行
console.log("load fail");
},
});
// 查询刷新
$("#btnSearch").on("click", function () {
TableHelper.doRefresh("#table");
}
},
error: function (req) {
serverError(req);
},
});
});
function serverError(req) {
@@ -276,7 +255,7 @@ export default {
// 导出excel
$("#btnExport").on("click", function () {
var form = $("#form2");
const form = $("#form2");
form.attr("action", "/admin/chargeRecord/exportChargeDetail");
$("#exportErbanNo").val($("#qErbanNo").val());
$("#exportChannel").val($("#qChannel").val());