376 lines
11 KiB
Vue
376 lines
11 KiB
Vue
<template>
|
|
<div class="box">
|
|
<div class="inquire">
|
|
<span>分区</span>
|
|
<partition-select v-model:partition-id="formData.partitionId" />
|
|
</div>
|
|
<div class="inquire">
|
|
<span>活动</span>
|
|
<el-select v-model="formData.actKey" placeholder="请选择">
|
|
<el-option
|
|
v-for="item in actKeysArr"
|
|
:key="item.actKey"
|
|
:label="item.actName || item.actKey"
|
|
:value="item.actKey"
|
|
>
|
|
</el-option>
|
|
</el-select>
|
|
</div>
|
|
<div class="inquire">
|
|
<span class="demonstration">日期</span>
|
|
<el-date-picker
|
|
v-model="dataTime"
|
|
type="daterange"
|
|
range-separator="至"
|
|
start-placeholder="开始日期"
|
|
end-placeholder="结束日期"
|
|
value-format="YYYY-MM-DD"
|
|
>
|
|
</el-date-picker>
|
|
</div>
|
|
<el-button style="" type="primary" @click="getData()">查询</el-button>
|
|
<el-button style="" 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="statDate" align="center" label="日期" />
|
|
<el-table-column prop="actName" align="center" label="活动" />
|
|
<el-table-column prop="totalUserNum" align="center" label="总参与人数" />
|
|
<el-table-column prop="actUserNum" align="center" label="独立参与人数" />
|
|
<el-table-column prop="actNum" align="center" label="参与总次数" />
|
|
<!-- <el-table-column prop="guildNum" align="center" label="旗下公会数量">
|
|
<template v-slot="scope">
|
|
<el-button type="text" size="small" @click="editFen(scope.row)">
|
|
{{ scope.row.guildNum }}
|
|
</el-button>
|
|
</template>
|
|
</el-table-column> -->
|
|
<el-table-column prop="perValue" align="center" label="人均参与次数" />
|
|
<el-table-column prop="actValue" align="center" label="榜单总值" />
|
|
|
|
<el-table-column prop="topTen" align="center" label="榜单前10用户">
|
|
<template v-slot="scope">
|
|
<el-button
|
|
type="text"
|
|
size="small"
|
|
@click="
|
|
editTopTen(scope.row);
|
|
detailsTypeDialog = 0;
|
|
"
|
|
>
|
|
{{ scope.row.topTen }}
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="newUserNum" align="center" label="新用户数">
|
|
<template v-slot="scope">
|
|
<el-button
|
|
type="text"
|
|
size="small"
|
|
@click="
|
|
editNewUserNum(scope.row);
|
|
detailsTypeDialog = 1;
|
|
"
|
|
>
|
|
{{ scope.row.newUserNum }}
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="chargeUserNum" align="center" label="充值人数" />
|
|
<el-table-column prop="chargeGoldNum" align="center" label="充值金额" />
|
|
</el-table>
|
|
<!-- 分页 -->
|
|
<el-pagination
|
|
style="margin-top: 10px"
|
|
class="paginationClass"
|
|
:current-page="formData.pageNo"
|
|
:page-size="formData.pageSize"
|
|
:page-sizes="[10, 20, 50, 100, 200]"
|
|
layout="sizes, prev, pager, next"
|
|
:total="tableData.total"
|
|
@size-change="handleSizeChange"
|
|
@current-change="handleCurrentChange"
|
|
/>
|
|
<!-- 详情表格 -->
|
|
<el-dialog
|
|
v-model="detailsDialog"
|
|
:title="detailsTypeDialog == 0 ? '榜单详情' : '新用户详情'"
|
|
width="70%"
|
|
center
|
|
>
|
|
<!-- 内表格 -->
|
|
<el-table
|
|
v-loading="tableDetailData.loading"
|
|
:data="tableDetailData.data"
|
|
border
|
|
style="width: 100%; margin-top: 25px"
|
|
>
|
|
<template v-if="detailsTypeDialog == 0">
|
|
<el-table-column prop="erbanNo" align="center" label="用户ID" />
|
|
<el-table-column prop="nick" align="center" label="用户昵称" />
|
|
<el-table-column
|
|
prop="partitionDesc"
|
|
align="center"
|
|
label="用户分区"
|
|
/>
|
|
<el-table-column prop="regionName" align="center" label="国家" />
|
|
<el-table-column prop="rank" align="center" label="榜单排行" />
|
|
<el-table-column prop="actValue" align="center" label="榜单数值" />
|
|
</template>
|
|
<template v-if="detailsTypeDialog == 1">
|
|
<el-table-column prop="erbanNo" align="center" label="用户ID" />
|
|
<el-table-column prop="nick" align="center" label="用户昵称" />
|
|
<el-table-column
|
|
prop="partitionDesc"
|
|
align="center"
|
|
label="用户分区"
|
|
/>
|
|
<el-table-column prop="signTime" align="center" label="注册时间" />
|
|
<el-table-column
|
|
prop="chargeGoleNum"
|
|
align="center"
|
|
label="充值金额"
|
|
/>
|
|
</template>
|
|
</el-table>
|
|
<!-- 分页 -->
|
|
<el-pagination
|
|
style="margin-top: 10px"
|
|
class="paginationClass"
|
|
:current-page="formDetailData.pageNo"
|
|
:page-size="formDetailData.pageSize"
|
|
:page-sizes="[10, 20, 50, 100, 200]"
|
|
layout="sizes, prev, pager, next"
|
|
:total="tableDetailData.total"
|
|
@size-change="handleSizeChangeDetail"
|
|
@current-change="handleCurrentChangeDetail"
|
|
/>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { ref, onMounted, reactive, computed } from "vue";
|
|
import PartitionSelect from "@/views/common/partitionSelect.vue";
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
import { formatDate } from "@/utils/relDate";
|
|
import {
|
|
getActKeysList,
|
|
getDataList,
|
|
getNewUsersList,
|
|
getRankList,
|
|
exportActivityDayTotal,
|
|
} from "@/api/basicActivityData/basicActivityData";
|
|
export default {
|
|
name: "basicActivityData",
|
|
components: {
|
|
PartitionSelect,
|
|
},
|
|
setup() {
|
|
const formData = reactive({
|
|
partitionId: undefined,
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
startDate: "",
|
|
endDate: "",
|
|
actKey: "",
|
|
});
|
|
const tableData = reactive({
|
|
data: [],
|
|
total: 0,
|
|
loading: false,
|
|
});
|
|
const formDetailData = reactive({
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
partitionId: "",
|
|
actKey: "",
|
|
statDate: "",
|
|
});
|
|
const tableDetailData = reactive({
|
|
data: [],
|
|
total: 0,
|
|
loading: false,
|
|
});
|
|
const detailsDialog = ref(false);
|
|
const detailsTypeDialog = ref(0); //0榜单详情 1新用户详情
|
|
const dataTime = ref("");
|
|
const actKeysArr = ref([]);
|
|
const getData = () => {
|
|
tableData.loading = true;
|
|
if (dataTime.value && dataTime.value.length > 0) {
|
|
formData.startDate = dataTime.value[0];
|
|
formData.endDate = dataTime.value[1];
|
|
console.log(dataTime.value);
|
|
} else {
|
|
formData.startDate = dataTime.value;
|
|
formData.endDate = dataTime.value;
|
|
}
|
|
getDataList(formData).then((res) => {
|
|
if (res.code == 200) {
|
|
tableData.data = res.data.rows;
|
|
tableData.total = res.data.total;
|
|
tableData.loading = false;
|
|
} else {
|
|
tableData.loading = false;
|
|
ElMessage.error(res.message);
|
|
}
|
|
});
|
|
};
|
|
// 导出
|
|
const confirmExport2Excel = async () => {
|
|
// Object.assign(formData, { pageSize: 10000, pageNo: 1 });
|
|
try {
|
|
const res = await exportActivityDayTotal(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",
|
|
});
|
|
}
|
|
};
|
|
// 榜单详情
|
|
const editTopTen = (row) => {
|
|
if (row) {
|
|
formDetailData.actKey = row.actKey;
|
|
formDetailData.partitionId = formData.partitionId;
|
|
formDetailData.statDate = row.statDate;
|
|
}
|
|
tableDetailData.loading = true;
|
|
getRankList(formDetailData).then((res) => {
|
|
if (res.code == 200) {
|
|
tableDetailData.data = res.data.rows;
|
|
tableDetailData.total = res.data.total;
|
|
tableDetailData.loading = false;
|
|
detailsDialog.value = true;
|
|
} else {
|
|
tableDetailData.loading = false;
|
|
ElMessage.error(res.message);
|
|
}
|
|
});
|
|
};
|
|
// 新用户详情
|
|
const editNewUserNum = (row) => {
|
|
if (row) {
|
|
formDetailData.actKey = row.actKey;
|
|
formDetailData.partitionId = formData.partitionId;
|
|
formDetailData.statDate = row.statDate;
|
|
}
|
|
tableDetailData.loading = true;
|
|
getNewUsersList(formDetailData).then((res) => {
|
|
if (res.code == 200) {
|
|
tableDetailData.data = res.data.rows;
|
|
tableDetailData.total = res.data.total;
|
|
tableDetailData.loading = false;
|
|
detailsDialog.value = true;
|
|
} else {
|
|
tableDetailData.loading = false;
|
|
ElMessage.error(res.message);
|
|
}
|
|
});
|
|
};
|
|
|
|
const handleSizeChange = (val) => {
|
|
formData.pageSize = val;
|
|
getData();
|
|
};
|
|
const handleCurrentChange = (val) => {
|
|
formData.pageNo = val;
|
|
getData();
|
|
};
|
|
const handleSizeChangeDetail = (val) => {
|
|
formDetailData.pageSize = val;
|
|
if (detailsTypeDialog.value == 0) {
|
|
editTopTen();
|
|
} else {
|
|
editNewUserNum();
|
|
}
|
|
};
|
|
const handleCurrentChangeDetail = (val) => {
|
|
formDetailData.pageNo = val;
|
|
if (detailsTypeDialog.value == 0) {
|
|
editTopTen();
|
|
} else {
|
|
editNewUserNum();
|
|
}
|
|
};
|
|
onMounted(() => {
|
|
getActKeysList().then((res) => {
|
|
actKeysArr.value = res.data;
|
|
});
|
|
});
|
|
return {
|
|
formData,
|
|
tableData,
|
|
dataTime,
|
|
getData,
|
|
handleSizeChange,
|
|
handleCurrentChange,
|
|
confirmExport2Excel,
|
|
actKeysArr,
|
|
detailsDialog,
|
|
tableDetailData,
|
|
formDetailData,
|
|
editTopTen,
|
|
handleSizeChangeDetail,
|
|
handleCurrentChangeDetail,
|
|
editNewUserNum,
|
|
detailsTypeDialog,
|
|
};
|
|
},
|
|
};
|
|
</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;
|
|
}
|
|
}
|
|
</style>
|