幸运24-后台-关注用户个人数据

This commit is contained in:
2025-09-27 20:59:22 +08:00
parent faaf9332e3
commit 51ed92192a
2 changed files with 518 additions and 0 deletions

View File

@@ -87,3 +87,17 @@ export const exportRecord = query => {
window.location.href = `/admin/lucky24/record/export?${genQueryParam(query)}`;
return;
};
// 个人数据
export const followUserPersonal = query => {
return request({
url: '/admin/lucky24/followUserRecord/personal',
method: 'get',
params: query
});
};
// 个人数据
export const exportFollowUserPersonal = query => {
window.location.href = `/admin/lucky24/followUserRecord/personal/export?${genQueryParam(query)}`;
return;
};

View File

@@ -0,0 +1,504 @@
<template>
<div class="box">
<!-- ID -->
<div class="condition">
<!-- 分区 -->
<div class="inquire">
<span>分区</span>
<partition-select v-model:partition-id="inquire.value" />
</div>
<!-- 送出时间 -->
<div class="inquire">
<span>时间</span>
<el-date-picker v-model="inquire.time"
@change="handleDateChange"
type="date"
placeholder="请选择">
</el-date-picker>
</div>
<!-- 送出时间 -->
<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>
</div>
<el-button type="text">总进入{{ totalInput }}</el-button>
<el-button type="text">总退出{{ totalOutput }}</el-button>
<el-button type="text">总比例{{ totalProductionRatio }}</el-button>
<!-- 按钮 -->
<div class="but">
<el-button class="primary"
type="primary"
@click="getData()">查询
</el-button>
<el-button @click="
inquire.userId = '';
inquire.time = '';
">重置筛选
</el-button>
<el-button class="primary"
type="primary"
v-loading="loading"
@click="exportPersonalRecord()">导出</el-button>
<el-button class="primary"
type="primary"
style="margin-left: 20px;"
:disabled="butClick"
@click="
editDialog = true;
type = 12;
editDialogTitle = '赠送1000倍奖励';
value = inquire.x;
">
赠送</el-button>
</div>
<!-- 编辑弹窗 -->
<el-dialog v-model="recordDialog.show"
v-model:title="recordDialog.title"
@close="closeRecordDialog"
label-width="auto"
width="82%"
center>
<!-- 表格 -->
<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="退出" />
<el-table-column prop="stockResult"
align="center"
label="库存结果" />
</el-table>
<!-- 分页 -->
<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" />
</el-dialog>
<!-- 表格 -->
<el-table v-loading="loading"
:data="tableData"
@sort-change="handleSortChange"
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="充值等级" />
<el-table-column prop="totalInput"
:sortable="inquire.sortable"
align="center"
label="进入" />
<el-table-column prop="totalOutput"
:sortable="inquire.sortable"
align="center"
label="退出" />
<el-table-column prop="production"
:sortable="inquire.sortable"
align="center"
label="剩余" />
<el-table-column prop="productionRatio"
:sortable="inquire.sortable"
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">
<template v-slot="scope">
<el-button class="primary"
type="primary"
@click="openRecordDialog(scope.row)">明细</el-button>
<el-button v-loading="exportLoading"
@click="exportRecord(scope.row)">导出</el-button>
</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" />
<!-- 编辑弹窗 -->
<el-dialog v-model="editDialog"
:title="editDialogTitle"
width="36%"
center>
<div style="margin-bottom: 25px; margin-top: 10px">
<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">
<el-button @click="
editDialog = false;
butClick = false;
">取消</el-button>
<el-button type="primary"
:disabled="butClick"
@click="editDialogClick()">
保存
</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script>
import { followUserPersonal, exportFollowUserPersonal, updateUserMulti, pageRecord, exportRecord, listType } from "@/api/luckGift/luckGift";
// @ts-ignore
import { dateFormat } from "@/utils/system-helper";
// @ts-ignore
import { ElMessage } from "element-plus";
import PartitionSelect from "@/views/common/partitionSelect.vue";
export default {
name: "luckGiftFollowUserData",
components: {
PartitionSelect
},
data () {
return {
loading: false,
totalInput: 0,
totalOutput: 0,
totalProductionRatio: 0,
//查询所需条件对象
inquire: {
time: "",
value: undefined,
poolType: undefined,
sortable: false,
sortCol: undefined,
sortOrder: undefined
},
poolTypes: [],
// 表格
tableData: [],
// 分页
total: 20, //总页数
currentPage: 1, //页码
pageSize: 20, //条数
editDialog: false,
editDialogTitle: "",
value: "",
butClick: false,
recordDialog: {
show: false,
title: "",
},
pageRecord: {
uid: undefined,
date: undefined,
poolType: undefined,
loading: false,
data: [],
total: 0,
pageNo: 1,
pageSize: 50,
},
exportLoading: false,
};
},
methods: {
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
})
},
// 查询接口
getData () {
if (!this.inquire.time) {
ElMessage({
showClose: true,
message: "时间需要填",
type: "error",
});
return;
}
this.loading = true;
followUserPersonal({
pageNo: this.currentPage,
pageSize: this.pageSize,
date: this.inquire.time
? dateFormat(this.inquire.time, "yyyy-MM-dd")
: null,
partitionId: this.inquire.value,
poolType: this.inquire.poolType ? this.inquire.poolType : undefined,
sortCol: this.inquire.sortCol,
sortOrder: this.inquire.sortOrder
}).then((res) => {
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;
this.loading = false;
});
},
exportPersonalRecord () {
this.loading = true;
const params = {
date: this.inquire.time
? dateFormat(this.inquire.time, "yyyy-MM-dd")
: null,
partitionId: this.inquire.value,
poolType: this.inquire.poolType ? this.inquire.poolType : undefined,
sortCol: this.inquire.sortCol,
sortOrder: this.inquire.sortOrder
}
exportFollowUserPersonal(params)
this.loading = false;
},
// 确认保存
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",
});
}
});
},
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();
},
// 分页导航
handleSizeChange () {
this.getData();
},
handleCurrentChange () {
this.getData();
},
openRecordDialog (row) {
this.recordDialog.show = true;
this.recordDialog.title = '[' + row.erbanNo + ']' + row.date + '明细';
this.pageRecord.uid = row.uid;
this.pageRecord.date = row.date;
this.pageRecord.poolType = row.poolType ? row.poolType : undefined;
this.pageRecordData();
},
closeRecordDialog () {
this.recordDialog.show = false;
this.recordDialog.title = undefined;
this.pageRecord.uid = undefined;
this.pageRecord.date = undefined;
this.pageRecord.poolType = undefined;
},
// 分页导航
handleRecordPageChange () {
this.pageRecordData();
},
pageRecordData () {
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,
poolType: this.pageRecord.poolType,
pageNo: this.pageRecord.pageNo,
pageSize: this.pageRecord.pageSize,
}).then((res) => {
if (res.code !== 200) {
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;
});
},
exportRecord (row) {
this.exportLoading = true;
exportRecord({ uid: row.uid, date: row.date })
this.exportLoading = false;
},
},
mounted () {
this.loadPoolTypes()
},
};
</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>