每日金币统计 - 默认加载七天数据,公会统计数据 - 增加千分位

This commit is contained in:
2025-08-28 10:54:27 +08:00
parent 5ba7067c4a
commit 18f7571e2b
2 changed files with 175 additions and 135 deletions

View File

@@ -5,8 +5,9 @@
<div class="block">
<span class="demonstration">开始时间</span>
<el-date-picker v-model="inquire.time[0]"
type="dates"
placeholder="开始时间">
type="date"
placeholder="开始时间"
format="YYYY-MM-DD">
</el-date-picker>
</div>
</div>
@@ -14,8 +15,9 @@
<div class="block">
<span class="demonstration">结束时间</span>
<el-date-picker v-model="inquire.time[1]"
type="dates"
placeholder="结束时间">
type="date"
placeholder="结束时间"
format="YYYY-MM-DD">
</el-date-picker>
</div>
</div>
@@ -237,7 +239,7 @@ export default {
loading: false,
// 查询条件
inquire: {
time: [],
time: this.calculateLastSevenDays(),
},
// 表格
tableData: [{ x: "x" }],
@@ -252,7 +254,7 @@ export default {
};
},
created () {
// this.getData();
this.getData();
},
computed: {
// 千分位
@@ -265,6 +267,13 @@ export default {
},
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);

View File

@@ -1,162 +1,166 @@
<template>
<!-- 表格 -->
<el-table v-loading="loading"
<el-table
v-loading="loading"
:data="tableData"
border
style="width: 100%; margin-top: 25px">
<el-table-column align="center"
label="日期"
width="220px">
style="width: 100%; margin-top: 25px"
>
<el-table-column align="center" label="日期" width="220px">
<template v-slot="scope">
{{ scope.row.date }} ~ {{ scope.row.endDate }}
</template>
</el-table-column>
<el-table-column prop="totalNewCount"
<el-table-column
prop="totalNewCount"
align="center"
label="全服公会总新增" />
label="全服公会总新增"
/>
<el-table-column align="center"
label="阿拉伯公会总新增"
width="">
<el-table-column align="center" label="阿拉伯公会总新增" width="">
<template v-slot="scope">
<el-button @click="
<el-button
@click="
detailsTitle = '阿拉伯公会总新增' + scope.row.date;
edi(scope.row.arNewCountDetail, false);
"
type="text"
size="small">
size="small"
>
{{ scope.row.arNewCount }}
</el-button>
</template>
</el-table-column>
<el-table-column align="center"
label="英语区总新增"
width="">
<el-table-column align="center" label="英语区总新增" width="">
<template v-slot="scope">
<el-button @click="
<el-button
@click="
detailsTitle = '英语区总新增' + scope.row.date;
edi(scope.row.enNewCountDetail, false);
"
type="text"
size="small">
size="small"
>
{{ scope.row.enNewCount }}
</el-button>
</template>
</el-table-column>
<el-table-column align="center"
label="华语区总新增"
width="">
<el-table-column align="center" label="华语区总新增" width="">
<template v-slot="scope">
<el-button @click="
<el-button
@click="
detailsTitle = '华语区总新增' + scope.row.date;
edi(scope.row.zhNewCountDetail, false);
"
type="text"
size="small">
size="small"
>
{{ scope.row.zhNewCount }}
</el-button>
</template>
</el-table-column>
<el-table-column align="center"
label="土耳其区总新增"
width="">
<el-table-column align="center" label="土耳其区总新增" width="">
<template v-slot="scope">
<el-button @click="
<el-button
@click="
detailsTitle = '土耳其区总新增' + scope.row.date;
edi(scope.row.trNewCountDetail, false);
"
type="text"
size="small">
size="small"
>
{{ scope.row.trNewCount }}
</el-button>
</template>
</el-table-column>
<el-table-column align="center"
label="英语2区总新增"
width="">
<el-table-column align="center" label="英语2区总新增" width="">
<template v-slot="scope">
<el-button @click="
<el-button
@click="
detailsTitle = '英语2区总新增' + scope.row.date;
edi(scope.row.en2NewCountDetail, false);
"
type="text"
size="small">
size="small"
>
{{ scope.row.en2NewCount }}
</el-button>
</template>
</el-table-column>
<el-table-column prop="totalActiveCount"
<el-table-column
prop="totalActiveCount"
align="center"
label="全服公会活跃度" />
label="全服公会活跃度"
/>
<el-table-column align="center"
label="阿拉伯公会活跃度"
width="">
<el-table-column align="center" label="阿拉伯公会活跃度" width="">
<template v-slot="scope">
<el-button @click="
<el-button
@click="
detailsTitle = '阿拉伯公会活跃度' + scope.row.date;
edi(scope.row.arActiveCountDetail, true);
"
type="text"
size="small">
size="small"
>
{{ scope.row.arActiveCount }}
</el-button>
</template>
</el-table-column>
<el-table-column align="center"
label="英语区活跃度"
width="">
<el-table-column align="center" label="英语区活跃度" width="">
<template v-slot="scope">
<el-button @click="
<el-button
@click="
detailsTitle = '英语区活跃度' + scope.row.date;
edi(scope.row.enActiveCountDetail, true);
"
type="text"
size="small">
size="small"
>
{{ scope.row.enActiveCount }}
</el-button>
</template>
</el-table-column>
<el-table-column align="center"
label="华语区活跃度"
width="">
<el-table-column align="center" label="华语区活跃度" width="">
<template v-slot="scope">
<el-button @click="
<el-button
@click="
detailsTitle = '华语区活跃度' + scope.row.date;
edi(scope.row.zhActiveCountDetail, true);
"
type="text"
size="small">
size="small"
>
{{ scope.row.zhActiveCount }}
</el-button>
</template>
</el-table-column>
<el-table-column align="center"
label="土耳其区活跃度"
width="">
<el-table-column align="center" label="土耳其区活跃度" width="">
<template v-slot="scope">
<el-button @click="
<el-button
@click="
detailsTitle = '土耳其区活跃度' + scope.row.date;
edi(scope.row.trActiveCountDetail, true);
"
type="text"
size="small">
size="small"
>
{{ scope.row.trActiveCount }}
</el-button>
</template>
</el-table-column>
<el-table-column align="center"
label="英语2区活跃度"
width="">
<el-table-column align="center" label="英语2区活跃度" width="">
<template v-slot="scope">
<el-button @click="
<el-button
@click="
detailsTitle = '英语2区活跃度' + scope.row.date;
edi(scope.row.en2ActiveCountDetail, true);
"
type="text"
size="small">
size="small"
>
{{ scope.row.en2ActiveCount }}
</el-button>
</template>
@@ -177,54 +181,70 @@
/> -->
<!-- 详情 -->
<el-dialog v-model="detailsDialog"
:title="detailsTitle"
width="50%"
center>
<el-dialog v-model="detailsDialog" :title="detailsTitle" width="50%" center>
<!-- 内表格 -->
<el-table v-loading="loading"
<el-table
v-loading="loading"
:data="tableDataIn"
border
style="width: 100%; margin-top: 25px">
<el-table-column prop="date"
style="width: 100%; margin-top: 25px"
>
<el-table-column prop="date" align="center" label="日期" />
<el-table-column prop="endDate" align="center" label="结束时间" />
<el-table-column prop="guildId" align="center" label="公会ID" />
<el-table-column prop="ownerErbanNo" align="center" label="公会长ID" />
<el-table-column
prop="ownerRegionName"
align="center"
label="日期" />
<el-table-column prop="endDate"
label="公会长所属国家"
/>
<el-table-column prop="operatorName" align="center" label="公会负责人" />
<el-table-column
prop="activeMemberCount"
align="center"
label="结束时间" />
<el-table-column prop="guildId"
label="本周收礼主播数"
/>
<el-table-column
prop="guildGoldFlow"
align="center"
label="公会ID" />
<el-table-column prop="ownerErbanNo"
align="center"
label="公会长ID" />
<el-table-column prop="ownerRegionName"
align="center"
label="公会长所属国家" />
<el-table-column prop="operatorName"
align="center"
label="公会负责人" />
<el-table-column prop="activeMemberCount"
align="center"
label="本周收礼主播数" />
<el-table-column prop="guildGoldFlow"
align="center"
label="本周公会钻石流水" />
<el-table-column prop="guildDiamondFlow"
align="center"
label="本周公会金币流水" />
<el-table-column prop="lastGuildGoldFlow"
align="center"
label="上周公会钻石流水"
v-if="detailsIsShow" />
<el-table-column prop="guildGoldFlowWow"
align="center"
label="周环比"
v-if="detailsIsShow">
label="本周公会钻石流水"
>
<template v-slot="scope">
{{
scope.row.lastGuildGoldFlow === 0 ? '--'
: formatPercentage(scope.row.guildGoldFlow / scope.row.lastGuildGoldFlow) + '%'
formattedNumber(scope.row.guildGoldFlow)
}}
</template>
</el-table-column>
<el-table-column
prop="guildDiamondFlow"
align="center"
label="本周公会金币流水"
>
<template v-slot="scope">
{{
formattedNumber(scope.row.guildDiamondFlow)
}}
</template>
</el-table-column>
<el-table-column
prop="lastGuildGoldFlow"
align="center"
label="上周公会钻石流水"
v-if="detailsIsShow"
/>
<el-table-column
prop="guildGoldFlowWow"
align="center"
label="周环比"
v-if="detailsIsShow"
>
<template v-slot="scope">
{{
scope.row.lastGuildGoldFlow === 0
? "--"
: formatPercentage(
scope.row.guildGoldFlow / scope.row.lastGuildGoldFlow
) + "%"
}}
</template>
</el-table-column>
@@ -232,9 +252,9 @@
<!-- 操作 -->
<template #footer>
<span class="dialog-footer">
<el-button type="primary"
class="primary"
@click="detailsDialog = false">关闭</el-button>
<el-button type="primary" class="primary" @click="detailsDialog = false"
>关闭</el-button
>
</span>
</template>
</el-dialog>
@@ -245,7 +265,7 @@ import { dateFormat } from "@/utils/system-helper";
import { ElMessage } from "element-plus";
export default {
name: "guildStatisticsData",
data () {
data() {
return {
loading: false,
// 查询条件
@@ -265,12 +285,23 @@ export default {
detailsIsShow: false,
};
},
created () {
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: {
// 查询
getData () {
getData() {
this.loading = true;
let time = this.inquire.time;
let startTime = null;
@@ -301,19 +332,19 @@ export default {
});
},
// 详情
edi (res, type) {
edi(res, type) {
this.detailsIsShow = type;
this.tableDataIn = JSON.parse(res);
this.detailsDialog = true;
},
formatPercentage (value) {
formatPercentage(value) {
return parseFloat((value * 100).toFixed(2));
},
// 分页导航
handleSizeChange () {
handleSizeChange() {
this.getData();
},
handleCurrentChange () {
handleCurrentChange() {
this.getData();
},
},