This commit is contained in:
yziiy
2025-12-18 17:05:31 +08:00
parent d22738918e
commit e175b2800d
7 changed files with 281 additions and 5 deletions

View File

@@ -110,4 +110,9 @@ export const querySingerSongList = data => {
return http.request<Result>("post", "/adminapi/SingerSong/singerSongList", {
data
});
}
export const findUserData = data => {
return http.request<Result>("post", "/adminapi/User/cancel_user_recovery", {
data
});
}

View File

@@ -45,4 +45,12 @@ export const queryRoomFlowRankList = params => {
"/adminapi/Statistical/get_room_flow_statistics",
{ params }
);
};
// 任务领取记录
export const taskRankList = params => {
return http.request<Result>(
"get",
"/adminapi/Statistical/task_statistics",
{ params }
);
};

View File

@@ -18,7 +18,7 @@ export function useData() {
},
{
label: "用户Id",
prop: "user_id"
prop: "user_code"
},
{
label: "用户名称",

View File

@@ -0,0 +1,174 @@
import { ref, h } from "vue";
import { utils, writeFile } from "xlsx";
import ExportForm from '@/components/exportDialog/index.vue';
import { addDialog } from "@/components/ReDialog";
import { message } from "@/utils/message";
import {
taskRankList
} from "@/api/modules/statistics";
export function useData() {
const loading = ref(true);
const tableList = ref([]);
const isShow = ref(false);
const total_price = ref(0)
const pagination = ref({
total: 0,
pageSize: 10,
pageSizes: [10, 20, 50, 100],
currentPage: 1,
background: true
});
const searchForm = ref({
search_uid: "",
search_name: "",
search_task_id: '',
search_task_name: '',
begin_time: "",
end_time: ""
});
const searchLabel = ref([
{ label: "用户ID", prop: "search_uid", type: "input" },
{ label: "用户昵称", prop: "search_name", type: "input" },
{ label: "任务ID", prop: "search_task_id", type: "input" },
{ label: "任务昵称", prop: "search_task_name", type: "input" },
{ label: "开始时间", prop: "begin_time", type: "date" },
{ label: "结束时间", prop: "end_time", type: "date" },
]);
const tableLabel = ref([
{
label: "用户ID",
prop: "user_code"
},
{
label: "用户名称",
prop: "nickname"
},
{
label: "完成任务时间",
prop: "createtime"
},
{
label: "任务名称",
prop: "task_name"
},
{
label: "领取状态",
prop: "is_completed_str",
cellRenderer: ({ row }) => (
<el-tag type={row.is_completed == 0 ? 'error' : 'success'}>{row.is_completed == 0 ? '未领取' : '已领取'}</el-tag>
)
},
{
label: "奖励内容",
prop: "reward_str"
},
{
label: "奖励价值",
prop: "reward_price"
}
]);
const onSearch = async (formData) => {
loading.value = true;
searchForm.value = { ...formData }
const { data, code } = await taskRankList({
...formData,
page: pagination.value.currentPage,
page_limit: pagination.value.pageSize,
});
if (code) {
tableList.value = data.lists.map(ele => {
return {
...ele
}
});
total_price.value = data.total_reward_price
pagination.value.total = data.count;
pagination.value.currentPage = data.page;
}
loading.value = false;
};
const handleSizeChange = (val: number) => {
pagination.value.pageSize = val;
onSearch(searchForm.value);
};
const handleCurrentChange = (val: number) => {
pagination.value.currentPage = val;
onSearch(searchForm.value);
};
const exportFormRef = ref(null)
const exportExcel = () => {
let exportTableList = []
addDialog({
title: `导出数据`,
props: {
formInline: {
time: ''
}
},
width: "40%",
closeOnClickModal: false,
contentRenderer: () => h(ExportForm, { ref: exportFormRef, formInline: null }),
beforeSure: (done, { options }) => {
const FormRef = exportFormRef.value.getRef();
const curData = options.props.formInline;
const exportData = async (formData) => {
const { data, code } = await taskRankList({
...formData,
page: 1,
page_limit: 20000
});
if (code) {
exportTableList = data.lists;
const res = exportTableList.map(item => {
const arr = [];
tableLabel.value.forEach(column => {
arr.push(item[column.prop as string]);
});
return arr;
});
const titleList = [];
tableLabel.value.forEach(column => {
titleList.push(column.label);
});
res.unshift(titleList);
const workSheet = utils.aoa_to_sheet(res);
const workBook = utils.book_new();
utils.book_append_sheet(workBook, workSheet, "数据报表");
writeFile(workBook, `任务领取记录统计${formData.begin_time} - ${formData.end_time}.xlsx`);
message("导出成功", {
type: "success"
});
done()
} else {
message("获取数据失败,请重试!", {
type: "error"
});
}
}
FormRef.validate(valid => {
if (valid) {
if (curData.time && curData.time.length) {
exportData({ begin_time: curData.time[0] || '', end_time: curData.time[1] || '' })
}
}
});
}
});
}
return {
searchForm,
searchLabel,
onSearch,
isShow,
tableList,
tableLabel,
pagination,
handleSizeChange,
handleCurrentChange,
loading,
total_price,
exportExcel
};
}

View File

@@ -0,0 +1,56 @@
<script setup lang="ts">
import { onMounted } from "vue";
import { useData } from "./hook";
import SearchForm from "@/components/SearchForm/index.vue";
import { PureTableBar } from "@/components/RePureTableBar";
import { deviceDetection } from "@pureadmin/utils";
const {
searchLabel,
searchForm,
total_price,
onSearch,
isShow,
tableList,
pagination,
tableLabel,
exportExcel,
handleSizeChange,
handleCurrentChange,
loading
} = useData();
onMounted(() => {
onSearch(searchForm.value);
});
defineOptions({
name: "giftRecord"
});
</script>
<template>
<div class="main">
<SearchForm class="pb-2" :LabelList="searchLabel" :formData="searchForm" @handleSearch="onSearch" />
<div ref="contentRef" :class="['flex', deviceDetection() ? 'flex-wrap' : '']">
<PureTableBar title="任务领取记录" :class="[isShow && !deviceDetection() ? '!w-[60vw]' : 'w-full']"
:columns="tableLabel" @refresh="onSearch">
<template #buttons>
<div style="display: inline-flex;align-items: center;" class="mr-10">奖励合计价值<span
style="color: red;margin-right: 5px;">{{
total_price }}</span> 金币</div>
<el-button type="primary" @click="exportExcel">
导出
</el-button>
</template>
<template v-slot="{ size, dynamicColumns }">
<pure-table ref="tableRef" align-whole="center" showOverflowTooltip table-layout="auto" default-expand-all
:loading="loading" :size="size" row-key="id" adaptive :adaptiveConfig="{ offsetBottom: 108 }"
:data="tableList" :columns="dynamicColumns" :pagination="{ ...pagination, size }" :header-cell-style="{
background: 'var(--el-fill-color-light)',
color: 'var(--el-text-color-primary)'
}" @page-current-change="handleCurrentChange" @page-size-change="handleSizeChange">
</pure-table>
</template>
</PureTableBar>
</div>
</div>
</template>
<style scoped lang="scss"></style>

View File

@@ -17,7 +17,8 @@ import {
changePassWordByUser,
setMoneyByUser,
officialUserData,
banUserData
banUserData,
findUserData
} from "@/api/modules/newuserList";
import { addDialog } from "@/components/ReDialog";
// import { object } from "vue-types";
@@ -35,6 +36,10 @@ export function useData() {
const loading = ref(true);
const tableList = ref([]);
const isShow = ref(false);
const totalPrice = ref({
total_coin: 0,
total_earnings: 0
})
const pagination = ref({
total: 0,
pageSize: 10,
@@ -144,7 +149,7 @@ export function useData() {
label: "登录状态",
prop: "status",
cellRenderer: ({ row }) => (
<el-tag type={row.status == 2 ? 'error' : 'success'}>{row.status_str}</el-tag>
<el-tag type={row.status == 0 ? 'error' : row.status == 2 ? 'warn' : 'success'}>{row.status_str}</el-tag>
)
},
{
@@ -171,6 +176,8 @@ export function useData() {
if (code) {
tableList.value = data.lists;
pagination.value.total = data.count;
totalPrice.value.total_coin = data.total_coin;
totalPrice.value.total_earnings = data.total_earnings;
pagination.value.currentPage = +data.page;
}
loading.value = false;
@@ -473,6 +480,17 @@ export function useData() {
// });
}
// 找回账号
const FindData = async (rowData) => {
// console.log(rowData)
const { code } = await findUserData({ mobile: rowData.mobile });
if (code) {
message(`操作成功`, {
type: "success"
});
onSearch(searchForm.value);
}
}
// 修改密码
const changePassword = async (rowData: any) => {
addDialog({
@@ -532,6 +550,8 @@ export function useData() {
onSeniorSearch,
resetFieldsSearch,
exportExcel,
changeSearchValue
changeSearchValue,
FindData,
totalPrice
};
}

View File

@@ -25,7 +25,9 @@ const {
onSeniorSearch,
resetFieldsSearch,
exportExcel,
changeSearchValue
changeSearchValue,
FindData,
totalPrice
} = useData();
defineOptions({
name: "newuserList"
@@ -53,6 +55,10 @@ onMounted(() => {
<PureTableBar title="会员列表" :class="[isShow && !deviceDetection() ? '!w-[60vw]' : 'w-full']" :columns="tableLabel"
@refresh="onSearch">
<template #buttons>
<div style="display: inline-flex;align-items: center;" class="mr-10">当前平台用户总计<span
style="color: red;margin-right: 5px;">{{
totalPrice.total_coin }}</span> 金币<span style="color: red;margin-right: 5px;">{{
totalPrice.total_earnings }}</span> 钻石</div>
<el-button type="primary" @click="exportExcel">
导出
</el-button>
@@ -71,6 +77,13 @@ onMounted(() => {
<el-button link type="primary" @click="viewDetail(row)">
查看
</el-button>
<el-popconfirm :title="`是否找回账号`" @confirm="FindData(row)">
<template #reference>
<el-button v-if="row.status == 0" link type="primary">
找回
</el-button>
</template>
</el-popconfirm>
<el-button link type="primary" @click="handleBanData(row)">
{{ row.status == 2 ? '解封' : '禁用' }}
</el-button>