feat: 添加团队查看功能,整合团队成员表格及过滤器,支持根据推荐码查询团队信息
This commit is contained in:
@@ -25,6 +25,7 @@ const props = withDefaults(
|
|||||||
columns?: boolean;
|
columns?: boolean;
|
||||||
};
|
};
|
||||||
filterColumns?: TableFilterColumns;
|
filterColumns?: TableFilterColumns;
|
||||||
|
filterColumnsCount?: number;
|
||||||
title?: string;
|
title?: string;
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
@@ -124,7 +125,12 @@ defineExpose({} as Expose);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="space-y-5">
|
<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">
|
<div class="rounded-lg bg-white p-5 space-y-5 dark:bg-container">
|
||||||
<TableHeaderOperation
|
<TableHeaderOperation
|
||||||
@@ -149,9 +155,10 @@ defineExpose({} as Expose);
|
|||||||
:data="tableData"
|
:data="tableData"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
:bordered="false"
|
:bordered="false"
|
||||||
:on-update:page="handlePageChange"
|
:remote="true"
|
||||||
:on-update:page-size="handlePageSizeChange"
|
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
|
@update:page="handlePageChange"
|
||||||
|
@update:page-size="handlePageSizeChange"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import type { TableFilterColumns } from '.';
|
|||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
columns?: TableFilterColumns;
|
columns?: TableFilterColumns;
|
||||||
|
filterColumnsCount?: number;
|
||||||
}>();
|
}>();
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'confirm', form: Record<string, any>): void;
|
(e: 'confirm', form: Record<string, any>): void;
|
||||||
@@ -33,8 +34,8 @@ function handleConfirm() {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="rounded-lg bg-white p-5 dark:bg-container">
|
<div class="rounded-lg bg-white p-5 dark:bg-container">
|
||||||
<NForm :label-width="80" label-align="left" label-placement="left">
|
<NForm :label-width="80" label-align="left" label-placement="left" :show-feedback="false">
|
||||||
<NGrid x-gap="20" :cols="4">
|
<NGrid x-gap="20" :cols="filterColumnsCount || 4">
|
||||||
<NGi v-for="col in columns" :key="col.key">
|
<NGi v-for="col in columns" :key="col.key">
|
||||||
<NFormItem :label="col.title" :path="col.key">
|
<NFormItem :label="col.title" :path="col.key">
|
||||||
<component
|
<component
|
||||||
|
|||||||
@@ -53,21 +53,21 @@ const columns: TableBaseColumns = [
|
|||||||
{
|
{
|
||||||
key: 'reformPioneerAllowance',
|
key: 'reformPioneerAllowance',
|
||||||
title: '改革先锋津贴(元)',
|
title: '改革先锋津贴(元)',
|
||||||
render(row) {
|
render: (row: any) => {
|
||||||
return Number(row.reformPioneerAllowance);
|
return Number(row.reformPioneerAllowance);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'subscribeStartAt',
|
key: 'subscribeStartAt',
|
||||||
title: '订阅开始时间',
|
title: '订阅开始时间',
|
||||||
render(row: any) {
|
render: (row: any) => {
|
||||||
return dayjs(row.subscribeStartAt).format('YYYY-MM-DD HH:mm');
|
return dayjs(row.subscribeStartAt).format('YYYY-MM-DD HH:mm');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'subscribeEndAt',
|
key: 'subscribeEndAt',
|
||||||
title: '订阅结束时间',
|
title: '订阅结束时间',
|
||||||
render(row: any) {
|
render: (row: any) => {
|
||||||
return dayjs(row.subscribeEndAt).format('YYYY-MM-DD HH:mm');
|
return dayjs(row.subscribeEndAt).format('YYYY-MM-DD HH:mm');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -78,7 +78,7 @@ const columns: TableBaseColumns = [
|
|||||||
{
|
{
|
||||||
key: 'isActive',
|
key: 'isActive',
|
||||||
title: '是否激活',
|
title: '是否激活',
|
||||||
render(row) {
|
render: (row: any) => {
|
||||||
return row.isActive ? '是' : '否';
|
return row.isActive ? '是' : '否';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -89,7 +89,7 @@ const columns: TableBaseColumns = [
|
|||||||
{
|
{
|
||||||
key: 'createdAt',
|
key: 'createdAt',
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
render(row: any) {
|
render: (row: any) => {
|
||||||
return dayjs(row.createdAt).format('YYYY-MM-DD HH:mm');
|
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 Address from './components/address.vue';
|
||||||
import Payment from './components/payment.vue';
|
import Payment from './components/payment.vue';
|
||||||
import Withdraw from './components/withdraw.vue';
|
import Withdraw from './components/withdraw.vue';
|
||||||
|
import Team from './components/team.vue';
|
||||||
|
|
||||||
const dialog = useDialog();
|
const dialog = useDialog();
|
||||||
|
|
||||||
@@ -26,20 +27,20 @@ const fetchData: TableFetchData = ({ pagination, filter }) => {
|
|||||||
|
|
||||||
const columns: TableBaseColumns = [
|
const columns: TableBaseColumns = [
|
||||||
{
|
{
|
||||||
key: 'uid',
|
key: 'userProfile.uid',
|
||||||
title: 'UID',
|
title: 'UID',
|
||||||
width: 120
|
width: 120
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'user.name',
|
key: 'name',
|
||||||
title: '姓名'
|
title: '姓名'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'user.username',
|
key: 'username',
|
||||||
title: '手机号'
|
title: '手机号'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'referralCode',
|
key: 'userProfile.referralCode',
|
||||||
title: '推荐码'
|
title: '推荐码'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -52,7 +53,7 @@ const columns: TableBaseColumns = [
|
|||||||
{
|
{
|
||||||
key: 'operations',
|
key: 'operations',
|
||||||
title: '操作',
|
title: '操作',
|
||||||
width: 300,
|
width: 350,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
operations: (row: any) => [
|
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