提交 3e967a6d 作者: ZhangLingKun

功能:积分列表

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