This commit is contained in:
yziiy
2025-12-25 17:27:26 +08:00
parent a646828528
commit 1df7bfc26f
5 changed files with 211 additions and 71 deletions

View File

@@ -115,4 +115,17 @@ export const findUserData = data => {
return http.request<Result>("post", "/adminapi/User/cancel_user_recovery", {
data
});
}
// 家族成员
export const familyListData = params => {
return http.request<Result>(
"get",
"/adminapi/User/get_family_member",
{ params }
);
}
export const bandFamilyUser = data => {
return http.request<Result>("post", "/adminapi/User/cancel_contract", {
data
});
}

View File

@@ -1,4 +1,4 @@
export const URL = "https://yushengapi.qxyushen.top";
// export const URL = "https://test.vespa.qxyushen.top";
// export const URL = "https://yushengapi.qxyushen.top";
export const URL = "https://test.vespa.qxyushen.top";
// 声网appId 在这里换
export const appIdBySw = '02f7339ec98947deaeab173599891932';

View File

@@ -8,7 +8,9 @@ import { message } from "@/utils/message";
const props = defineProps(["userInfo"]);
import {
userLogData,
userPhotoAlbum
userPhotoAlbum,
familyListData,
bandFamilyUser
} from "@/api/modules/newuserList";
const userData = ref({ ...props.userInfo.user_info, ...props.userInfo.follow_num, userId: props.userInfo.userId })
const activeIndex = ref("1")
@@ -36,6 +38,42 @@ const statisticsLable = ref([
{ label: '真实姓名', prop: 'real_name' },
{ label: '身份证号', prop: 'card_id' }
])
// 家族成员
const familyColumns = ref([
{
label: "成员ID",
prop: "user_code"
},
{
label: "成员名称",
prop: "nickname"
},
{
label: "签约时间",
prop: "createtime"
},
{
label: "到期时间",
prop: "end_time"
},
{
label: "剩余租期",
prop: "surplus_days"
},
{
label: "免费续约次数",
prop: "free_renewal_times"
},
{
label: "当前身价",
prop: "market_value"
},
{
label: "操作",
fixed: "right",
slot: "operation"
}
])
const tableList = ref([])
const getLogData = async (type) => {
const { data, code } = await userLogData({
@@ -48,12 +86,23 @@ const getLogData = async (type) => {
pagination.value.currentPage = +data.page
}
}
const getFamilyData = async () => {
pagination.value.currentPage = 1
pagination.value.pageSize = 10
tableList.value = []
const { data, code } = await familyListData({
user_id: userData.value.userId, page: pagination.value.currentPage, page_limit: pagination.value.pageSize
})
if (code) {
tableList.value = data.lists
pagination.value.total = data.count
pagination.value.pageSize = +data.page_limit
pagination.value.currentPage = +data.page
}
}
const getPhotoAlbum = async () => {
const { data, code } = await userPhotoAlbum({ user_id: userData.value.userId })
photoAlbums.value = code ? data : []
}
const deleteAlbum = async (rowData) => {
}
const pagination = ref({
total: 0,
@@ -93,77 +142,138 @@ const handleClick = (tab) => {
tableList.value = []
if (['1', '2'].includes(name)) {
getLogData(activeIndex.value == '1' ? 1 : 2)
} else {
} else if (name == '3') {
// 获取相册
getPhotoAlbum()
} else {
getFamilyData()
}
}
const handleSizeChange = (val: number) => {
pagination.value.pageSize = val;
getLogData(activeIndex.value == '1' ? 1 : 2)
if (['1', '2'].includes(activeIndex.value)) {
getLogData(activeIndex.value == '1' ? 1 : 2)
} else {
getFamilyData()
}
};
const handleCurrentChange = (val: number) => {
pagination.value.currentPage = val;
getLogData(activeIndex.value == '1' ? 1 : 2)
if (['1', '2'].includes(activeIndex.value)) {
getLogData(activeIndex.value == '1' ? 1 : 2)
} else {
getFamilyData()
}
};
//
const exportTable = (activeIndex) => {
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 userLogData({
user_id: userData.value.userId, type: activeIndex.value == '1' ? 1 : 2, page: 1, page_limit: 10000
})
if (code) {
exportTableList = data.lists;
const res = exportTableList.map(item => {
const arr = [];
dynamicColumns.value.forEach(column => {
arr.push(item[column.prop as string]);
});
return arr;
});
const titleList = [];
dynamicColumns.value.forEach(column => {
titleList.push(column.label);
});
res.unshift(titleList);
console.log(titleList)
const workSheet = utils.aoa_to_sheet(res);
const workBook = utils.book_new();
utils.book_append_sheet(workBook, workSheet, "数据报表");
writeFile(workBook, `${activeIndex.value == '1' ? '金币' : '钻石'}统计——${formData.start_time} - ${formData.end_time}.xlsx`);
message("导出成功", {
type: "success"
});
done()
} else {
message("获取数据失败,请重试!", {
type: "error"
});
const FamilyDelete = async (rowData) => {
const { code } = await bandFamilyUser({ id: rowData.id });
if (code) {
message(`解绑成功`, {
type: "success"
});
getFamilyData()
}
}
const exportTable = async (activeIndex) => {
if (tableList.value.length === 0) {
message(`暂无数据导出`, {
type: "error"
});
return
}
if (['1', '2'].includes(activeIndex)) {
let exportTableList = []
addDialog({
title: `导出数据`,
props: {
formInline: {
time: ''
}
}
FormRef.validate(valid => {
if (valid) {
if (curData.time && curData.time.length) {
exportData({ start_time: curData.time[0] || '', end_time: curData.time[1] || '' })
},
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 userLogData({
user_id: userData.value.userId, type: activeIndex.value == '1' ? 1 : 2, page: 1, page_limit: 10000
})
if (code) {
exportTableList = data.lists;
const res = exportTableList.map(item => {
const arr = [];
dynamicColumns.value.forEach(column => {
arr.push(item[column.prop as string]);
});
return arr;
});
const titleList = [];
dynamicColumns.value.forEach(column => {
titleList.push(column.label);
});
res.unshift(titleList);
console.log(titleList)
const workSheet = utils.aoa_to_sheet(res);
const workBook = utils.book_new();
utils.book_append_sheet(workBook, workSheet, "数据报表");
writeFile(workBook, `${activeIndex.value == '1' ? '金币' : '钻石'}统计——${formData.start_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({ start_time: curData.time[0] || '', end_time: curData.time[1] || '' })
}
}
});
}
});
} else {
let exportTableList = []
const { data, code } = await familyListData({
user_id: userData.value.userId, page: 1, page_limit: 10000
})
if (code) {
exportTableList = data.lists;
const res = exportTableList.map(item => {
const arr = [];
familyColumns.value.forEach(column => {
arr.push(item[column.prop as string]);
});
return arr;
});
const titleList = [];
familyColumns.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, `家族成员统计.xlsx`);
message("导出成功", {
type: "success"
});
} else {
message("获取数据失败,请重试!", {
type: "error"
});
}
});
}
}
</script>
<template>
@@ -190,7 +300,7 @@ const exportTable = (activeIndex) => {
<el-tab-pane label="金币收支" name="1">
<div class="mb-5" style="float: right;">
<el-button @click="exportTable(activeIndex)" type="primary">导出当前表格</el-button>
<el-button @click="exportTable('1')" type="primary">导出当前表格</el-button>
</div>
<pure-table v-if="activeIndex == 1" ref="tableRef" align-whole="center" showOverflowTooltip
table-layout="auto" :adaptiveConfig="{ offsetBottom: 108 }" :data="tableList" :columns="dynamicColumns"
@@ -203,7 +313,7 @@ const exportTable = (activeIndex) => {
</el-tab-pane>
<el-tab-pane label="钻石收支" name="2">
<div class="mb-5" style="float: right;">
<el-button @click="exportTable(activeIndex)" type="primary">导出当前表格</el-button>
<el-button @click="exportTable('2')" type="primary">导出当前表格</el-button>
</div>
<pure-table v-if="activeIndex == 2" ref="tableRef" align-whole="center" showOverflowTooltip
table-layout="auto" :adaptiveConfig="{ offsetBottom: 108 }" @page-size-change="handleSizeChange"
@@ -215,7 +325,6 @@ const exportTable = (activeIndex) => {
</pure-table>
</el-tab-pane>
<el-tab-pane label="ta的相册" name="3">
<!-- {{ photoAlbums }} -->
<template v-if="activeIndex == 3">
<div v-if="photoAlbums.length > 0" class="albums-container">
<div v-for="(album, index) in photoAlbums" :key="index" class="album-card" @click="openAlbum(album)">
@@ -224,10 +333,6 @@ const exportTable = (activeIndex) => {
<div class="album-title">{{ album.name }}</div>
<div class="album-stats">
<span><i class="fas fa-images"></i> {{ album.img_num }} 张照片</span>
<!-- <el-popconfirm title="确定删除吗?" @confirm="deleteAlbum(album)">
<el-button size="small">删除</el-button>
</el-popconfirm> -->
</div>
</div>
</div>
@@ -240,6 +345,28 @@ const exportTable = (activeIndex) => {
</template>
</el-tab-pane>
<el-tab-pane label="家族成员" name="4">
<div class="mb-5" style="float: right;">
<el-button @click="exportTable('4')" type="primary">导出当前表格</el-button>
</div>
<pure-table v-if="activeIndex == 4" ref="tableRef" align-whole="center" showOverflowTooltip
table-layout="auto" :adaptiveConfig="{ offsetBottom: 108 }" @page-size-change="handleSizeChange"
@page-current-change="handleCurrentChange" :data="tableList" :columns="familyColumns"
:pagination="{ ...pagination }" :header-cell-style="{
background: 'var(--el-fill-color-light)',
color: 'var(--el-text-color-primary)'
}">
<template #operation="{ row }">
<el-popconfirm :title="`是否解绑${row.nickname}的家族关系`" @confirm="FamilyDelete(row)">
<template #reference>
<el-button link type="primary">
解绑
</el-button>
</template>
</el-popconfirm>
</template>
</pure-table>
</el-tab-pane>
</el-tabs>
</div>

View File

@@ -283,7 +283,7 @@ export function useData() {
props: {
userInfo: { userId: rowData.id, ...userData }
},
width: "50%",
width: "60%",
closeOnClickModal: false,
contentRenderer: () => h(detailView),
beforeSure: (done) => {

View File

@@ -37,8 +37,8 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
proxyReq.method = 'OPTIONS';
// https://test.vespa.qxyushen.top
// 'http://yushenggliht.qxyushen.top'
res.setHeader('Access-Control-Allow-Origin', 'http://yushenggliht.qxyushen.top');
// res.setHeader('Access-Control-Allow-Origin', 'https://test.vespa.qxyushen.top');
// res.setHeader('Access-Control-Allow-Origin', 'http://yushenggliht.qxyushen.top');
res.setHeader('Access-Control-Allow-Origin', 'https://test.vespa.qxyushen.top');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
res.end();