From 1df7bfc26f52c76f1704ac706fbd3bf9e3af4c75 Mon Sep 17 00:00:00 2001 From: yziiy <15979918+mayday-yziiy@user.noreply.gitee.com> Date: Thu, 25 Dec 2025 17:27:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/newuserList.ts | 13 ++ src/utils/http/config.ts | 4 +- src/views/newuser/newuserList/detail.vue | 259 +++++++++++++++++------ src/views/newuser/newuserList/hook.tsx | 2 +- vite.config.ts | 4 +- 5 files changed, 211 insertions(+), 71 deletions(-) diff --git a/src/api/modules/newuserList.ts b/src/api/modules/newuserList.ts index ed7125b..70b68e5 100644 --- a/src/api/modules/newuserList.ts +++ b/src/api/modules/newuserList.ts @@ -115,4 +115,17 @@ export const findUserData = data => { return http.request("post", "/adminapi/User/cancel_user_recovery", { data }); +} +// 家族成员 +export const familyListData = params => { + return http.request( + "get", + "/adminapi/User/get_family_member", + { params } + ); +} +export const bandFamilyUser = data => { + return http.request("post", "/adminapi/User/cancel_contract", { + data + }); } \ No newline at end of file diff --git a/src/utils/http/config.ts b/src/utils/http/config.ts index 87679bb..e797c68 100644 --- a/src/utils/http/config.ts +++ b/src/utils/http/config.ts @@ -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'; \ No newline at end of file diff --git a/src/views/newuser/newuserList/detail.vue b/src/views/newuser/newuserList/detail.vue index 7eca37f..5c06fd7 100644 --- a/src/views/newuser/newuserList/detail.vue +++ b/src/views/newuser/newuserList/detail.vue @@ -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" }); } - }); + } + }