feat: 添加团队查看功能,整合团队成员表格及过滤器,支持根据推荐码查询团队信息
This commit is contained in:
@@ -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