分区充值统计-独联体

This commit is contained in:
2025-09-26 14:03:11 +08:00
parent b8f105e3a9
commit e174bf30d4

View File

@@ -0,0 +1,294 @@
<template>
<div class="box">
<div class="inquire">
<span class="demonstration">日期</span>
<el-date-picker
v-model="dataTime"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</div>
<el-button style="" type="primary" @click="getData()">查询</el-button>
<el-button class="primary" type="primary" @click="confirmExportExcel()"
>导出</el-button
>
<!-- 表格数据 -->
<el-table
v-loading="tableData.loading"
:data="tableData.data"
ref="multipleTable"
@selection-change="handleSelectionChange"
border
style="width: 100%; margin-top: 25px"
>
<el-table-column prop="date" align="center" label="日期" />
<el-table-column
prop="v5payUsd"
align="center"
label="
V5play充值美元"
>
<template v-slot="scope">
<el-button
@click="detailDialogFun(scope.row.date, 'v5pay')"
type="text"
size="medium "
>{{ scope.row.v5payUsd }}</el-button
>
</template>
</el-table-column>
<el-table-column prop="googleUsd" align="center" label="google充值美元">
<template v-slot="scope">
<el-button
@click="detailDialogFun(scope.row.date, 'google_play_billing')"
type="text"
size="medium "
>{{ scope.row.googleUsd }}</el-button
>
</template>
</el-table-column>
<el-table-column prop="razerUsd" align="center" label="razer充值">
<template v-slot="scope">
<el-button
@click="detailDialogFun(scope.row.date, 'razer')"
type="text"
size="medium "
>{{ scope.row.razerUsd }}</el-button
>
</template>
</el-table-column>
<el-table-column
prop="payermaxUsd"
align="center"
label="payermax充值美元"
>
<template v-slot="scope">
<el-button
@click="detailDialogFun(scope.row.date, 'payermax')"
type="text"
size="medium "
>{{ scope.row.payermaxUsd }}</el-button
>
</template>
</el-table-column>
<el-table-column prop="myCardUsd" align="center" label="myCard充值美元">
<template v-slot="scope">
<el-button
@click="detailDialogFun(scope.row.date, 'MyCard')"
type="text"
size="medium "
>{{ scope.row.myCardUsd }}</el-button
>
</template>
</el-table-column>
<el-table-column
prop="startPayUsd"
align="center"
label="startPay充值美元"
>
<template v-slot="scope">
<el-button
@click="detailDialogFun(scope.row.date, 'start_pay')"
type="text"
size="medium "
>{{ scope.row.startPayUsd }}</el-button
>
</template>
</el-table-column>
<el-table-column prop="iosUsd" align="center" label="ios充值美元">
<template v-slot="scope">
<el-button
@click="detailDialogFun(scope.row.date, 'ios_pay')"
type="text"
size="medium "
>{{ scope.row.iosUsd }}</el-button
>
</template>
</el-table-column>
<el-table-column prop="companyUsd" align="center" label="对公打款美元">
<template v-slot="scope">
<el-button
@click="detailDialogFun(scope.row.date, 'company')"
type="text"
size="medium "
>{{ scope.row.companyUsd }}</el-button
>
</template>
</el-table-column>
<el-table-column prop="totalUsd" align="center" label="总充值美元" >
<template v-slot="scope">
<el-button
@click="detailDialogFun(scope.row.date, '')"
type="text"
size="medium "
>{{ scope.row.totalUsd }}</el-button
>
</template>
</el-table-column>
</el-table>
<!--国家明细弹窗 -->
<el-dialog v-model="detailDialog" title="国家明细" width="25%" center>
<!-- 表格数据 -->
<el-table
v-loading="detailData.loading"
:data="detailData.data"
border
style="width: 100%; margin-top: 25px"
>
<el-table-column prop="regionName" align="center" label="国家" />
<el-table-column prop="usd" align="center" label="充值美元" />
</el-table>
</el-dialog>
</div>
</template>
<script>
export default {
name: "ChargeRecordSovietPartitionStatisticsView",
};
</script>
<script setup>
import { ref, onMounted, reactive, computed } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import { dateFormat } from "@/utils/system-helper";
import {
getChargeRecordPartitionDetail,
exportPartitionDetail,
getChargeRecordPartitionRegionDetail,
} from "@/api/users/ChargeRecordPartitionStatisticsView.js";
import { formatDate } from "@/utils/relDate";
const dataTime = ref([]);
const formData = reactive({
beginDate: "",
endDate: "",
partitionId: 32,
});
const tableData = reactive({
data: [],
total: 0,
loading: false,
});
const detailDialog = ref(false);
const detailData = reactive({
data: [],
loading: false,
});
// 查询
const getData = () => {
tableData.loading = true;
if (dataTime.value && dataTime.value.length > 0) {
formData.beginDate = dateFormat(dataTime.value[0], "yyyy-MM-dd");
formData.endDate = dateFormat(dataTime.value[1], "yyyy-MM-dd");
} else {
formData.beginDate = dataTime.value;
formData.endDate = dataTime.value;
}
getChargeRecordPartitionDetail(formData).then((res) => {
tableData.data = res;
tableData.loading = false;
});
};
// 导出
const confirmExportExcel = async () => {
// Object.assign(formData, { pageSize: 10000, pageNo: 1 });
try {
const res = await exportPartitionDetail(formData);
if (res) {
ElMessage({
message: "导出成功",
type: "success",
});
let time = formatDate(new Date());
let alink = document.createElement("a");
alink.download = `分区充值统计${time}.xls`;
alink.style.display = "none";
const blob = new Blob([res]);
alink.href = URL.createObjectURL(blob);
document.body.appendChild(alink);
alink.click();
URL.revokeObjectURL(alink.href);
}
} catch (error) {
ElMessage({
message: error.message,
type: "error",
});
}
};
// 设置默认日期范围今天到7天前
const setDefaultDateRange = () => {
const today = new Date();
const sevenDaysAgo = new Date();
sevenDaysAgo.setDate(today.getDate() - 7);
dataTime.value = [
dateFormat(sevenDaysAgo, "yyyy-MM-dd"),
dateFormat(today, "yyyy-MM-dd"),
];
};
// 国家明细
const detailDialogFun = (beginDate, channel) => {
detailData.loading = true;
getChargeRecordPartitionRegionDetail({
beginDate,
channel,
partitionId: 32,
}).then((res) => {
if (res.code == 200) {
detailData.data = res.data;
detailData.loading = false;
detailDialog.value = true;
} else {
detailData.loading = false;
ElMessage({
message: res.message,
type: "error",
});
}
});
};
onMounted(() => {
setDefaultDateRange();
getData();
});
</script>
<style lang="less" scoped>
.box {
padding-top: 20px;
background: #ecf0f5;
.inquire {
display: inline-block;
margin-right: 20px;
span {
margin-right: 10px;
}
.input {
width: 180px;
margin-right: 10px;
}
}
.dialogTableVisibleBut {
display: block;
margin: 30px 0 0 830px;
}
.paginationClass {
margin: 15px 0 5px 0px;
}
}
.selectBox {
display: flex;
height: 35px;
line-height: 35px;
margin-bottom: 20px;
}
</style>