提交 3e967a6d 作者: ZhangLingKun

功能:积分列表

上级 36f0e208
......@@ -649,3 +649,36 @@ export type DistributeMallOrderBonusType = InterFunction<
}>;
}
>;
// 后台管理——积分列表
export type UserPointListType = InterListFunction<
{
nickName?: string;
phoneNum?: string;
},
{
createTime: string;
id: number;
nickName: string;
phoneNum: number;
totalPoints: number;
updateTime: string;
userAccountId: number;
}
>;
// 后台管理——积分详情
export type DetailPointListType = InterListFunction<
{
userAccountId: number;
},
{
createTime: string;
id: number;
nickName: string;
phoneNum: number;
point: number;
pointSource: number;
timeOfRelease: number;
updateTime: string;
userAccountId: number;
}
>;
......@@ -2,6 +2,7 @@ import axios from '../request';
import {
AddAndEditBonusRuleType,
AddConvertRuleType,
UserPointListType,
BonusRuleListQueryType,
CalculateOrderBonusVOType,
CheckUserScoreType,
......@@ -25,6 +26,7 @@ import {
UpdateMallOrderBonusType,
UserScoreDetailsListType,
UserScorePageListType,
DetailPointListType,
} from '../interface/pointManageType';
export class PointManageAPI {
......@@ -127,4 +129,14 @@ export class PointManageAPI {
// 积分管理-订单分成-发放积分
static DistributeMallOrderBonus: DistributeMallOrderBonusType = (params) =>
axios.get('/mallorder/orderBonus/distributeMallOrderBonus', { params });
// 后台管理——积分列表
static UserPointList: UserPointListType = (params) => {
return axios.post('/userapp/userPoint/userPointList', params);
};
// 后台管理——积分详情
static DetailPointList: DetailPointListType = (params) => {
return axios.post('/userapp/userPoint/detailPoint', params);
};
}
import React, { useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { Button, message, Table } from 'antd';
import { ColumnsType } from 'antd/es/table';
import SearchView from '~/components/search-box/index';
import { PointManageAPI } from '~/api';
import { UserScorePageListType } from '~/api/interface/pointManageType';
import { UserPointListType } from '~/api/interface/pointManageType';
import { useNavigate } from 'react-router-dom';
import { InterListType, InterReqListType } from '~/api/interface';
import qs from 'query-string';
// 列表的类型
type TableType = (ReturnType<UserScorePageListType> extends Promise<infer T>
? T
: never)['result']['list']['userBasicInfo'];
// 后台返回的类型,但不是列表
type ListType = (ReturnType<UserScorePageListType> extends Promise<infer T>
? T
: never)['result']['list'];
type TableType = InterListType<UserPointListType>;
// 搜索表单的类型
type ReqType = Parameters<UserScorePageListType>[0];
type ReqType = InterReqListType<UserPointListType>;
// 搜索表单的数据
let query: ReqType = {};
export const PointList = () => {
// 路由操作
const navigation = useNavigate();
const navigate = useNavigate();
// 金额数据
const [pointData, setPointData] = useState<ListType>();
// const [pointData, setPointData] = useState<ListType>();
// 表格数据
const [tableData, setTableData] = useState<TableType>([]);
// 表格分页配置
......@@ -34,36 +30,30 @@ export const PointList = () => {
totalPage: 0,
});
// 跳转指定明细详情
const handleDetailList = (type: number) => {
navigation(`/pointManage/pointList/list?type=${type}`);
};
// const handleDetailList = (type: number) => {
// navigation(`/pointManage/pointList/list?type=${type}`);
// };
// +++++++++++++++++++++++++++++++++++++++++++++++++++ //
// 新版通用部分(ES6+ for React) ZhangLK 2022/08/30 Start
// 加载列表
const getTableList = async (value = {}) => {
// 只需要修改这个地方的接口即可
const res = await PointManageAPI.UserScorePageList({
const res = await PointManageAPI.UserPointList({
pageNo: pagination.current,
pageSize: pagination.pageSize,
...value,
...query,
});
if (res && res.code === '200') {
const {
list: { convertScore, releaseScore, userBasicInfo, withdrawScore, withdrawingScore },
pageNo,
totalCount,
pageSize,
totalPage,
} = res.result; // 解构
const { list, pageNo, totalCount, pageSize, totalPage } = res.result; // 解构
setPagination({
total: totalCount,
current: pageNo,
pageSize,
totalPage,
});
setTableData(userBasicInfo);
setPointData(res?.result?.list);
setTableData(list || []);
// setPointData(res?.result?.list);
} else {
message.warning(res.message);
}
......@@ -81,26 +71,28 @@ export const PointList = () => {
// +++++++++++++++++++++++++++++++++++++++++++++++++++ //
// 跳转详情
const handleDetail = (record: TableType[0]) => {
navigation({
pathname: '/pointManage/pointList/detail',
search: `id=${record?.mallUserId}&uid=${record?.uid}`,
});
const search = {
id: record.userAccountId,
totalPoints: record.totalPoints,
nickName: record.nickName || '游客用户',
};
navigate(`/pointManage/pointList/detail?${qs.stringify(search)}`);
};
// 表格结构
const columns: ColumnsType<TableType[0]> = [
{ title: 'UID', dataIndex: 'uid', align: 'center' },
{ title: 'UID', dataIndex: 'userAccountId', align: 'center' },
{
title: '用户名称',
dataIndex: 'userName',
align: 'center',
render: (text, record) => text || record?.nickName || `游客用户`,
},
{
title: '企业名称',
dataIndex: 'entName',
align: 'center',
render: (text: string, record) => text || (record.phoneNum ? '微信用户' : '游客用户'),
},
// {
// title: '企业名称',
// dataIndex: 'entName',
// align: 'center',
// render: (text: string, record) => text || (record.phoneNum ? '微信用户' : '游客用户'),
// },
{
title: '手机号',
dataIndex: 'phoneNum',
......@@ -108,7 +100,7 @@ export const PointList = () => {
},
{
title: '积分总额',
dataIndex: 'score',
dataIndex: 'totalPoints',
align: 'center',
render: (text: string, record) => {
return (
......@@ -132,10 +124,10 @@ export const PointList = () => {
<SearchView
search={[
{
label: '用户UID',
name: 'uid',
label: '微信昵称',
name: 'nickName',
type: 'input',
placeholder: '请输入UID',
placeholder: '请输入微信昵称',
width: 180,
},
{
......@@ -144,42 +136,42 @@ export const PointList = () => {
type: 'input',
placeholder: '请输入手机号',
},
{
label: '企业名称',
name: 'entName',
type: 'input',
placeholder: '请输入企业名称',
},
// {
// label: '企业名称',
// name: 'entName',
// type: 'input',
// placeholder: '请输入企业名称',
// },
]}
searchData={onFinish}
sufFixBtn={
<div className='point-list-head-number'>
<div className='head-number'>
<span className='number-label'>积分发放总额</span>
<Button type='link' onClick={() => handleDetailList(0)}>
{pointData?.releaseScore}
</Button>
</div>
<div className='head-number'>
<span className='number-label'>积分兑换总额</span>
<Button type='link' onClick={() => handleDetailList(1)}>
{pointData?.convertScore}
</Button>
</div>
<div className='head-number'>
<span className='number-label'>积分提现总额</span>
<Button type='link' onClick={() => handleDetailList(2)}>
{pointData?.withdrawScore}
</Button>
</div>
<div className='head-number'>
<span className='number-label'>待处理提现积分</span>
<Button type='link' onClick={() => handleDetailList(2)}>
{pointData?.withdrawingScore}
</Button>
</div>
</div>
}
// sufFixBtn={
// <div className='point-list-head-number'>
// <div className='head-number'>
// <span className='number-label'>积分发放总额</span>
// <Button type='link' onClick={() => handleDetailList(0)}>
// {pointData?.releaseScore}
// </Button>
// </div>
// <div className='head-number'>
// <span className='number-label'>积分兑换总额</span>
// <Button type='link' onClick={() => handleDetailList(1)}>
// {pointData?.convertScore}
// </Button>
// </div>
// <div className='head-number'>
// <span className='number-label'>积分提现总额</span>
// <Button type='link' onClick={() => handleDetailList(2)}>
// {pointData?.withdrawScore}
// </Button>
// </div>
// <div className='head-number'>
// <span className='number-label'>待处理提现积分</span>
// <Button type='link' onClick={() => handleDetailList(2)}>
// {pointData?.withdrawingScore}
// </Button>
// </div>
// </div>
// }
/>
<Table
size='small'
......
......@@ -20,7 +20,7 @@ export const authRouterList = async () => {
const getRouteList = (data: RouteObjectType[]) => {
return data.reduce((pre: RouteObjectType[], cur) => {
const Obj: RouteObjectType = { ...cur };
if (ids.includes(Obj.meta.id) || Obj.meta.hidden) {
if (ids.includes(Obj.meta.id) || Obj.meta.hidden || Obj.meta.develop) {
if (Obj.children) {
Obj.children = [...getRouteList(Obj.children)];
}
......
......@@ -34,6 +34,7 @@ import {
ThunderboltOutlined,
BankOutlined,
VerifiedOutlined,
AccountBookOutlined,
} from '@ant-design/icons';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
......@@ -43,8 +44,8 @@ import { Spin } from 'antd';
import LoginView from '~/pages/common/login';
// 积分
// import { PointList } from '~/pages/pointManage/pointList';
// import { PointDetail } from '~/pages/pointManage/pointList/detail';
import { PointList } from '~/pages/pointManage/pointList';
import { PointDetail } from '~/pages/pointManage/pointList/detail';
// import { PointRules } from '~/pages/pointManage/pointRules';
// import PointDetailList from '~/pages/pointManage/pointDetail';
// 分成
......@@ -175,6 +176,7 @@ export interface RouteObjectType {
icon: any;
customIcon?: boolean;
title: string;
develop?: boolean;
};
}
// 加载页面
......@@ -854,41 +856,37 @@ export const routerList: Array<RouteObjectType> = [
},
],
},
// {
// path: '/pointManage',
// element: <LayoutView />,
// errorElement: <ErrorPage />,
// meta: {
// id: 25000,
// icon: <AccountBookOutlined />,
// title: '积分管理',
// },
// children: [
// {
// path: '/pointManage/pointList',
// element: withLoadingComponent(<PointList />),
// meta: {
// id: 25100,
// title: '积分列表',
// icon: <MacCommandOutlined />,
// },
// },
// {
// path: '/pointManage/pointList/detail',
// element: withLoadingComponent(
// <PointDetail
// location={{
// search: '',
// }}
// />,
// ),
// meta: {
// id: 25100,
// title: '个人积分明细',
// icon: <MacCommandOutlined />,
// hidden: true,
// },
// },
{
path: '/pointManage',
element: <LayoutView />,
errorElement: <ErrorPage />,
meta: {
id: 12000,
icon: <AccountBookOutlined />,
title: '积分管理',
develop: true,
},
children: [
{
path: '/pointManage/pointList',
element: withLoadingComponent(<PointList />),
meta: {
id: 12100,
title: '积分列表',
icon: <MacCommandOutlined />,
develop: true,
},
},
{
path: '/pointManage/pointList/detail',
element: withLoadingComponent(<PointDetail />),
meta: {
id: 12110,
title: '个人积分明细',
icon: <MacCommandOutlined />,
hidden: true,
},
},
// {
// path: '/pointManage/pointRule',
// element: withLoadingComponent(<PointRules />),
......@@ -933,8 +931,8 @@ export const routerList: Array<RouteObjectType> = [
// hidden: true,
// },
// },
// ],
// },
],
},
// {
// path: '/couponManage',
// element: <LayoutView />,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论