Browse Source

口子收入统计

fanmiyou
nili 8 months ago
parent
commit
4b3bd4183a
  1. 2
      dist/index.html
  2. 1
      dist/p__AdminManagement.134f48d1.async.js
  3. 1
      dist/p__AdminManagement.aaa712e5.async.js
  4. 4
      dist/umi.f2ee2082.js
  5. 147
      src/pages/AdminManagement.tsx
  6. 1
      src/services/matrix/typings.d.ts

2
dist/index.html

@ -9,6 +9,6 @@
</head>
<body>
<div id="root"></div>
<script src="/umi.3dbcd29d.js"></script>
<script src="/umi.f2ee2082.js"></script>
</body></html>

1
dist/p__AdminManagement.134f48d1.async.js

File diff suppressed because one or more lines are too long

1
dist/p__AdminManagement.aaa712e5.async.js

File diff suppressed because one or more lines are too long

4
dist/umi.3dbcd29d.js → dist/umi.f2ee2082.js

File diff suppressed because one or more lines are too long

147
src/pages/AdminManagement.tsx

@ -1,10 +1,24 @@
import { useModel } from '@umijs/max';
import { Button, Col, Form, Input, InputNumber, Modal, Row, Select, Space, Table, Tag } from 'antd';
import {
Button,
Col,
Form,
Input,
InputNumber,
Modal,
Row,
Select,
Space,
Table,
Tabs,
Tag,
} from 'antd';
import { ColumnsType } from 'antd/es/table';
import { useEffect, useState } from 'react';
import { adminList, appList, saveAdmin } from '@/services/matrix/admin';
import { SearchOutlined } from '@ant-design/icons';
import TabPane from 'antd/es/tabs/TabPane';
const AdminManagement = () => {
const [data, setData] = useState<API.MatrixAdminBo[]>([]);
@ -16,6 +30,13 @@ const AdminManagement = () => {
const { initialState } = useModel('@@initialState');
const currentUser = initialState?.currentUser;
const formatIncome = (v: number | undefined) => {
if (!v) {
return 0;
}
return parseFloat((v / 1000_00).toFixed(2));
};
const getAppNameById = (appId: number) => {
const app = appArr.find((app) => app.id === appId);
return app ? app.name : '';
@ -32,6 +53,88 @@ const AdminManagement = () => {
{
title: '账号',
dataIndex: 'name',
ellipsis: true,
filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (
<div style={{ padding: 8 }}>
<Input
placeholder="搜索账号"
value={selectedKeys[0]}
onChange={(e) => setSelectedKeys(e.target.value ? [e.target.value] : [])}
onPressEnter={() => confirm()}
style={{ marginBottom: 8, display: 'block' }}
/>
<Space>
<Button onClick={() => confirm()} type="primary">
</Button>
<Button onClick={() => clearFilters()} type="link">
</Button>
</Space>
</div>
),
onFilter: (value, record) => record?.name?.includes(value),
filterIcon: (filtered) => (
<SearchOutlined
style={{ color: filtered ? '#1890ff' : undefined }}
onPointerEnterCapture={undefined}
onPointerLeaveCapture={undefined}
/>
),
},
{
title: '游戏',
dataIndex: 'appIds',
render: (text: []) => (
<div>
{text?.map((appId) => (
<Tag color="blue" key={appId}>
{getAppNameById(appId)}
</Tag>
))}
</div>
),
},
{
title: '角色',
dataIndex: 'role',
render: (r: number) => {
let roleText = '';
switch (r) {
case 1:
roleText = '超级管理员';
break;
case 2:
roleText = '管理员';
break;
case 3:
roleText = '普通账号';
break;
case 4:
roleText = '口子';
break;
default:
roleText = '';
}
return roleText;
},
},
{
title: '操作',
render: (record: API.MatrixAdminBo) => [
<a key="edit" onClick={() => handleEdit(record)}>
</a>,
],
},
];
const deviceColumns: ColumnsType<API.MatrixAdminBo> = [
{
title: '账号',
dataIndex: 'name',
ellipsis: true,
filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (
<div style={{ padding: 8 }}>
<Input
@ -53,7 +156,11 @@ const AdminManagement = () => {
),
onFilter: (value, record) => record?.name?.includes(value),
filterIcon: (filtered) => (
<SearchOutlined style={{ color: filtered ? '#1890ff' : undefined }} onPointerEnterCapture={undefined} onPointerLeaveCapture={undefined} />
<SearchOutlined
style={{ color: filtered ? '#1890ff' : undefined }}
onPointerEnterCapture={undefined}
onPointerLeaveCapture={undefined}
/>
),
},
@ -94,6 +201,31 @@ const AdminManagement = () => {
return roleText;
},
},
{
title: '本月收入(元)',
dataIndex: 'incomeThisMonth',
render: (_, r: API.MatrixAdminBo) => {
return formatIncome(r.overview?.thisMonthIncome);
},
},
{
title: '上月收入(元)',
dataIndex: 'incomeLastMonth',
render: (_, r: API.MatrixAdminBo) => {
return formatIncome(r.overview?.lastMonthIncome);
},
},
{
title: '累计收入(元)',
dataIndex: 'incomeTotal',
render: (_, r: API.MatrixAdminBo) => {
return formatIncome(r.overview?.totalIncome);
},
},
{
title: '当前分成比例',
dataIndex: 'incomeRate',
},
{
title: '操作',
render: (record: API.MatrixAdminBo) => [
@ -151,7 +283,16 @@ const AdminManagement = () => {
return (
<div>
<Button onClick={handleNew}></Button>
<Table columns={columns} dataSource={data} />
<Tabs centered style={{ backgroundColor: 'white', padding: '20px' }}>
{currentUser?.role && currentUser.role < 3 && (
<TabPane tab="普通账号" key="1">
<Table columns={columns} dataSource={data.filter((x) => x.role === 3)} />
</TabPane>
)}
<TabPane tab="口子" key="2">
<Table columns={deviceColumns} dataSource={data.filter((x) => x.role === 4)} />
</TabPane>
</Tabs>
<Modal title="编辑" visible={visible} onOk={handleOk} onCancel={handleCancel}>
<Form form={form} onFinish={handleSaveAdmin}>

1
src/services/matrix/typings.d.ts

@ -143,6 +143,7 @@ declare namespace API {
role?: number;
deviceCnt?: number;
incomeRate?: number;
overview?: OverviewBo;
};
type MatrixAdminDevice = {

Loading…
Cancel
Save