Files
peko-admin-web/src/views/guildOperationManagement/DailyTaskRewardCollection.vue

281 lines
6.8 KiB
Vue

<template>
<div class="box">
<!-- 表格数据 -->
<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="reachNum"
align="center"
label="公会成员达到人数"
/>
<el-table-column
prop="receiveNum"
align="center"
label="公会成员领取人数"
>
<template v-slot="scope">
<el-button @click="detailFun(scope.row)" type="text" size="small">
{{ scope.row.receiveNum }}
</el-button>
</template>
</el-table-column>
<el-table-column
prop="guildMemberNumn"
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="dailydetailDialog"
title="日任务奖励领取明细"
width="60%"
center
>
<div>
<div class="inquire">
<span>用户ID:</span>
<el-input v-model="detailData.erbanNo" placeholder="" class="input" />
</div>
<div class="inquire">
<span>设备:</span>
<el-input
v-model="detailData.deviceId"
placeholder="支持模糊搜索"
class="input"
/>
</div>
<div class="inquire">
<span>IP:</span>
<el-input
v-model="detailData.ip"
placeholder="支持模糊搜索"
class="input"
/>
</div>
<el-button style="" type="primary" @click="detailFun()">查询</el-button>
<el-button style="" type="primary" @click="confirmExport2Excel()"
>导出</el-button
>
</div>
<el-table
:data="detailtableData.data"
style="width: 100%; margin-top: 30px"
ref="multipleTable"
border
>
<el-table-column prop="guildId" align="center" label="公会ID" />
<el-table-column prop="erbanNo" align="center" label="用户ID" />
<el-table-column prop="uid" align="center" label="用户UID" />
<el-table-column prop="deviceId" align="center" label="领取设备" />
<el-table-column prop="ip" align="center" label="领取IP" />
<el-table-column prop="statusStr" align="center" label="主播状态" />
<el-table-column prop="receiveTime" align="center" label="领取时间" />
</el-table>
<el-pagination
style="margin-top: 10px"
class="paginationClass"
:current-page="detailData.pageNo"
:page-size="detailData.pageSize"
:page-sizes="[10, 20, 50, 100, 200]"
layout="sizes, prev, pager, next"
:total="detailtableData.total"
@size-change="handleSizeChangeDetail"
@current-change="handleCurrentChangeDetail"
/>
<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: "DailyTaskRewardCollection",
};
</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 {
getDailyTaskCoinRecvNums,
getDailyTaskcoinRecvDetail,
exportMiniGameDetail,
} from "@/api/DailyTaskRewardCollection/DailyTaskRewardCollection";
const formData = reactive({
pageNo: 1,
pageSize: 10,
});
const tableData = reactive({
data: [],
total: 0,
loading: false,
});
const detailData = reactive({
partitionId: "",
statDate: "",
pageNo: 1,
pageSize: 10,
deviceId: "",
ip: "",
erbanNo: "",
});
const detailtableData = reactive({
data: [],
total: 0,
loading: false,
});
const dailydetailDialog = ref(false);
// 查询
const getData = () => {
tableData.loading = true;
getDailyTaskCoinRecvNums(formData).then((res) => {
if (res.code == 200) {
tableData.data = res.data.rows;
tableData.loading = false;
tableData.total = res.data.total;
} else {
tableData.loading = false;
ElMessage.error(res.message);
}
});
};
// 明细
const detailFun = (row) => {
if (row) {
detailData.partitionId = row.partitionId;
detailData.statDate = row.statDate;
}
getDailyTaskcoinRecvDetail(detailData).then((res) => {
if (res.code == 200) {
detailtableData.data = res.data.rows;
detailtableData.loading = false;
detailtableData.total = res.data.total;
dailydetailDialog.value = true;
} else {
ElMessage.error(res.message);
}
});
};
// 导出
const confirmExport2Excel = async () => {
try {
const res = await exportMiniGameDetail(detailData);
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 handleSizeChange = (val) => {
formData.pageSize = val;
getData();
};
const handleCurrentChange = (val) => {
formData.pageNo = val;
getData();
};
const handleSizeChangeDetail = (val) => {
detailData.pageSize = val;
detailFun();
};
const handleCurrentChangeDetail = (val) => {
detailData.pageNo = val;
detailFun();
};
onMounted(() => {
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;
}
.selectBoxImg {
height: 150px;
}
.avatar {
width: 178px;
height: 178px;
display: block;
}
</style>