feat: 添加团队查看功能,整合团队成员表格及过滤器,支持根据推荐码查询团队信息
This commit is contained in:
@@ -25,6 +25,7 @@ const props = withDefaults(
|
||||
columns?: boolean;
|
||||
};
|
||||
filterColumns?: TableFilterColumns;
|
||||
filterColumnsCount?: number;
|
||||
title?: string;
|
||||
}>(),
|
||||
{
|
||||
@@ -124,7 +125,12 @@ defineExpose({} as Expose);
|
||||
|
||||
<template>
|
||||
<div class="space-y-5">
|
||||
<TableFilter v-if="filterColumns.length > 0" :columns="filterColumns" @confirm="handleSearch" />
|
||||
<TableFilter
|
||||
v-if="filterColumns.length > 0"
|
||||
:columns="filterColumns"
|
||||
:filter-columns-count="filterColumnsCount"
|
||||
@confirm="handleSearch"
|
||||
/>
|
||||
|
||||
<div class="rounded-lg bg-white p-5 space-y-5 dark:bg-container">
|
||||
<TableHeaderOperation
|
||||
@@ -149,9 +155,10 @@ defineExpose({} as Expose);
|
||||
:data="tableData"
|
||||
:pagination="pagination"
|
||||
:bordered="false"
|
||||
:on-update:page="handlePageChange"
|
||||
:on-update:page-size="handlePageSizeChange"
|
||||
:remote="true"
|
||||
v-bind="$attrs"
|
||||
@update:page="handlePageChange"
|
||||
@update:page-size="handlePageSizeChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,6 +5,7 @@ import type { TableFilterColumns } from '.';
|
||||
|
||||
const props = defineProps<{
|
||||
columns?: TableFilterColumns;
|
||||
filterColumnsCount?: number;
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(e: 'confirm', form: Record<string, any>): void;
|
||||
@@ -33,8 +34,8 @@ function handleConfirm() {
|
||||
|
||||
<template>
|
||||
<div class="rounded-lg bg-white p-5 dark:bg-container">
|
||||
<NForm :label-width="80" label-align="left" label-placement="left">
|
||||
<NGrid x-gap="20" :cols="4">
|
||||
<NForm :label-width="80" label-align="left" label-placement="left" :show-feedback="false">
|
||||
<NGrid x-gap="20" :cols="filterColumnsCount || 4">
|
||||
<NGi v-for="col in columns" :key="col.key">
|
||||
<NFormItem :label="col.title" :path="col.key">
|
||||
<component
|
||||
|
||||
@@ -53,21 +53,21 @@ const columns: TableBaseColumns = [
|
||||
{
|
||||
key: 'reformPioneerAllowance',
|
||||
title: '改革先锋津贴(元)',
|
||||
render(row) {
|
||||
render: (row: any) => {
|
||||
return Number(row.reformPioneerAllowance);
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'subscribeStartAt',
|
||||
title: '订阅开始时间',
|
||||
render(row: any) {
|
||||
render: (row: any) => {
|
||||
return dayjs(row.subscribeStartAt).format('YYYY-MM-DD HH:mm');
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'subscribeEndAt',
|
||||
title: '订阅结束时间',
|
||||
render(row: any) {
|
||||
render: (row: any) => {
|
||||
return dayjs(row.subscribeEndAt).format('YYYY-MM-DD HH:mm');
|
||||
}
|
||||
},
|
||||
@@ -78,7 +78,7 @@ const columns: TableBaseColumns = [
|
||||
{
|
||||
key: 'isActive',
|
||||
title: '是否激活',
|
||||
render(row) {
|
||||
render: (row: any) => {
|
||||
return row.isActive ? '是' : '否';
|
||||
}
|
||||
},
|
||||
@@ -89,7 +89,7 @@ const columns: TableBaseColumns = [
|
||||
{
|
||||
key: 'createdAt',
|
||||
title: '创建时间',
|
||||
render(row: any) {
|
||||
render: (row: any) => {
|
||||
return dayjs(row.createdAt).format('YYYY-MM-DD HH:mm');
|
||||
}
|
||||
},
|
||||
|
||||
86
src/views/user/components/team.vue
Normal file
86
src/views/user/components/team.vue
Normal file
@@ -0,0 +1,86 @@
|
||||
<script lang="ts" setup>
|
||||
import { useTemplateRef } from 'vue';
|
||||
import { NSelect } from 'naive-ui';
|
||||
import { client, safeClient } from '@/service/api';
|
||||
import type { TableBaseColumns, TableFetchData, TableFilterColumns, TableInst } from '@/components/table';
|
||||
|
||||
defineOptions({
|
||||
name: 'TeamDialog'
|
||||
});
|
||||
|
||||
const props = defineProps<{
|
||||
code: string;
|
||||
}>();
|
||||
|
||||
const tableInst = useTemplateRef<TableInst>('tableInst');
|
||||
|
||||
const fetchData: TableFetchData = ({ pagination, filter }) => {
|
||||
return safeClient(() =>
|
||||
client.api.admin.team.members.get({ query: { referralCode: props.code, ...pagination, ...filter } })
|
||||
);
|
||||
};
|
||||
|
||||
const columns: TableBaseColumns = [
|
||||
{
|
||||
key: 'descendant.name',
|
||||
title: '姓名'
|
||||
},
|
||||
{
|
||||
key: 'descendant.username',
|
||||
title: '手机号'
|
||||
},
|
||||
{
|
||||
key: 'directCount',
|
||||
title: '直属人数'
|
||||
},
|
||||
{
|
||||
key: 'depthConfig.commissionRate',
|
||||
title: '佣金比例(%)'
|
||||
},
|
||||
{
|
||||
key: 'depthConfig.createdAt',
|
||||
title: '加入时间'
|
||||
},
|
||||
{
|
||||
key: 'depthConfig.depth',
|
||||
title: '团队层级'
|
||||
},
|
||||
{
|
||||
key: 'ancestorId',
|
||||
title: '上级ID'
|
||||
},
|
||||
{
|
||||
key: 'descendantId',
|
||||
title: '用户ID'
|
||||
}
|
||||
];
|
||||
|
||||
const filterColumns: TableFilterColumns = [
|
||||
{
|
||||
key: 'depth',
|
||||
title: '团队层级',
|
||||
component: NSelect,
|
||||
componentProps: {
|
||||
options: [
|
||||
{ label: '一级', value: '1' },
|
||||
{ label: '二级', value: '2' },
|
||||
{ label: '三级', value: '3' }
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<TableBase
|
||||
ref="tableInst"
|
||||
:fetch-data="fetchData"
|
||||
:columns="columns"
|
||||
:filter-columns="filterColumns"
|
||||
:scroll-x="800"
|
||||
:show-header-operation="false"
|
||||
:filter-columns-count="3"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style lang="css" scoped></style>
|
||||
@@ -8,6 +8,7 @@ import Wallet from './components/wallet.vue';
|
||||
import Address from './components/address.vue';
|
||||
import Payment from './components/payment.vue';
|
||||
import Withdraw from './components/withdraw.vue';
|
||||
import Team from './components/team.vue';
|
||||
|
||||
const dialog = useDialog();
|
||||
|
||||
@@ -26,20 +27,20 @@ const fetchData: TableFetchData = ({ pagination, filter }) => {
|
||||
|
||||
const columns: TableBaseColumns = [
|
||||
{
|
||||
key: 'uid',
|
||||
key: 'userProfile.uid',
|
||||
title: 'UID',
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
key: 'user.name',
|
||||
key: 'name',
|
||||
title: '姓名'
|
||||
},
|
||||
{
|
||||
key: 'user.username',
|
||||
key: 'username',
|
||||
title: '手机号'
|
||||
},
|
||||
{
|
||||
key: 'referralCode',
|
||||
key: 'userProfile.referralCode',
|
||||
title: '推荐码'
|
||||
},
|
||||
{
|
||||
@@ -52,7 +53,7 @@ const columns: TableBaseColumns = [
|
||||
{
|
||||
key: 'operations',
|
||||
title: '操作',
|
||||
width: 300,
|
||||
width: 350,
|
||||
fixed: 'right',
|
||||
operations: (row: any) => [
|
||||
{
|
||||
@@ -124,6 +125,18 @@ const columns: TableBaseColumns = [
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
contentText: '查看团队',
|
||||
size: 'small',
|
||||
onClick: () => {
|
||||
dialog.create({
|
||||
title: '查看团队',
|
||||
showIcon: false,
|
||||
style: { width: '1000px' },
|
||||
content: () => h(Team, { code: row.userProfile.referralCode })
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user