Files
peko-admin-web/src/views/luckGift/luckGiftData.vue

543 lines
17 KiB
Vue
Raw Normal View History

2024-09-14 16:05:29 +08:00
<template>
<div class="box">
<!-- ID -->
<div class="condition">
2024-09-14 19:03:04 +08:00
<!-- 分区 -->
<div class="inquire">
<span>分区</span>
2025-03-31 15:45:38 +08:00
<partition-select v-model:partition-id="inquire.value" />
2024-09-14 19:03:04 +08:00
</div>
2024-09-14 16:05:29 +08:00
<div class="inquire">
<span>MoliStar ID</span>
2025-06-18 15:04:58 +08:00
<el-input v-model="inquire.userId"
placeholder=""
class="input">
2024-09-14 16:05:29 +08:00
</el-input>
</div>
<!-- 送出时间 -->
<div class="inquire">
2025-06-18 19:55:24 +08:00
<span>时间</span>
2025-06-18 15:04:58 +08:00
<el-date-picker v-model="inquire.time"
2025-07-08 12:09:50 +08:00
@change="handleDateChange"
2025-06-18 15:04:58 +08:00
type="date"
placeholder="请选择">
2024-09-14 16:05:29 +08:00
</el-date-picker>
</div>
<div class="inquire">
<span>用户充值等级</span>
<el-select v-model="inquire.userRechargeLevel"
placeholder="请选择"
class="select">
<el-option v-for="item in userRechargeLevelList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</div>
2025-06-18 19:55:24 +08:00
<!-- 送出时间 -->
<div class="inquire">
<span>数组类型</span>
<el-select v-model="inquire.poolType"
placeholder="请选择">
<el-option v-for="item in poolTypes"
:key="item.type"
:label="item.name"
:value="item.type">
</el-option>
</el-select>
</div>
2024-09-14 16:05:29 +08:00
</div>
2024-11-20 11:46:58 +08:00
<el-button type="text">总进入{{ totalInput }}</el-button>
<el-button type="text">总退出{{ totalOutput }}</el-button>
2025-06-18 15:04:58 +08:00
<el-button type="text">总比例{{ totalProductionRatio }}</el-button>
2024-09-14 16:05:29 +08:00
<!-- 按钮 -->
<div class="but">
2025-06-18 15:04:58 +08:00
<el-button class="primary"
type="primary"
@click="getData()">查询
2024-09-14 16:05:29 +08:00
</el-button>
2025-06-18 15:04:58 +08:00
<el-button @click="
2024-09-14 16:05:29 +08:00
inquire.userId = '';
inquire.time = '';
2025-06-18 15:04:58 +08:00
">重置筛选
2024-09-14 16:05:29 +08:00
</el-button>
2025-09-27 20:08:17 +08:00
<el-button class="primary"
type="primary"
v-loading="loading"
@click="exportPersonalRecord()">导出</el-button>
2025-06-18 15:04:58 +08:00
<el-button class="primary"
type="primary"
style="margin-left: 20px;"
:disabled="butClick"
@click="
editDialog = true;
type = 12;
editDialogTitle = '赠送1000倍奖励';
value = inquire.x;
2025-06-18 15:04:58 +08:00
">
赠送</el-button>
2024-09-14 16:05:29 +08:00
</div>
2025-04-24 15:53:37 +08:00
<!-- 编辑弹窗 -->
<el-dialog v-model="recordDialog.show"
v-model:title="recordDialog.title"
@close="closeRecordDialog"
label-width="auto"
2025-06-18 15:04:58 +08:00
width="82%"
center>
2025-04-24 15:53:37 +08:00
<!-- 表格 -->
2025-06-18 15:04:58 +08:00
<el-table v-loading="pageRecord.loading"
:data="pageRecord.data"
border
style="width: 100%; margin-top: 25px">
<el-table-column prop="createTime"
align="center"
label="时间" />
<el-table-column prop="partitionDesc"
align="center"
label="分区" />
<el-table-column prop="erbanNo"
align="center"
label="平台id" />
<el-table-column prop="nick"
align="center"
label="昵称" />
<el-table-column prop="receiverErbanNo"
align="center"
label="收礼者平台id" />
<el-table-column prop="receiverNick"
align="center"
label="收礼者昵称" />
<el-table-column prop="roomErbanNo"
align="center"
label="房间id" />
<el-table-column prop="giftId"
align="center"
label="礼物id" />
<el-table-column prop="giftName"
align="center"
label="礼物名称" />
<el-table-column prop="giftGoldPrice"
align="center"
label="礼物价格" />
<el-table-column prop="giftNum"
align="center"
label="数量" />
<el-table-column prop="input"
align="center"
label="进入" />
<el-table-column prop="poolTypeDesc"
align="center"
label="数组类型" />
<el-table-column prop="poolId"
align="center"
label="数组ID" />
<el-table-column prop="expect"
align="center"
label="期望值" />
<el-table-column prop="isSupplement"
align="center"
label="本次是否后台赠送" />
<el-table-column prop="drawMultiple"
align="center"
label="数组倍数" />
<el-table-column prop="afterMultiple"
align="center"
label="最终倍数" />
<el-table-column prop="winGoldNum"
align="center"
label="退出" />
2025-07-01 18:40:28 +08:00
<el-table-column prop="stockResult"
align="center"
label="库存结果" />
2025-04-24 15:53:37 +08:00
</el-table>
<!-- 分页 -->
2025-06-18 15:04:58 +08:00
<el-pagination style="margin-top: 10px"
class="paginationClass"
v-model:current-page="pageRecord.pageNo"
v-model:page-size="pageRecord.pageSize"
:page-sizes="[50, 100, 200, 500]"
layout="sizes, prev, pager, next"
:total="pageRecord.total"
@size-change="handleRecordPageChange"
@current-change="handleRecordPageChange" />
2025-04-24 15:53:37 +08:00
</el-dialog>
2024-09-14 16:05:29 +08:00
<!-- 表格 -->
2025-06-18 15:04:58 +08:00
<el-table v-loading="loading"
:data="tableData"
2025-07-08 12:09:50 +08:00
@sort-change="handleSortChange"
2025-06-18 15:04:58 +08:00
border
style="width: 100%; margin-top: 25px">
<el-table-column prop="date"
align="center"
label="日期" />
<el-table-column prop="uid"
align="center"
label="uid" />
<el-table-column prop="erbanNo"
align="center"
label="平台id" />
<el-table-column prop="userRechargeLevel"
align="center"
label="充值等级" />
2025-06-18 15:04:58 +08:00
<el-table-column prop="totalInput"
2025-07-08 12:09:50 +08:00
:sortable="inquire.sortable"
2025-06-18 15:04:58 +08:00
align="center"
label="进入" />
<el-table-column prop="totalOutput"
2025-07-08 12:09:50 +08:00
:sortable="inquire.sortable"
2025-06-18 15:04:58 +08:00
align="center"
label="退出" />
<el-table-column prop="production"
2025-07-08 12:09:50 +08:00
:sortable="inquire.sortable"
2025-06-18 15:04:58 +08:00
align="center"
label="剩余" />
<el-table-column prop="productionRatio"
2025-07-08 12:09:50 +08:00
:sortable="inquire.sortable"
2025-06-18 15:04:58 +08:00
align="center"
label="退出/进入" />
<el-table-column prop="avgInput"
align="center"
label="每次进入" />
<el-table-column prop="num"
align="center"
label="总次数" />
<el-table-column prop="winNum"
align="center"
label="得到次数" />
<el-table-column prop="winRate"
align="center"
label="得到率" />
<el-table-column align="center"
label="操作"
width="180">
2025-04-24 15:53:37 +08:00
<template v-slot="scope">
2025-06-18 15:04:58 +08:00
<el-button class="primary"
type="primary"
@click="openRecordDialog(scope.row)">明细</el-button>
<el-button v-loading="exportLoading"
@click="exportRecord(scope.row)">导出</el-button>
2025-04-24 15:53:37 +08:00
</template>
</el-table-column>
2024-09-14 16:05:29 +08:00
</el-table>
<!-- 分页 -->
2025-06-18 15:04:58 +08:00
<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" />
<!-- 编辑弹窗 -->
2025-06-18 15:04:58 +08:00
<el-dialog v-model="editDialog"
:title="editDialogTitle"
width="36%"
center>
<div style="margin-bottom: 25px; margin-top: 10px">
2025-06-18 15:04:58 +08:00
<span style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label">{{ editDialogTitle }}</span>
<el-input v-model="value"
style="width: 75%"
class="input"
placeholder="请输入用户ID"></el-input>
</div>
<template #footer>
<span class="dialog-footer">
2025-06-18 15:04:58 +08:00
<el-button @click="
editDialog = false;
butClick = false;
2025-06-18 15:04:58 +08:00
">取消</el-button>
<el-button type="primary"
:disabled="butClick"
@click="editDialogClick()">
保存
</el-button>
</span>
</template>
</el-dialog>
2024-09-14 16:05:29 +08:00
</div>
</template>
<script>
import { listLevel } from '@/api/userRechargeLevel/userRechargeLevel'
2025-09-27 20:08:17 +08:00
import { personal, exportPersonal, updateUserMulti, pageRecord, exportRecord, listType } from "@/api/luckGift/luckGift";
2024-09-14 16:05:29 +08:00
// @ts-ignore
import { dateFormat } from "@/utils/system-helper";
// @ts-ignore
import { ElMessage } from "element-plus";
2025-03-31 15:45:38 +08:00
import PartitionSelect from "@/views/common/partitionSelect.vue";
2024-09-14 16:05:29 +08:00
export default {
name: "luckGiftData",
2025-03-31 15:45:38 +08:00
components: {
PartitionSelect
},
2025-06-18 15:04:58 +08:00
data () {
2024-09-14 16:05:29 +08:00
return {
loading: false,
2024-11-20 11:46:58 +08:00
totalInput: 0,
totalOutput: 0,
totalProductionRatio: 0,
2024-09-14 16:05:29 +08:00
//查询所需条件对象
inquire: {
userId: "",
time: "",
2025-03-31 15:45:38 +08:00
value: undefined,
userRechargeLevel: undefined,
2025-06-18 19:55:24 +08:00
poolType: undefined,
2025-07-08 12:09:50 +08:00
sortable: false,
sortCol: undefined,
sortOrder: undefined
2024-09-14 16:05:29 +08:00
},
userRechargeLevelList: [],
2025-06-18 19:55:24 +08:00
poolTypes: [],
2024-09-14 16:05:29 +08:00
// 表格
tableData: [],
// 分页
total: 10, //总页数
currentPage: 1, //页码
pageSize: 10, //条数
editDialog: false,
editDialogTitle: "",
value: "",
2025-06-18 15:04:58 +08:00
butClick: false,
2025-04-24 15:53:37 +08:00
recordDialog: {
show: false,
title: "",
},
pageRecord: {
uid: undefined,
date: undefined,
2025-06-18 19:55:24 +08:00
poolType: undefined,
2025-04-24 15:53:37 +08:00
loading: false,
data: [],
total: 0,
pageNo: 1,
pageSize: 50,
},
exportLoading: false,
2024-09-14 16:05:29 +08:00
};
},
methods: {
2025-06-18 19:55:24 +08:00
loadPoolTypes () {
listType({ needAll: true }).then((res) => {
if (res.code != 200) {
ElMessage({
showClose: true,
message: res.message,
type: "error",
});
return
}
this.poolTypes = res.data;
this.inquire.poolType = this.poolTypes[0].type
})
},
2024-09-14 16:05:29 +08:00
// 查询接口
2025-06-18 15:04:58 +08:00
getData () {
2025-03-31 15:45:38 +08:00
if (!this.inquire.time && this.inquire.userId === '') {
2024-11-20 11:46:58 +08:00
ElMessage({
showClose: true,
message: "时间和ID至少填一项",
type: "error",
});
return;
}
2024-09-14 16:05:29 +08:00
this.loading = true;
2024-09-14 19:03:04 +08:00
personal({
erbanNo: this.inquire.userId,
pageNo: this.currentPage,
pageSize: this.pageSize,
2024-11-20 11:46:58 +08:00
date: this.inquire.time
2024-11-15 11:15:03 +08:00
? dateFormat(this.inquire.time, "yyyy-MM-dd")
: null,
2024-09-14 19:03:04 +08:00
partitionId: this.inquire.value,
userRechargeLevel: this.inquire.userRechargeLevel,
2025-06-18 19:55:24 +08:00
poolType: this.inquire.poolType ? this.inquire.poolType : undefined,
2025-07-08 12:09:50 +08:00
sortCol: this.inquire.sortCol,
sortOrder: this.inquire.sortOrder
2024-09-14 19:03:04 +08:00
}).then((res) => {
2024-11-20 11:46:58 +08:00
this.total = res.data.dataPage.total;
this.tableData = res.data.dataPage.rows;
this.totalInput = res.data.totalInput;
this.totalOutput = res.data.totalOutput;
this.totalProductionRatio = res.data.totalProductionRatio;
2024-09-14 19:03:04 +08:00
this.loading = false;
});
2024-09-14 16:05:29 +08:00
},
2025-09-27 20:08:17 +08:00
exportPersonalRecord (row) {
this.loading = true;
const params = {
erbanNo: this.inquire.userId,
date: this.inquire.time
? dateFormat(this.inquire.time, "yyyy-MM-dd")
: null,
partitionId: this.inquire.value,
userRechargeLevel: this.inquire.userRechargeLevel,
poolType: this.inquire.poolType ? this.inquire.poolType : undefined,
sortCol: this.inquire.sortCol,
sortOrder: this.inquire.sortOrder
}
exportPersonal(params)
this.loading = false;
},
// 确认保存
2025-06-18 15:04:58 +08:00
editDialogClick () {
this.butClick = true;
updateUserMulti({ erbanNo: this.value }).then((res) => {
if (res.code == 200) {
ElMessage({
showClose: true,
message: "赠送成功",
type: "success",
});
setTimeout(() => {
this.butClick = false;
}, 1000);
this.editDialog = false;
this.getData();
} else {
this.butClick = false;
ElMessage({
showClose: true,
message: res.message,
type: "error",
});
}
});
},
2025-07-08 12:09:50 +08:00
handleDateChange (val) {
if (val && !this.inquire.sortable) {
this.inquire.sortable = 'custom';
this.inquire.sortCol = undefined;
this.inquire.sortOrder = undefined;
}
if (!val && this.inquire.sortable) {
this.inquire.sortable = false;
this.inquire.sortCol = undefined;
this.inquire.sortOrder = undefined;
}
},
handleSortChange (data) {
if (data.order) {
this.inquire.sortCol = data.prop;
this.inquire.sortOrder = data.order == "ascending" ? "asc" : "desc";
} else {
this.inquire.sortCol = undefined;
this.inquire.sortOrder = undefined
}
this.getData();
},
2024-09-14 16:05:29 +08:00
// 分页导航
2025-06-18 15:04:58 +08:00
handleSizeChange () {
2024-09-14 16:05:29 +08:00
this.getData();
},
2025-06-18 15:04:58 +08:00
handleCurrentChange () {
2024-09-14 16:05:29 +08:00
this.getData();
},
2025-06-18 15:04:58 +08:00
openRecordDialog (row) {
2025-04-24 15:53:37 +08:00
this.recordDialog.show = true;
this.recordDialog.title = '[' + row.erbanNo + ']' + row.date + '明细';
this.pageRecord.uid = row.uid;
this.pageRecord.date = row.date;
2025-06-18 19:55:24 +08:00
this.pageRecord.poolType = row.poolType ? row.poolType : undefined;
2025-04-24 15:53:37 +08:00
this.pageRecordData();
},
2025-06-18 15:04:58 +08:00
closeRecordDialog () {
2025-04-24 15:53:37 +08:00
this.recordDialog.show = false;
this.recordDialog.title = undefined;
this.pageRecord.uid = undefined;
this.pageRecord.date = undefined;
2025-06-18 19:55:24 +08:00
this.pageRecord.poolType = undefined;
2025-04-24 15:53:37 +08:00
},
// 分页导航
2025-06-18 15:04:58 +08:00
handleRecordPageChange () {
2025-04-27 20:17:51 +08:00
this.pageRecordData();
2025-04-24 15:53:37 +08:00
},
2025-06-18 15:04:58 +08:00
pageRecordData () {
2025-04-24 15:53:37 +08:00
if (!this.pageRecord.uid && !this.pageRecord.date) {
ElMessage({
showClose: true,
message: "时间和ID至少填一项",
type: "error",
});
return;
}
this.pageRecord.loading = true;
pageRecord({
uid: this.pageRecord.uid,
date: this.pageRecord.date,
2025-06-18 19:55:24 +08:00
poolType: this.pageRecord.poolType,
2025-04-24 15:53:37 +08:00
pageNo: this.pageRecord.pageNo,
pageSize: this.pageRecord.pageSize,
}).then((res) => {
2025-06-18 15:04:58 +08:00
if (res.code !== 200) {
2025-04-24 15:53:37 +08:00
throw new Error(res.msg);
}
this.pageRecord.total = res.data.total;
this.pageRecord.data = res.data.rows;
}).catch((error) => {
ElMessage({
showClose: true,
message: error.message,
type: "error",
});
}).finally(() => {
this.pageRecord.loading = false;
});
},
2025-06-18 15:04:58 +08:00
exportRecord (row) {
2025-04-24 15:53:37 +08:00
this.exportLoading = true;
2025-06-18 15:04:58 +08:00
exportRecord({ uid: row.uid, date: row.date })
2025-04-24 15:53:37 +08:00
this.exportLoading = false;
},
loadUserRechargeLevel () {
listLevel().then(res => {
if (res.code !== 200) {
ElMessage.error(res.message);
return
}
this.userRechargeLevelList = res.data;
//this.inquire.userRechargeLevel = this.userRechargeLevelList[0];
})
},
2024-09-14 16:05:29 +08:00
},
2025-06-18 19:55:24 +08:00
mounted () {
this.loadPoolTypes()
this.loadUserRechargeLevel()
2025-06-18 19:55:24 +08:00
},
2024-09-14 16:05:29 +08:00
};
</script>
<style lang="less" scoped>
.box {
padding-top: 20px;
background: #ecf0f5;
.condition {
margin-bottom: 20px;
.inquire {
display: inline-block;
margin-right: 20px;
span {
margin-right: 10px;
}
.input {
width: 180px;
margin-right: 10px;
}
}
}
.but {
margin-bottom: 20px;
}
}
</style>