充值明细-新增一个新页面,页面逻辑是平台号为必选项,给运营用的页面。
This commit is contained in:
380
src/views/record/ChargeRecordViewNew.vue
Normal file
380
src/views/record/ChargeRecordViewNew.vue
Normal file
@@ -0,0 +1,380 @@
|
||||
<template>
|
||||
<section class="content">
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<section class="content-header">
|
||||
<h1 id="itemTitle"></h1>
|
||||
</section>
|
||||
<form id="form2" action="" method="post" target="_blank">
|
||||
<input type="hidden" name="erbanNo" id="exportErbanNo" />
|
||||
<input type="hidden" name="channel" id="exportChannel" />
|
||||
<input type="hidden" name="startTime" id="exportStartTime" />
|
||||
<input type="hidden" name="endTime" id="exportEndTime" />
|
||||
<input type="hidden" name="status" id="exportStatus" />
|
||||
<input type="hidden" name="newUser" id="exportNewUser" />
|
||||
<input type="hidden" name="appChannel" id="exportAppChannel" />
|
||||
<input type="hidden" name="appChannel" id="exportRegionId" />
|
||||
</form>
|
||||
<section class="content">
|
||||
<div id="toolbar">
|
||||
<form class="form-inline">
|
||||
<div class="form-group">
|
||||
<label for="qErbanNo">平台号:</label>
|
||||
<input type="text" class="form-control" name="erbanNo" id="qErbanNo" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="qChannel">渠道:</label>
|
||||
<input type="text" class="form-control" name="channel" id="qChannel" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="qChannel">时间:</label>
|
||||
<input type="text" class="form-control datetime" name="startTime" id="qStartTime" />
|
||||
<label for="qChannel">-</label>
|
||||
<input type="text" class="form-control datetime" name="endTime" id="qEndTime" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="qStatus">状态:</label>
|
||||
<select class="form-control" name="status" id="qStatus">
|
||||
<option value="">全部</option>
|
||||
<option value="1">发起充值</option>
|
||||
<option value="2">充值成功</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="qNewUser">新用户:</label>
|
||||
<select class="form-control" name="newUser" id="qNewUser">
|
||||
<option value="">全部</option>
|
||||
<option value="1">是</option>
|
||||
<option value="0">否</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="qChannel">app渠道</label>
|
||||
<input type="text" class="form-control" name="appChannel" id="qAppChannel" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="regionId">国家:</label>
|
||||
<select name="regionId" id="regionId" class="form-control"></select>
|
||||
</div>
|
||||
</form>
|
||||
<div id="mapObjHtml"></div>
|
||||
<button id="btnSearch" class="btn btn-sm btn-primary">查询</button>
|
||||
<button id="btnExport" class="btn btn-sm btn-primary">导出</button>
|
||||
</div>
|
||||
<!-- .content -->
|
||||
<div class="content" id="table"></div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TableHelper from "@/utils/bootstrap-table-helper";
|
||||
import { buildSelectOption } from '@/utils/system-helper';
|
||||
import {
|
||||
regionInfoList,
|
||||
} from "@/api/refund/refund";
|
||||
export default {
|
||||
name: "ChargeRecordViewNew",
|
||||
created() {
|
||||
this.$nextTick(function () {
|
||||
this.initData();
|
||||
this.initRegionInfoList();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
initData() {
|
||||
$("#qStatus").val(2)
|
||||
$(".datetime").datetimepicker({
|
||||
format: "yyyy-mm-dd hh:ii:00",
|
||||
autoclose: true,
|
||||
});
|
||||
$('#table').bootstrapTable('destroy');
|
||||
|
||||
// 初始化表格,但不设置 `ajax` 方法,也不绑定 `url`,只提供列配置
|
||||
$("#table").bootstrapTable({
|
||||
columns: [
|
||||
{ field: "erbanNo", title: "平台号", align: "center", width: "5%" },
|
||||
{ field: "uid", title: "uid", align: "center", width: "5%" },
|
||||
{ field: "nick", title: "昵称", align: "center", width: "5%" },
|
||||
{
|
||||
field: "partitionName",
|
||||
title: "分区",
|
||||
align: "center",
|
||||
width: "5%",
|
||||
},
|
||||
{
|
||||
field: "regionName",
|
||||
title: "国家",
|
||||
align: "center",
|
||||
width: "5%",
|
||||
},
|
||||
{
|
||||
field: "createTime",
|
||||
title: "创建时间",
|
||||
align: "center",
|
||||
valign: "middle",
|
||||
width: "10%",
|
||||
},
|
||||
{ field: "channel", title: "渠道", align: "center", width: "5%" },
|
||||
{
|
||||
field: "localCurrencyCode",
|
||||
title: "当地货币代码",
|
||||
align: "center",
|
||||
width: "5%",
|
||||
},
|
||||
{
|
||||
field: "localAmount",
|
||||
title: "当地金额",
|
||||
align: "center",
|
||||
width: "5%",
|
||||
},
|
||||
{
|
||||
field: "chargeRecordId",
|
||||
title: "商户订单号",
|
||||
align: "center",
|
||||
width: "5%",
|
||||
},
|
||||
{
|
||||
field: "pingxxChargeId",
|
||||
title: "第三方订单号",
|
||||
align: "center",
|
||||
width: "5%",
|
||||
},
|
||||
{
|
||||
field: "status",
|
||||
title: "状态",
|
||||
align: "center",
|
||||
width: "5%",
|
||||
formatter: function (val, row, index) {
|
||||
return val == 2 ? "充值成功" : "发起充值";
|
||||
},
|
||||
},
|
||||
{
|
||||
field: "newUser",
|
||||
title: "是否新用户",
|
||||
align: "center",
|
||||
width: "5%",
|
||||
formatter: function (val, row, index) {
|
||||
return val ? "是" : "否";
|
||||
},
|
||||
},
|
||||
{
|
||||
field: "appChannel",
|
||||
title: "app渠道",
|
||||
align: "center",
|
||||
width: "5%",
|
||||
},
|
||||
],
|
||||
undefinedText: "-",
|
||||
cache: false,
|
||||
striped: true,
|
||||
showRefresh: false,
|
||||
pageSize: 20,
|
||||
pagination: true,
|
||||
pageList: [20, 50, 100, 200, 300, 500],
|
||||
search: false,
|
||||
sidePagination: "server",
|
||||
queryParamsType: "undefined",
|
||||
data: [], // 初始化为空数据
|
||||
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(),
|
||||
regionId: $("#regionId").val(),
|
||||
};
|
||||
return param;
|
||||
},
|
||||
uniqueId: 'id',
|
||||
toolbar: "#toolbar",
|
||||
// url: "/admin/chargeRecord/list",
|
||||
onLoadSuccess: function (res) {
|
||||
console.log('load success');
|
||||
$("#table").bootstrapTable("load", {
|
||||
rows: res.data.rows,
|
||||
total: res.data.total,
|
||||
});
|
||||
|
||||
$("#mapObjHtml span").remove();
|
||||
const totalMap = res.data.totalMap;
|
||||
let str = "";
|
||||
const sortedKeys = Object.keys(totalMap).sort((keyA, keyB) => {
|
||||
return keyA === "总充值{USD}"
|
||||
? -1
|
||||
: keyB === "总充值{USD}"
|
||||
? 1
|
||||
: 0;
|
||||
});
|
||||
console.log(sortedKeys, '-------sortedKeys');
|
||||
// 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>
|
||||
// `;
|
||||
// }
|
||||
// 处理第二项和最后一项
|
||||
sortedKeys.forEach((key, index) => {
|
||||
let value = totalMap[key];
|
||||
if (index === 1) {
|
||||
key = `包括(${key}`;
|
||||
}
|
||||
if (index === sortedKeys.length - 1) {
|
||||
value = `${value})`;
|
||||
}
|
||||
str += `
|
||||
<span style="margin-right:10px;display: inline-block;font-size: 18px;color: #2049a9;" type="text">${key}: ${value}</span>
|
||||
`;
|
||||
});
|
||||
$("#mapObjHtml").append(str);
|
||||
},
|
||||
onLoadError: function (err) {
|
||||
console.log('load fail');
|
||||
serverError(err);
|
||||
}
|
||||
});
|
||||
|
||||
// 查询刷新
|
||||
$("#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(),
|
||||
regionId: $("#regionId").val(),
|
||||
};
|
||||
if(params.erbanNo == "") {
|
||||
$("#tipMsg").text("请输入平台号");
|
||||
$("#tipModal").modal('show');
|
||||
return
|
||||
}
|
||||
loadTableData(params)
|
||||
});
|
||||
// 分页
|
||||
$("#table").on("page-change.bs.table", function (e, number, size) {
|
||||
const params = {
|
||||
pageNumber: number,
|
||||
pageSize: size,
|
||||
erbanNo: $("#qErbanNo").val(),
|
||||
channel: $("#qChannel").val(),
|
||||
startTime: $("#qStartTime").val(),
|
||||
endTime: $("#qEndTime").val(),
|
||||
status: $("#qStatus").val(),
|
||||
newUser: $("#qNewUser").val(),
|
||||
appChannel: $("#qAppChannel").val(),
|
||||
regionId: $("#regionId").val(),
|
||||
};
|
||||
if(params.erbanNo == "") {
|
||||
$("#tipMsg").text("请输入平台号");
|
||||
$("#tipModal").modal('show');
|
||||
return
|
||||
}
|
||||
loadTableData(params);
|
||||
});
|
||||
|
||||
function loadTableData(params) {
|
||||
$.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();
|
||||
const totalMap = res.data.totalMap;
|
||||
let str = "";
|
||||
const sortedKeys = Object.keys(totalMap).sort((keyA, keyB) => {
|
||||
return keyA === "总充值{USD}"
|
||||
? -1
|
||||
: keyB === "总充值{USD}"
|
||||
? 1
|
||||
: 0;
|
||||
});
|
||||
sortedKeys.forEach((key, index) => {
|
||||
let value = totalMap[key];
|
||||
if (index === 1) {
|
||||
key = `包括(${key}`;
|
||||
}
|
||||
if (index === sortedKeys.length - 1) {
|
||||
value = `${value})`;
|
||||
}
|
||||
str += `
|
||||
<span style="margin-right:10px;display: inline-block;font-size: 18px;color: #2049a9;" type="text">${key}: ${value}</span>
|
||||
`;
|
||||
});
|
||||
$("#mapObjHtml").append(str);
|
||||
}
|
||||
},
|
||||
error: function (req) {
|
||||
serverError(req);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function serverError(req) {
|
||||
$("#tipMsg").text(req.responseJSON.message);
|
||||
$("#tipModal").modal("show");
|
||||
}
|
||||
|
||||
function apiResult(json) {
|
||||
if (json.code == 200 && json.message == "success") {
|
||||
return true;
|
||||
}
|
||||
$("#tipMsg").text("请求失败,错误信息:" + json.message);
|
||||
$("#tipModal").modal("show");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
$("#btnExport").on("click", function () {
|
||||
const form = $("#form2");
|
||||
form.attr("action", "/admin/chargeRecord/exportChargeDetail");
|
||||
$("#exportErbanNo").val($("#qErbanNo").val());
|
||||
$("#exportChannel").val($("#qChannel").val());
|
||||
$("#exportStartTime").val($("#qStartTime").val());
|
||||
$("#exportEndTime").val($("#qEndTime").val());
|
||||
$("#exportStatus").val($("#qStatus").val());
|
||||
$("#exportNewUser").val($("#qNewUser").val());
|
||||
$("#exportAppChannel").val($("#qAppChannel").val());
|
||||
$("#exportRegionId").val($("#regionId").val());
|
||||
form.submit();
|
||||
});
|
||||
},
|
||||
initRegionInfoList() {
|
||||
regionInfoList().then(res => {
|
||||
let data = res.data;
|
||||
buildSelectOption(
|
||||
"#regionId",
|
||||
null,
|
||||
data.map((v) => {
|
||||
return {
|
||||
value: v.id,
|
||||
text: v.regionDesc,
|
||||
};
|
||||
})
|
||||
);
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
Reference in New Issue
Block a user