Files
peko-admin-web/src/views/superCenter/GoldWaterSuper.vue

285 lines
8.4 KiB
Vue

<template>
<div class="box">
<!-- 时间选择器 -->
<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 00:00:00">
</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 23:59:59">
</el-date-picker>
</div>
</div>
<!-- 公会ID -->
<div class="inquire">
<span>会长ID</span>
<el-input v-model="inquire.id"
placeholder=""
class="input"></el-input>
</div>
<!-- 公会 -->
<!-- 查询按钮 -->
<el-button class="primary"
type="primary"
@click="getData()">查询</el-button>
<!-- 表格 -->
<el-table v-loading="loading"
:data="tableData"
border
style="width: 100%; margin-top: 25px">
<el-table-column prop="ownerErbanNo"
align="center"
label="会长ID" />
<el-table-column prop="name"
align="center"
label="公会名称" />
<el-table-column prop="zoneName"
align="center"
label="公会长所属国家" />
<el-table-column prop="ownerPartitionName"
align="center"
label="会长分区" />
<el-table-column prop="memberNum"
align="center"
label="成员数" />
<el-table-column prop="goldIncome"
align="center"
label="月金币收入(流水)" />
<el-table-column align="center"
label="操作">
<template v-slot="scope">
<el-button @click="ediClick(scope.row)"
type="text"
size="default">查看详情</el-button>
</template>
</el-table-column>
</el-table>
<!-- 内嵌单个工会详情 -->
<el-dialog :title="detailsTitle"
v-model="detailsDialog">
<el-table v-loading="loading"
:data="tableDataDetails"
border
style="width: 100%; margin-top: 25px">
<el-table-column prop="erbanNo"
align="center"
label="用户平台ID"><template v-slot="scope">
{{
scope.row.enable ? scope.row.erbanNo : scope.row.erbanNo + "离开"
}}
</template>
</el-table-column>
<el-table-column prop="nick"
align="center"
label="用户昵称" />
<el-table-column prop="micRemainTime"
align="center"
label="直播时长" />
<el-table-column prop="goldIncome"
align="center"
label="金币收入(流水)" />
<el-table-column prop="sendGiftUserNum"
align="center"
label="送礼人数" />
</el-table>
<!-- 分页 -->
<el-pagination style="margin-top: 10px"
class="paginationClass"
v-model:current-page="detailspageNum"
v-model:page-size="detailspageSize"
:page-sizes="[10, 20, 30, 40, 50, 100, 200, 300, 400, 500, 999999999]"
layout="sizes, prev, pager, next"
:total="detailstotal"
@size-change="detailshandleSizeChange"
@current-change="detailshandleCurrentChange" />
<template #footer>
<div class="dialog-footer">
<el-button @click="detailsDialog = false">关闭</el-button>
</div>
</template>
</el-dialog>
<!-- 分页 -->
<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" />
</div>
</template>
<script>
import {
incomeListFamilyMember,
} from "@/api/nobleman/nobleman";
import {
incomePageFamily
} from "@/api/superCenter/GoldWaterSuper";
// @ts-ignore
import { dateFormat } from "@/utils/system-helper";
// @ts-ignore
import { ElMessage } from "element-plus";
export default {
name: "GoldWaterSuper",
data () {
return {
loading: false,
//查询所需条件对象
inquire: {
time: this.calculateLastSevenDays(),
id: "",
},
// 表格
tableData: [],
// 分页
total: 10, //总页数
currentPage: 1, //页码
pageSize: 10, //条数
// 内嵌单个公会详情
detailsDialog: false,
detailsTitle: "",
tableDataDetails: [],
familyIdEx: "",
detailspageSize: 10,
detailspageNum: 1,
detailstotal: 0
};
},
created () {
// this.getData();
},
methods: {
// 默认七天
calculateLastSevenDays () {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 6);
return [start, end];
},
// 查询接口
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 00:00:00")
: null;
endTime = this.inquire.time[1]
? dateFormat(this.inquire.time[1], "yyyy-MM-dd 23:59:59")
: null;
}
if (!startTime || !endTime) {
ElMessage({
showClose: true,
message: "请输入开始时间和结束时间",
type: "error",
});
this.loading = false;
return;
}
incomePageFamily({
erbanNo: this.inquire.id,
startDate: startTime,
endDate: endTime,
pageNum: this.currentPage,
pageSize: this.pageSize,
}).then((res) => {
if (res.code == 200) {
this.total = res.data.total;
this.tableData = res.data.rows;
this.loading = false;
} else {
ElMessage({
showClose: true,
message: res.message,
type: "error",
});
}
this.loading = false;
});
},
// 查看详情按钮
ediClick (val) {
let time = this.inquire.time;
let startDate = "";
let endDate = "";
if (time && time.length > 0) {
startDate = dateFormat(this.inquire.time[0], "yyyy-MM-dd hh:mm:ss");
endDate = dateFormat(this.inquire.time[1], "yyyy-MM-dd hh:mm:ss");
}
if (val) {
this.detailsTitle = `公会昵称:【${val.name}】 时间:【${val.createTime}】—金币收入明细`;
this.familyIdEx = val.id;
}
incomeListFamilyMember({
endDate,
startDate,
familyId: this.familyIdEx,
pageNum: this.detailspageNum,
pageSize: this.detailspageSize
}).then((res) => {
this.tableDataDetails = res.data.records;
this.detailsDialog = true;
this.detailstotal = res.data.total
});
},
// 分页导航
handleSizeChange () {
this.getData();
},
handleCurrentChange () {
this.getData();
},
detailshandleSizeChange () {
this.ediClick()
},
detailshandleCurrentChange () {
this.ediClick()
}
},
};
</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>