Files
peko-admin-web/src/views/luckyTycoon/luckyTycoonUserWinningRecord.vue

220 lines
6.0 KiB
Vue
Raw Normal View History

2024-07-04 20:32:23 +08:00
<template>
<div class="box">
<!-- 查询 -->
<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="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
2024-07-05 15:47:55 +08:00
></el-date-picker>
2024-07-04 20:32:23 +08:00
</div>
</div>
<!-- 查询按钮 -->
<el-button class="primary" type="primary" @click="getData()"
>查询</el-button
>
<!-- 导出按钮 -->
<el-button class="primary" type="primary" @click="derive()">导出</el-button>
</div>
<!-- 表格 -->
<el-table
v-loading="loading"
:data="tableData"
border
style="width: 100%; margin-top: 25px"
>
<el-table-column prop="createTimeStr" align="center" label="时间" />
<el-table-column prop="sendErBanNo" align="center" label="送礼人id" />
<el-table-column prop="sendNick" align="center" label="送礼人昵称" />
<el-table-column prop="receiveErBanNo" align="center" label="收礼人id" />
<el-table-column prop="receiveNick" align="center" label="收礼人昵称" />
<el-table-column prop="luckyBagId" align="center" label="福袋id" />
<el-table-column prop="luckyBagName" align="center" label="福袋昵称" />
<el-table-column prop="destGiftName" align="center" label="礼物名称" />
<el-table-column prop="luckyBagPrice" align="center" label="福袋流水" />
<el-table-column prop="rewardGiftName" align="center" label="奖励名称">
2024-07-05 15:47:55 +08:00
<template #default="{ row }">
{{ row.rewardGiftName || "/" }}
</template>
2024-07-04 20:32:23 +08:00
</el-table-column>
<el-table-column prop="rewardGiftPrice" align="center" label="奖励价值">
2024-07-05 15:47:55 +08:00
<template #default="{ row }">
{{ row.rewardGiftPrice || "/" }}
</template>
</el-table-column>
2024-07-08 14:15:47 +08:00
<!-- <el-table-column prop="x" align="center" label="该用户是否中奖">
2024-07-05 15:47:55 +08:00
<template #default="{ row }">
{{ row.x ? "是" : "否" }}
</template>
2024-07-08 14:15:47 +08:00
</el-table-column> -->
2024-07-04 20:32:23 +08:00
</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"
/>
</template>
2024-07-05 15:47:55 +08:00
2024-07-04 20:32:23 +08:00
<script>
import { getRecordPage, exportForReward } from "@/api/luckyTycoon/luckyTycoon";
import { dateFormat } from "@/utils/system-helper";
import { ElMessage } from "element-plus";
2024-07-05 15:47:55 +08:00
2024-07-04 20:32:23 +08:00
export default {
name: "luckyTycoonUserWinningRecord",
data() {
return {
inquire: {
giftId: "",
userId: "",
time: "",
},
loading: false,
// 表格数据
tableData: [],
// 分页
total: 10, //总页数
currentPage: 1, //页码
pageSize: 10, //条数
};
},
created() {
this.getData();
},
methods: {
getData() {
this.loading = true;
let startTime = "";
let endTime = "";
if (this.inquire.time && this.inquire.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");
}
getRecordPage({
page: this.currentPage,
pageSize: this.pageSize,
rewardGiftId: this.inquire.giftId,
erBanNo: this.inquire.userId,
startTime,
endTime,
2024-07-05 15:47:55 +08:00
})
.then((res) => {
if (res.code === 200) {
this.tableData = res.data.records;
this.total = res.data.total;
} else {
ElMessage({
showClose: true,
message: res.message || "获取数据失败",
type: "error",
});
}
2024-07-04 20:32:23 +08:00
this.loading = false;
2024-07-05 15:47:55 +08:00
})
.catch((error) => {
console.error("请求出错:", error);
2024-07-04 20:32:23 +08:00
ElMessage({
showClose: true,
2024-07-05 15:47:55 +08:00
message: "请求出错,请稍后重试",
2024-07-04 20:32:23 +08:00
type: "error",
});
2024-07-05 15:47:55 +08:00
this.loading = false;
});
2024-07-04 20:32:23 +08:00
},
derive() {
let startTime = "";
let endTime = "";
if (this.inquire.time && this.inquire.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");
}
exportForReward({
rewardGiftId: this.inquire.giftId,
erBanNo: this.inquire.userId,
startTime,
endTime,
2024-07-05 15:47:55 +08:00
})
.then((res) => {
if (res.code === 200) {
// 可以添加导出成功的提示信息
} else {
ElMessage({
showClose: true,
message: res.message || "导出失败",
type: "error",
});
}
})
.catch((error) => {
console.error("导出请求出错:", error);
ElMessage({
showClose: true,
message: "导出请求出错,请稍后重试",
type: "error",
});
});
2024-07-04 20:32:23 +08:00
},
// 分页导航
2024-07-05 15:47:55 +08:00
handleSizeChange(size) {
this.pageSize = size;
2024-07-04 20:32:23 +08:00
this.getData();
},
2024-07-05 15:47:55 +08:00
handleCurrentChange(page) {
this.currentPage = page;
2024-07-04 20:32:23 +08:00
this.getData();
},
},
};
</script>
2024-07-05 15:47:55 +08:00
2024-07-04 20:32:23 +08:00
<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;
}
}
.paginationClass {
margin: 15px 0 5px 0px;
}
}
2024-07-05 15:47:55 +08:00
</style>