Files
peko-admin-web/src/views/users/ChargeRecordDailyStatisticsView.vue
2024-01-31 12:42:07 +08:00

211 lines
9.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<div id="toolbar">
<form class="col-sm-12" id="searchForm" action="/admin/chargeRecord/dailyexport" method="get"
target="_blank">
</form>
<div class="col-sm-12 pull-left">
<h4>
今日充值数据<span class="totalAmount" style="color: red">0</span>总金额/
<span class="totalCount" style="color: red">0</span>总笔数
<span style="color: red">(单位美元)</span>
</h4>
</div>
<!-- <div class="col-sm-3 pull-right">
<button id="btnSearch" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>查询
</button>
<button id="btnExport" class="btn btn-default">
<i class="glyphicon glyphicon-export"></i>导出
</button>
</div>-->
</div>
<!-- .content -->
<div id="table"></div>
</div>
</div>
</section>
<div class="modal fade" id="recordDetail" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="modalLabel"></h4>
</div>
<div class="modal-body">
<div id="detailtable"></div>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
export default {
name: "ChargeRecordDailyStatisticsView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
columns: [
{ field: 'timeStr', title: '日期', align: 'center', width: '5%' },
/*{field: 'wxAmount', title: '微信支付', align: 'center', width: '5%'},
{field: 'wxWapAmount', title: '微信H5支付', align: 'center', width: '5%'},
{field: 'wxPubAmount', title: '微信公众号', align: 'center', width: '5%'},
{field: 'wxMicroMallPubAmount', title: '微商城公众号', align: 'center', width: '5%'},
{field: 'wxPub2Amount', title: '平台公众号', align: 'center', width: '5%'},
{field: 'wxPub2H5Amount', title: '平台公众号H5支付', align: 'center', width: '5%'},
{field: 'alipayAmount', title: '支付宝', align: 'center', width: '5%'},
{field: 'alipayWapAmount', title: '支付宝H5', align: 'center', width: '5%'},
{field: 'iosPayAmount', title: 'IOS支付', align: 'center', width: '5%'},
{field: 'wxMiniAppAmount', title: '小程序支付', align: 'center', width: '5%'},*/
{ field: 'googleAmount', title: 'google支付', align: 'center', width: '5%' },
{ field: 'payermaxAmount', title: 'payermax支付', align: 'center', width: '5%' },
{ field: 'myCardAmount', title: 'MyCard支付', align: 'center', width: '5%' },
{ field: 'iosPayAmount', title: 'ios支付', align: 'center', width: '5%' },
{ field: 'companyAccount', title: '充值打公账', align: 'center', width: '5%' },
{
field: 'time',
title: '操作',
align: 'center',
width: '5%',
formatter: function (val, row, index) {
return '<button id="btnDetail" name="btnDetail" class="btn btn-sm btn-success opt-detail" data-id=' + val + '>' +
'<i class="glyphicon glyphicon-edit"></i> 明细</button>';
}
}
],
undefinedText: 0,
cache: false,
striped: true,
showRefresh: false,
pageSize: 20,
pagination: true,
pageList: [20, 50, 100, 200, 300, 500],
search: false,
sidePagination: "client", //表示服务端请求
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageNum: params.pageNumber,
pageSize: params.pageSize
};
return param;
},
toolbar: '#toolbar',
url: '/admin/chargeRecord/dailylist.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
getTotalStatis();
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
// 导出EXCEL
$('#btnExport').on('click', function () {
$("#searchForm").submit();
});
// 查询刷新
$('#btnSearch').on('click', function () {
TableHelper.doRefresh('#table');
});
$("#table").on("click", '.opt-detail', function () {
$("#recordDetail").modal('show');
var time = $(this).attr("data-id");
var date = new Date().format("yyyy-MM-dd ");
$("#modalLabel").html(date + parseTime(time));
$('#detailtable').bootstrapTable('destroy');
$('#detailtable').bootstrapTable({
columns: [
{ field: 'channel', title: '渠道', align: 'center', width: '5%' },
{ field: 'amount', title: '充值金额', align: 'center', width: '5%' },
{ field: 'count', title: '充值笔数', align: 'center', width: '5%' }
],
undefinedText: 0,
height: 600,
cache: false,
striped: true,
showRefresh: false,
pageSize: 20,
pagination: false,
pageList: [20, 50, 100, 200, 300, 500],
search: false,
sidePagination: "client", //表示服务端请求
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
pageNum: params.pageNumber,
pageSize: params.pageSize,
time: time
};
return param;
},
url: '/admin/chargeRecord/dailydetail.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
});
});
}
},
};
function parseTime(val) {
if (val < 10) {
return '0' + val + ':00-0' + val + ':59';
} else {
return val + ':00-' + val + ':59';
}
}
function getTotalStatis() {
$.get('/admin/chargeRecord/dailytotal', function (res) {
if (res.code == 200) {
console.log(res.data);
if (res.data) {
$('.totalAmount').html(res.data.amount);
$('.totalCount').html(res.data.count);
}
}
})
}
</script>
<style scoped></style>