Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
admin
Commits
3e967a6d
提交
3e967a6d
authored
8月 09, 2023
作者:
ZhangLingKun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
功能:积分列表
上级
36f0e208
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
352 行增加
和
331 行删除
+352
-331
pointManageType.ts
src/api/interface/pointManageType.ts
+33
-0
pointManageAPI.ts
src/api/modules/pointManageAPI.ts
+12
-0
index.tsx
src/pages/pointManage/pointList/detail/index.tsx
+159
-173
index.tsx
src/pages/pointManage/pointList/index.tsx
+66
-74
index.ts
src/router/index.ts
+1
-1
router.tsx
src/router/router.tsx
+81
-83
没有找到文件。
src/api/interface/pointManageType.ts
浏览文件 @
3e967a6d
...
@@ -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
;
}
>
;
src/api/modules/pointManageAPI.ts
浏览文件 @
3e967a6d
...
@@ -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
);
};
}
}
src/pages/pointManage/pointList/detail/index.tsx
浏览文件 @
3e967a6d
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
{
Button
,
message
,
Table
}
from
'antd'
;
import
{
Button
,
message
,
Table
}
from
'antd'
;
import
qs
from
'query-string'
;
import
qs
from
'query-string'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
{
use
Location
,
use
Navigate
}
from
'react-router-dom'
;
import
SearchView
from
'~/components/search-box'
;
import
SearchView
from
'~/components/search-box'
;
import
{
UserScoreDetails
ListType
}
from
'~/api/interface/pointManageType'
;
import
{
DetailPoint
ListType
}
from
'~/api/interface/pointManageType'
;
import
{
PointManageAPI
}
from
'~/api'
;
import
{
PointManageAPI
}
from
'~/api'
;
import
{
DetailModal
}
from
'../comp/detailModal'
;
//
import { DetailModal } from '../comp/detailModal';
import
{
DistributionModal
}
from
'~/pages/pointManage/pointList/comp/distributionModal'
;
//
import { DistributionModal } from '~/pages/pointManage/pointList/comp/distributionModal';
import
{
ApproveModal
}
from
'~/pages/pointManage/pointList/comp/approveModal'
;
//
import { ApproveModal } from '~/pages/pointManage/pointList/comp/approveModal';
import
useOperate
from
'~/common/hook/optionHook'
;
//
import useOperate from '~/common/hook/optionHook';
import
{
useSearchParams
}
from
'react-router-dom
'
;
import
{
InterListType
}
from
'~/api/interface
'
;
// 列表的类型
// 列表的类型
type
TableType
=
(
ReturnType
<
UserScoreDetailsListType
>
extends
Promise
<
infer
T
>
type
TableType
=
InterListType
<
DetailPointListType
>
;
?
T
:
never
)[
'result'
][
'list'
][
'userScoreList'
];
// 后台返回的类型,但不是列表
type
ListType
=
(
ReturnType
<
UserScoreDetailsListType
>
extends
Promise
<
infer
T
>
?
T
:
never
)[
'result'
][
'list'
];
// 状态类型
// 状态类型
const
statusList
=
[
// const statusList = [
{
value
:
0
,
label
:
'提现中'
},
// { value: 0, label: '提现中' },
{
value
:
1
,
label
:
'提现成功'
},
// { value: 1, label: '提现成功' },
{
value
:
2
,
label
:
'提现失败'
},
// { value: 2, label: '提现失败' },
];
// ];
export
function
PointDetail
(
props
:
any
)
{
export
function
PointDetail
()
{
const
[
searchParams
]
=
useSearchParams
();
// 路由钩子
const
location
=
useLocation
();
// 返回上一页
const
handleBack
=
()
=>
{
navigate
(
-
1
);
};
// 参数解析
// 参数解析
const
option
=
qs
.
parse
(
props
.
location
.
search
);
const
option
=
qs
.
parse
(
location
.
search
);
// 路由操作
// 路由操作
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
// 金额数据
// 金额数据
const
[
pointData
,
setPointData
]
=
useState
<
ListType
>
();
//
const [pointData, setPointData] = useState<ListType>();
// 表格数据
// 表格数据
const
[
tableData
,
setTableData
]
=
useState
<
TableType
>
([]);
const
[
tableData
,
setTableData
]
=
useState
<
TableType
>
([]);
// 表格分页配置
// 表格分页配置
...
@@ -45,25 +43,25 @@ export function PointDetail(props: any) {
...
@@ -45,25 +43,25 @@ export function PointDetail(props: any) {
totalPage
:
0
,
totalPage
:
0
,
});
});
// 查看参数
// 查看参数
const
[
recordData
,
setRecordData
]
=
useState
<
TableType
[
0
]
>
();
//
const [recordData, setRecordData] = useState<TableType[0]>();
// 显示查看弹窗
// 显示查看弹窗
const
[
detailVisible
,
setDetailVisible
]
=
useState
(
false
);
//
const [detailVisible, setDetailVisible] = useState(false);
// 积分发放弹窗
// 积分发放弹窗
const
[
distributionVisible
,
setDistributionVisible
]
=
useState
(
false
);
//
const [distributionVisible, setDistributionVisible] = useState(false);
// 审批弹窗
// 审批弹窗
const
[
approveVisible
,
setApproveVisible
]
=
useState
(
false
);
//
const [approveVisible, setApproveVisible] = useState(false);
// 按钮权限
// 按钮权限
const
isDistributePointBtnShow
=
useOperate
(
25101
);
//
const isDistributePointBtnShow = useOperate(25101);
// +++++++++++++++++++++++++++++++++++++++++++++++++++ //
// +++++++++++++++++++++++++++++++++++++++++++++++++++ //
// 新版通用部分(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
.
UserScoreDetails
List
({
const
res
=
await
PointManageAPI
.
DetailPoint
List
({
pageNo
:
pagination
.
current
,
pageNo
:
pagination
.
current
,
pageSize
:
pagination
.
pageSize
,
pageSize
:
pagination
.
pageSize
,
...
value
,
...
value
,
mallUser
Id
:
Number
(
option
.
id
),
userAccount
Id
:
Number
(
option
.
id
),
});
});
if
(
res
&&
res
.
code
===
'200'
)
{
if
(
res
&&
res
.
code
===
'200'
)
{
const
{
list
,
pageNo
,
totalCount
,
pageSize
,
totalPage
}
=
res
.
result
;
// 解构
const
{
list
,
pageNo
,
totalCount
,
pageSize
,
totalPage
}
=
res
.
result
;
// 解构
...
@@ -73,8 +71,8 @@ export function PointDetail(props: any) {
...
@@ -73,8 +71,8 @@ export function PointDetail(props: any) {
pageSize
,
pageSize
,
totalPage
,
totalPage
,
});
});
setTableData
(
list
.
userScoreList
);
setTableData
(
list
||
[]
);
setPointData
(
res
?.
result
?.
list
);
//
setPointData(res?.result?.list);
}
else
{
}
else
{
message
.
warning
(
res
.
message
);
message
.
warning
(
res
.
message
);
}
}
...
@@ -88,147 +86,135 @@ export function PointDetail(props: any) {
...
@@ -88,147 +86,135 @@ export function PointDetail(props: any) {
const
columns
:
ColumnsType
<
TableType
[
0
]
>
=
[
const
columns
:
ColumnsType
<
TableType
[
0
]
>
=
[
{
{
title
:
'积分数值'
,
title
:
'积分数值'
,
dataIndex
:
'scoreNum'
,
dataIndex
:
'point'
,
align
:
'center'
,
render
:
(
text
)
=>
(
text
>
0
?
`+
${
text
}
`
:
text
),
},
{
title
:
'流通方式'
,
dataIndex
:
'type'
,
align
:
'center'
},
{
title
:
'兑换比例'
,
dataIndex
:
'convertRatio'
,
align
:
'center'
},
{
title
:
'领取时间'
,
dataIndex
:
'getTime'
,
align
:
'center'
},
{
title
:
'使用时间'
,
dataIndex
:
'useTime'
,
align
:
'center'
,
align
:
'center'
,
render
:
(
_text
,
record
)
=>
{
render
:
(
text
)
=>
(
text
<
0
?
`-
${
text
}
`
:
`+
${
text
}
`
),
if
(
record
?.
type
===
'积分提现'
&&
record
?.
status
===
0
)
{
return
''
;
}
if
(
record
?.
type
===
'积分提现'
&&
record
?.
status
===
2
)
{
return
''
;
}
if
(
record
?.
type
===
'积分提现'
&&
record
?.
status
===
1
)
{
return
record
?.
approvalTime
;
}
return
record
?.
useTime
;
},
},
{
title
:
'订单编号'
,
dataIndex
:
'orderNo'
,
align
:
'center'
,
render
:
(
text
,
record
)
=>
!!
text
&&
(
<
Button
type=
'link'
onClick=
{
()
=>
{
// 跳转到订单列表
navigate
({
pathname
:
'/orderManage/list/detail'
,
search
:
qs
.
stringify
({
id
:
record
.
orderId
,
activeTabKey
:
1
}),
});
}
}
>
{
text
}
</
Button
>
),
},
{
title
:
'状态'
,
dataIndex
:
'status'
,
align
:
'center'
,
render
:
(
text
)
=>
statusList
.
find
((
i
)
=>
i
.
value
===
text
)?.
label
||
text
,
},
{
title
:
'操作'
,
align
:
'center'
,
fixed
:
'right'
,
width
:
180
,
render
:
(
_text
,
record
)
=>
{
return
(
<>
{
record
.
status
===
0
&&
(
<
Button
type=
'link'
onClick=
{
()
=>
{
setRecordData
(
JSON
.
parse
(
JSON
.
stringify
(
record
)));
setApproveVisible
(
true
);
}
}
>
审批
</
Button
>
)
}
<
Button
type=
'link'
onClick=
{
()
=>
{
setRecordData
(
JSON
.
parse
(
JSON
.
stringify
(
record
)));
setDetailVisible
(
true
);
}
}
>
查看
</
Button
>
</>
);
},
},
},
{
title
:
'流通方式'
,
dataIndex
:
'pointSource'
,
align
:
'center'
},
// { title: '兑换比例', dataIndex: 'convertRatio', align: 'center' },
{
title
:
'领取时间'
,
dataIndex
:
'createTime'
,
align
:
'center'
},
{
title
:
'使用时间'
,
dataIndex
:
'updateTime'
,
align
:
'center'
},
// {
// title: '订单编号',
// dataIndex: 'orderNo',
// align: 'center',
// render: (text, record) =>
// !!text && (
// <Button
// type='link'
// onClick={() => {
// // 跳转到订单列表
// navigate({
// pathname: '/orderManage/list/detail',
// search: qs.stringify({ id: record.orderId, activeTabKey: 1 }),
// });
// }}
// >
// {text}
// </Button>
// ),
// },
// {
// title: '状态',
// dataIndex: 'status',
// align: 'center',
// render: (text) => statusList.find((i) => i.value === text)?.label || text,
// },
// {
// title: '操作',
// align: 'center',
// fixed: 'right',
// width: 180,
// render: (_text, record) => {
// return (
// <>
// {/*{record.status === 0 && (*/}
// {/* <Button*/}
// {/* type='link'*/}
// {/* onClick={() => {*/}
// {/* setRecordData(JSON.parse(JSON.stringify(record)));*/}
// {/* setApproveVisible(true);*/}
// {/* }}*/}
// {/* >*/}
// {/* 审批*/}
// {/* </Button>*/}
// {/*)}*/}
// <Button
// type='link'
// onClick={() => {
// setRecordData(JSON.parse(JSON.stringify(record)));
// setDetailVisible(true);
// }}
// >
// 查看
// </Button>
// </>
// );
// },
// },
];
];
// 一键关闭全部弹窗
// 一键关闭全部弹窗
const
handleCloseAll
=
()
=>
{
//
const handleCloseAll = () => {
setDetailVisible
(
false
);
//
setDetailVisible(false);
setDistributionVisible
(
false
);
//
setDistributionVisible(false);
setApproveVisible
(
false
);
//
setApproveVisible(false);
setRecordData
(
undefined
);
//
setRecordData(undefined);
getTableList
().
then
();
//
getTableList().then();
};
//
};
// 组件加载
// 组件加载
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
'获取参数 --->'
,
searchParams
.
get
(
'id'
));
// console.log('获取参数 --->', location);
(
async
()
=>
{
console
.
log
(
'获取参数 --->'
,
qs
.
parse
(
location
.
search
));
await
getTableList
();
getTableList
().
then
();
})();
},
[]);
},
[]);
return
(
return
(
<>
<>
<
SearchView
<
SearchView
preFixBtn=
{
preFixBtn=
{
<
div
>
<
div
style=
{
{
display
:
'flex'
,
justifyContent
:
'space-between'
,
width
:
'100%'
}
}
>
{
pointData
?.
uid
}
{
pointData
?.
userName
}
(
{
pointData
?.
nickName
}
)
<
div
>
</
div
>
UID
{
option
?.
id
}
{
option
?.
nickName
}
}
sufFixBtn=
{
<
div
className=
'point-list-head-number'
>
<
div
className=
'head-number'
>
<
span
className=
'number-label'
>
积分总额
</
span
>
<
Button
type=
'link'
>
{
pointData
?.
scoreTotal
}
</
Button
>
</
div
>
<
div
className=
'head-number'
>
<
span
className=
'number-label'
>
已使用积分
</
span
>
<
Button
type=
'link'
>
{
pointData
?.
useScore
}
</
Button
>
</
div
>
<
div
className=
'head-number'
>
<
span
className=
'number-label'
>
已兑换积分
</
span
>
<
Button
type=
'link'
>
{
pointData
?.
convertScore
}
</
Button
>
</
div
>
<
div
className=
'head-number'
>
<
Button
type=
'primary'
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
{
setDistributionVisible
(
true
);
}
}
disabled=
{
!
isDistributePointBtnShow
}
>
积分发放
</
Button
>
</
div
>
</
div
>
<
Button
type=
{
'primary'
}
onClick=
{
handleBack
}
>
返回
</
Button
>
</
div
>
</
div
>
}
}
// sufFixBtn={
// <div className='point-list-head-number'>
// <div className='head-number'>
// <span className='number-label'>积分总额</span>
// <Button type='link'>{pointData?.scoreTotal}</Button>
// </div>
// <div className='head-number'>
// <span className='number-label'>已使用积分</span>
// <Button type='link'>{pointData?.useScore}</Button>
// </div>
// <div className='head-number'>
// <span className='number-label'>已兑换积分</span>
// <Button type='link'>{pointData?.convertScore}</Button>
// </div>
// <div className='head-number'>
// <Button
// type='primary'
// icon={<PlusOutlined />}
// onClick={() => {
// setDistributionVisible(true);
// }}
// disabled={!isDistributePointBtnShow}
// >
// 积分发放
// </Button>
// </div>
// </div>
// }
/>
/>
<
Table
<
Table
size=
'small'
size=
'small'
dataSource=
{
tableData
}
dataSource=
{
tableData
}
columns=
{
columns
}
columns=
{
columns
}
rowKey=
'id'
rowKey=
'id'
scroll=
{
{
x
:
1500
}
}
//
scroll={{ x: 1500 }}
bordered
bordered
pagination=
{
{
pagination=
{
{
total
:
pagination
.
total
,
total
:
pagination
.
total
,
...
@@ -240,24 +226,24 @@ export function PointDetail(props: any) {
...
@@ -240,24 +226,24 @@ export function PointDetail(props: any) {
showTotal
:
(
total
,
range
)
=>
`当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`
,
showTotal
:
(
total
,
range
)
=>
`当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`
,
}
}
}
}
/>
/>
<
DetailModal
{
/*<DetailModal*/
}
open=
{
detailVisible
}
{
/* open={detailVisible}*/
}
data=
{
recordData
}
{
/* data={recordData}*/
}
title=
'查看详情'
{
/* title='查看详情'*/
}
closed=
{
handleCloseAll
}
{
/* closed={handleCloseAll}*/
}
/>
{
/*/>*/
}
<
DistributionModal
{
/*<DistributionModal*/
}
open=
{
distributionVisible
}
{
/* open={distributionVisible}*/
}
data=
{
pointData
}
{
/* data={pointData}*/
}
title=
'发放积分'
{
/* title='发放积分'*/
}
closed=
{
handleCloseAll
}
{
/* closed={handleCloseAll}*/
}
/>
{
/*/>*/
}
<
ApproveModal
{
/*<ApproveModal*/
}
open=
{
approveVisible
}
{
/* open={approveVisible}*/
}
data=
{
recordData
}
{
/* data={recordData}*/
}
title=
'提现审批'
{
/* title='提现审批'*/
}
closed=
{
handleCloseAll
}
{
/* closed={handleCloseAll}*/
}
/>
{
/*/>*/
}
</>
</>
);
);
}
}
src/pages/pointManage/pointList/index.tsx
浏览文件 @
3e967a6d
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
{
User
ScorePage
ListType
}
from
'~/api/interface/pointManageType'
;
import
{
User
Point
ListType
}
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
navigat
ion
=
useNavigate
();
const
navigat
e
=
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
.
User
ScorePage
List
({
const
res
=
await
PointManageAPI
.
User
Point
List
({
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: 'u
i
d', align: 'center' },
{
title
:
'UID'
,
dataIndex
:
'u
serAccountI
d'
,
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'
...
...
src/router/index.ts
浏览文件 @
3e967a6d
...
@@ -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
)];
}
}
...
...
src/router/router.tsx
浏览文件 @
3e967a6d
...
@@ -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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论