404 lines
11 KiB
Vue
404 lines
11 KiB
Vue
<template>
|
|
<div class="outer">
|
|
<!-- 查询 -->
|
|
<div class="inquire">
|
|
<div class="block">
|
|
<span class="demonstration">开始时间</span>
|
|
<el-date-picker v-model="inquire.time[0]"
|
|
type="date"
|
|
placeholder="开始时间"
|
|
format="YYYY-MM-DD">
|
|
</el-date-picker>
|
|
</div>
|
|
</div>
|
|
<div class="inquire">
|
|
<div class="block">
|
|
<span class="demonstration">结束时间</span>
|
|
<el-date-picker v-model="inquire.time[1]"
|
|
type="date"
|
|
placeholder="结束时间"
|
|
format="YYYY-MM-DD">
|
|
</el-date-picker>
|
|
</div>
|
|
</div>
|
|
<!-- 查询按钮 -->
|
|
<el-button style=""
|
|
type="primary"
|
|
@click="getData()">查询</el-button>
|
|
<!-- <el-button style="" type="primary" @click="exportDate()">导出</el-button> -->
|
|
</div>
|
|
|
|
<!-- 表格 -->
|
|
<el-table v-loading="loading"
|
|
:data="tableData"
|
|
border
|
|
style="width: 100%; margin-top: 25px">
|
|
<el-table-column prop="date"
|
|
align="center"
|
|
label="日期" />
|
|
<el-table-column align="center"
|
|
label="全平台真实消耗"
|
|
width="">
|
|
<template v-slot="scope">
|
|
<el-button @click="
|
|
detailsTitle = '全平台金币明细';
|
|
edi(scope.row, 0);
|
|
"
|
|
type="text"
|
|
size="small">
|
|
{{ formattedNumber(scope.row.totalDiamond) }}
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center"
|
|
label="阿拉伯区真实消耗"
|
|
width="">
|
|
<template v-slot="scope">
|
|
<el-button @click="
|
|
detailsTitle = '阿拉伯区金币明细';
|
|
edi(scope.row, 2);
|
|
"
|
|
type="text"
|
|
size="small">
|
|
{{ formattedNumber(scope.row.arDiamond) }}
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center"
|
|
label="英语区真实消耗"
|
|
width="">
|
|
<template v-slot="scope">
|
|
<el-button @click="
|
|
detailsTitle = '英语区金币明细';
|
|
edi(scope.row, 1);
|
|
"
|
|
type="text"
|
|
size="small">
|
|
{{ formattedNumber(scope.row.enDiamond) }}
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center"
|
|
label="华语区真实消耗"
|
|
width="">
|
|
<template v-slot="scope">
|
|
<el-button @click="
|
|
detailsTitle = '华语区金币明细';
|
|
edi(scope.row, 4);
|
|
"
|
|
type="text"
|
|
size="small">
|
|
{{ formattedNumber(scope.row.zhDiamond) }}
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center"
|
|
label="土耳其区真实消耗"
|
|
width="">
|
|
<template v-slot="scope">
|
|
<el-button @click="
|
|
detailsTitle = '土耳其区金币明细';
|
|
edi(scope.row, 8);
|
|
"
|
|
type="text"
|
|
size="small">
|
|
{{ formattedNumber(scope.row.trDiamond) }}
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<el-table-column align="center"
|
|
label="英语2区真实消耗"
|
|
width="">
|
|
<template v-slot="scope">
|
|
<el-button @click="
|
|
detailsTitle = '英语区2金币明细';
|
|
edi(scope.row, 16);
|
|
"
|
|
type="text"
|
|
size="small">
|
|
{{ formattedNumber(scope.row.en2Diamond) }}
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<el-table-column prop="totalRemainDiamond"
|
|
align="center"
|
|
label="全平台库存">
|
|
<template v-slot="scope">
|
|
{{ formattedNumber(scope.row.totalRemainDiamond) }}
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<el-table-column prop="arRemainDiamond"
|
|
align="center"
|
|
label="阿拉伯区库存">
|
|
<template v-slot="scope">
|
|
{{ formattedNumber(scope.row.arRemainDiamond) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="enRemainDiamond"
|
|
align="center"
|
|
label="英语区库存">
|
|
<template v-slot="scope">
|
|
{{ formattedNumber(scope.row.enRemainDiamond) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="zhRemainDiamond"
|
|
align="center"
|
|
label="华语区库存">
|
|
<template v-slot="scope">
|
|
{{ formattedNumber(scope.row.zhRemainDiamond) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="trRemainDiamond"
|
|
align="center"
|
|
label="土耳其区库存">
|
|
<template v-slot="scope">
|
|
{{ formattedNumber(scope.row.trRemainDiamond) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="en2RemainDiamond"
|
|
align="center"
|
|
label="英语2区库存">
|
|
<template v-slot="scope">
|
|
{{ formattedNumber(scope.row.en2RemainDiamond) }}
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<!-- 分页 -->
|
|
<!-- <el-pagination
|
|
style="margin-top: 10px"
|
|
class="paginationClass"
|
|
v-model:current-page="currentPage"
|
|
v-model:page-size="pageSize"
|
|
:page-sizes="[10, 20, 30, 40, 50, 100, 200, 300, 400, 500, 999999999]"
|
|
layout="sizes, prev, pager, next"
|
|
:total="total"
|
|
@size-change="handleSizeChange"
|
|
@current-change="handleCurrentChange"
|
|
/> -->
|
|
|
|
<!-- 详情 -->
|
|
<el-dialog v-model="detailsDialog"
|
|
:title="detailsTitle"
|
|
width="30%"
|
|
center>
|
|
<!-- 内表格 -->
|
|
<el-table v-loading="loading"
|
|
:data="tableDataIn"
|
|
border
|
|
style="width: 100%; margin-top: 25px">
|
|
<el-table-column prop="domainDesc"
|
|
align="center"
|
|
label="类型" />
|
|
<el-table-column prop="addDiamond"
|
|
align="center"
|
|
label="增加">
|
|
<template v-slot="scope">
|
|
{{ formattedNumber(scope.row.addDiamond) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="subDiamond"
|
|
align="center"
|
|
label="消耗">
|
|
<template v-slot="scope">
|
|
{{ formattedNumber(scope.row.subDiamond) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="subDiamond"
|
|
align="center"
|
|
label="留存">
|
|
<template #default="row">
|
|
{{ formattedNumber(totalDiamonds(row.row)) }}
|
|
<div v-if="row.row.domainDesc ==='小游戏' || row.row.domainDesc ==='幸运数字礼物' || row.row.domainDesc ==='Bravo礼物'">
|
|
{{ percentage(row.row) }}%
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<!-- 操作 -->
|
|
<template #footer>
|
|
<span class="dialog-footer">
|
|
<el-button type="primary"
|
|
class="primary"
|
|
@click="detailsDialog = false">关闭</el-button>
|
|
</span>
|
|
</template>
|
|
</el-dialog>
|
|
</template>
|
|
<script>
|
|
import { diamondStatList } from "@/api/dailyCoinStatistics/dailyCoinStatistics";
|
|
import { dateFormat } from "@/utils/system-helper";
|
|
import { ElMessage } from "element-plus";
|
|
export default {
|
|
name: "dailyCoinStatistics",
|
|
data () {
|
|
return {
|
|
loading: false,
|
|
// 查询条件
|
|
inquire: {
|
|
time: this.calculateLastSevenDays(),
|
|
},
|
|
// 表格
|
|
tableData: [{ x: "x" }],
|
|
// 分页
|
|
total: 10, //总页数
|
|
currentPage: 1, //页码
|
|
pageSize: 10, //条数
|
|
// 内表格
|
|
detailsDialog: false,
|
|
detailsTitle: "金币明细",
|
|
tableDataIn: [],
|
|
};
|
|
},
|
|
created () {
|
|
this.getData();
|
|
},
|
|
computed: {
|
|
// 千分位
|
|
formattedNumber () {
|
|
return (num) => {
|
|
if (num === null || num === undefined) return '';
|
|
return Math.floor(num).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
};
|
|
},
|
|
|
|
},
|
|
methods: {
|
|
// 默认七天
|
|
calculateLastSevenDays () {
|
|
const end = new Date();
|
|
const start = new Date();
|
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
|
return [start, end];
|
|
},
|
|
totalDiamonds (row) {
|
|
const subDiamond = Number(row.subDiamond || 0);
|
|
const addDiamond = Number(row.addDiamond || 0);
|
|
return subDiamond + addDiamond;
|
|
},
|
|
// 计算百分比,防止除零异常
|
|
percentage (row) {
|
|
const subDiamond = Number(row.subDiamond || 0);
|
|
const addDiamond = Number(row.addDiamond || 0);
|
|
|
|
if (subDiamond === 0) {
|
|
return '0.00'; // 防止除零错误
|
|
}
|
|
|
|
|
|
const result = (addDiamond / subDiamond) * 100;
|
|
return result.toFixed(2); // 格式化为两位小数
|
|
},
|
|
// 查询
|
|
getData () {
|
|
this.loading = true;
|
|
let time = this.inquire.time;
|
|
let startTime = null;
|
|
let endTime = null;
|
|
if (time.length > 0) {
|
|
startTime = this.inquire.time[0]
|
|
? dateFormat(this.inquire.time[0], "yyyy-MM-dd")
|
|
: null;
|
|
endTime = this.inquire.time[1]
|
|
? dateFormat(this.inquire.time[1], "yyyy-MM-dd")
|
|
: null;
|
|
}
|
|
diamondStatList({
|
|
startDate: startTime,
|
|
endDate: endTime,
|
|
// pageNo: this.currentPage,
|
|
// pageSize: this.pageSize,
|
|
}).then((res) => {
|
|
if (res.code == 200) {
|
|
// this.total = res.data.total;
|
|
this.tableData = res.data;
|
|
this.loading = false;
|
|
} else {
|
|
ElMessage({
|
|
showClose: true,
|
|
message: res.message,
|
|
type: "error",
|
|
});
|
|
}
|
|
});
|
|
},
|
|
// 详情
|
|
edi (res, type) {
|
|
var jsonArr =
|
|
type == 0
|
|
? res.totalDiamondDetail
|
|
: type == 1
|
|
? res.enDomainDetail
|
|
: type == 2
|
|
? res.arDomainDetail
|
|
: type == 4
|
|
? res.zhDomainDetail
|
|
: type == 8
|
|
? res.trDomainDetail
|
|
: type == 16
|
|
? res.en2DomainDetail
|
|
: `"[""]"`;
|
|
|
|
this.tableDataIn = JSON.parse(jsonArr);
|
|
this.detailsDialog = true;
|
|
},
|
|
// 分页导航
|
|
handleSizeChange () {
|
|
this.getData();
|
|
},
|
|
handleCurrentChange () {
|
|
this.getData();
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
<style lang="less" scoped>
|
|
.outer {
|
|
padding-top: 20px;
|
|
background: #ecf0f5;
|
|
border-top: 3px solid #d2d6de;
|
|
.demonstration {
|
|
margin-right: 20px;
|
|
}
|
|
.inquire {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
white-space: nowrap;
|
|
float: left;
|
|
margin-right: 20px;
|
|
}
|
|
.search {
|
|
width: 100%;
|
|
height: 41px;
|
|
.searchLeft,
|
|
.searchRight {
|
|
width: 20%;
|
|
float: left;
|
|
span {
|
|
margin-right: 10px;
|
|
}
|
|
.input {
|
|
width: 75%;
|
|
}
|
|
}
|
|
}
|
|
.buttonBox {
|
|
margin-top: 10px;
|
|
}
|
|
.authorityBox {
|
|
.authoritySpan {
|
|
margin-right: 20px;
|
|
}
|
|
.authorityInpput {
|
|
width: 50%;
|
|
}
|
|
}
|
|
.dialogTableVisibleBut {
|
|
margin: -25px 0 20px 0px;
|
|
}
|
|
}
|
|
</style>
|