Files
peko-admin-web/src/views/wishingStar/userParticipationRecord.vue
2024-02-27 21:39:13 +08:00

188 lines
5.2 KiB
Vue

<template>
<div class="box">
<!-- 查询 -->
<div class="inquire">
<span>轮次ID </span>
<el-input v-model="inquire.turnId" placeholder="" class="input"></el-input>
</div>
<div class="inquire">
<span>礼物ID </span>
<el-input v-model="inquire.giftId" placeholder="" class="input"></el-input>
</div>
<div class="inquire">
<span>用户ID</span>
<el-input v-model="inquire.userId" placeholder="" class="input"></el-input>
</div>
<div class="inquire">
<div class="block">
<span class="demonstration">轮次时间</span>
<el-date-picker
v-model="inquire.time"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</div>
</div>
<!-- 查询按钮 -->
<el-button type="primary" @click="getData()">查询</el-button>
<el-button type="primary" @click="derive()">导出</el-button>
<!-- 表格 -->
<el-table
v-loading="loading"
:data="tableData"
border
style="width: 100%; margin-top: 25px"
>
<el-table-column prop="createTime" align="center" label="参与时间" />
<el-table-column prop="erbanNo" align="center" label="用户id" />
<el-table-column prop="nick" align="center" label="用户昵称" />
<el-table-column align="center" label="轮次信息">
<template v-slot="scope">
<div>轮次id: {{ scope.row.roundId }}</div>
<div>轮次礼物: {{ scope.row.giftName }}</div>
<div>礼物价值: {{ scope.row.giftPrice }}</div>
<div>需要魔法棒: {{ scope.row.targetNum }}</div>
<div>{{ scope.row.roundStatus == 0 ? "轮次进行中" : "轮次已结束" }}</div>
</template>
</el-table-column>
<el-table-column prop="stickNum" align="center" label="参与魔法棒数量" />
<el-table-column align="center" label="该用户本轮是否中奖">
<template v-slot="scope">
{{ scope.row.winnerUid ? (scope.row.isWin ? "" : "") : "-" }}
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<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 {
promiseStarUserRecordPage,
promiseStarUserRecordExport,
// @ts-ignore
} from "@/api/wishingStar/wishingStar";
// @ts-ignore
import { dateFormat } from "@/utils/system-helper";
// @ts-ignore
import { ElMessage } from "element-plus";
export default {
name: "userParticipationRecord",
data() {
return {
loading: false,
//查询所需条件对象
inquire: {
turnId: "",
giftId: "",
userId: "",
time: "",
},
// 表格
tableData: [],
// 分页
total: 10, //总页数
currentPage: 1, //页码
pageSize: 10, //条数
};
},
created() {
this.getData();
},
methods: {
// 查询接口
getData() {
this.loading = true;
let time = this.inquire.time;
let startTime = "";
let endTime = "";
if (time && time.length > 0) {
startTime = dateFormat(this.inquire.time[0], "yyyy-MM-dd hh:mm:ss");
endTime = dateFormat(this.inquire.time[1], "yyyy-MM-dd hh:mm:ss");
}
console.log(this.inquire);
promiseStarUserRecordPage({
roundId: this.inquire.turnId,
giftId: this.inquire.giftId,
erbanNo: this.inquire.userId,
startTime: startTime,
endTime: endTime,
page: this.currentPage,
pageSize: this.pageSize,
}).then((res) => {
this.tableData = res.data.records;
this.total = res.data.total;
this.loading = false;
});
},
// 导出按钮
derive() {
let time = this.inquire.time;
let startTime = "";
let endTime = "";
if (time && time.length > 0) {
startTime = dateFormat(this.inquire.time[0], "yyyy-MM-dd hh:mm:ss");
endTime = dateFormat(this.inquire.time[1], "yyyy-MM-dd hh:mm:ss");
}
promiseStarUserRecordExport({
roundId: this.inquire.turnId,
giftId: this.inquire.giftId,
erbanNo: this.inquire.userId,
startTime: startTime,
endTime: endTime,
page: this.currentPage,
pageSize: this.pageSize,
}).then(() => {});
},
// 分页导航
handleSizeChange() {
this.getData();
},
handleCurrentChange() {
this.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;
}
}
</style>