新增 - 休闲游戏时长统计
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
// 获取游戏列表
|
||||
export const mgList = query => {
|
||||
return request({
|
||||
url: '/admin/miniGame/statis/mgList',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 获取休闲游戏时长统计列表
|
||||
export const getMinigameListStat = query => {
|
||||
return request({
|
||||
url: '/admin/minigame/sud/stat/listStat',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
245
src/views/data/statisticsIeisureGameDuration.vue
Normal file
245
src/views/data/statisticsIeisureGameDuration.vue
Normal file
@@ -0,0 +1,245 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<div class="inquire">
|
||||
<span>游戏名称</span>
|
||||
<el-select v-model="formData.gameId" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in gameList"
|
||||
:key="item.mgId"
|
||||
:label="JSON.parse(item.name).zh"
|
||||
:value="item.mgId"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="inquire">
|
||||
<span class="demonstration">月份</span>
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-date-picker
|
||||
v-model="formData.month"
|
||||
type="month"
|
||||
placeholder="选择月"
|
||||
value-format="YYYY-MM"
|
||||
>
|
||||
</el-date-picker
|
||||
></el-config-provider>
|
||||
</div>
|
||||
<el-button style="" type="primary" @click="getData()">查询</el-button>
|
||||
<el-button class="primary" type="primary" @click="resetFormData()"
|
||||
>重置</el-button
|
||||
>
|
||||
<el-button class="primary" type="primary" @click="confirmExport2Excel()"
|
||||
>导出</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="statMonth" align="center" label="月份" />
|
||||
<el-table-column prop="gameName" align="center" label="游戏名称" />
|
||||
<el-table-column prop="totalDuration" align="center" label="总时长" >
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column prop="arDuration" align="center" label="阿拉伯时长" />
|
||||
<el-table-column prop="enDuration" align="center" label="英语区时长" />
|
||||
<el-table-column prop="en2Duration" align="center" label="英语2区时长" />
|
||||
<el-table-column prop="trDuration" align="center" label="土耳其区时长" />
|
||||
<el-table-column prop="zhDuration" align="center" label="华语区时长" />
|
||||
</el-table>
|
||||
<!-- 明细弹窗 -->
|
||||
<el-dialog
|
||||
v-model="dailydetailDialog"
|
||||
title="休闲游戏时长明细"
|
||||
width="30%"
|
||||
center
|
||||
>
|
||||
<el-table
|
||||
:data="dailydetailTable"
|
||||
style="width: 100%"
|
||||
ref="multipleTable"
|
||||
>
|
||||
<el-table-column prop="channel" align="center" label="渠道" />
|
||||
<el-table-column prop="amount" align="center" label="充值金额" />
|
||||
<el-table-column prop="count" align="center" label="充值笔数" />
|
||||
</el-table>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" @click="dailydetailDialog = false">
|
||||
关闭
|
||||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "statisticsIeisureGameDuration",
|
||||
};
|
||||
</script>
|
||||
<script setup>
|
||||
import { ref, onMounted, reactive, computed } from "vue";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { formatDate } from "@/utils/relDate";
|
||||
import { dateFormat } from "@/utils/system-helper";
|
||||
import {
|
||||
mgList,
|
||||
getMinigameListStat,
|
||||
} from "@/api/statisticsIeisureGameDuration/statisticsIeisureGameDuration";
|
||||
import zhCn from "element-plus/dist/locale/zh-cn.mjs";
|
||||
const formData = reactive({
|
||||
month: "",
|
||||
gameId: "",
|
||||
});
|
||||
const tableData = reactive({
|
||||
data: [],
|
||||
total: 0,
|
||||
loading: false,
|
||||
});
|
||||
const gameList = ref([]);
|
||||
const dailydetailDialog = ref(false);
|
||||
// 查询
|
||||
const getData = () => {
|
||||
if(formData.month==''){
|
||||
ElMessage.warning('请选择月份')
|
||||
return;
|
||||
}
|
||||
tableData.loading = true;
|
||||
getMinigameListStat(formData).then((res) => {
|
||||
if (res.code == 200) {
|
||||
tableData.data = res.data;
|
||||
tableData.loading = false;
|
||||
tableData.total = res.total;
|
||||
} else {
|
||||
tableData.loading = false;
|
||||
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
//重置
|
||||
const resetFormData = () => {
|
||||
Object.assign(formData.value, {
|
||||
erbanNoStr: "",
|
||||
channel: "",
|
||||
partitionId: undefined,
|
||||
gameId: "",
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
startTime: "",
|
||||
endTime: "",
|
||||
});
|
||||
tableData.value.dataOuter = [];
|
||||
JSON.parse;
|
||||
};
|
||||
// 导出
|
||||
const confirmExport2Excel = async () => {
|
||||
Object.assign(formData.value, { pageSize: 10000, pageNo: 1 });
|
||||
const {
|
||||
erbanNoStr,
|
||||
channel,
|
||||
endTime,
|
||||
gameId,
|
||||
pageNo,
|
||||
pageSize,
|
||||
partitionId,
|
||||
startTime,
|
||||
} = formData.value;
|
||||
try {
|
||||
const res = await {
|
||||
erbanNoStr,
|
||||
channel,
|
||||
endTime,
|
||||
gameId,
|
||||
pageNo,
|
||||
pageSize,
|
||||
partitionId,
|
||||
startTime,
|
||||
};
|
||||
if (res) {
|
||||
ElMessage({
|
||||
message: "导出成功",
|
||||
type: "success",
|
||||
});
|
||||
let time = formatDate(new Date());
|
||||
let alink = document.createElement("a");
|
||||
alink.download = `game用户汇总${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",
|
||||
});
|
||||
}
|
||||
};
|
||||
onMounted(() => {
|
||||
mgList().then((res) => {
|
||||
if (res.code == 200) {
|
||||
gameList.value = res.data;
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
</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;
|
||||
}
|
||||
|
||||
.selectBoxImg {
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user