Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linweijiong
jinfa-platform
Commits
659c3740
Commit
659c3740
authored
Nov 23, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:积分支付获取当前用户积分接口对接
parent
5b0367f8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
12 deletions
+54
-12
index.tsx
src/pages/lxMall/pay/components/point/index.tsx
+54
-12
No files found.
src/pages/lxMall/pay/components/point/index.tsx
View file @
659c3740
...
...
@@ -4,8 +4,8 @@ import PasswordInput from '../passwordInput'
import
{
LAYOUT_TYPE
}
from
'@/constants'
import
{
history
}
from
'umi'
import
{
GetOrderOrderPayDetailsResponse
}
from
'@/services/OrderApi'
import
{
GetMemberSecurityGetResponse
}
from
'@/services/MemberApi'
import
{
Button
,
message
}
from
'antd'
import
{
GetMemberSecurityGetResponse
,
GetMemberBusinessLrcRightPointGetResponse
}
from
'@/services/MemberApi'
import
{
Button
,
message
,
Spin
}
from
'antd'
import
{
numFormat
}
from
'@/utils/numberFomat'
import
{
PublicApi
}
from
'@/services/api'
import
{
linkToUrl
}
from
'../../utils'
...
...
@@ -21,27 +21,49 @@ interface PointPayWayPropsType {
}
const
PointPayWay
:
React
.
FC
<
PointPayWayPropsType
>
=
(
props
)
=>
{
const
{
payInfo
,
orderId
,
orderInfo
,
layoutType
,
shopUrlParam
}
=
props
const
{
payInfo
,
orderId
,
orderInfo
,
layoutType
,
onChange
,
shopUrlParam
}
=
props
const
[
securityInfo
,
setSecurityInfo
]
=
useState
<
GetMemberSecurityGetResponse
>
()
const
[
payPassword
,
setPayPassword
]
=
useState
<
string
>
(
''
)
const
[
type
,
setType
]
=
useState
<
string
>
(
'normal'
)
// normal: 普通;member:会员
const
[
pointInfo
,
setPointInfo
]
=
useState
<
GetMemberBusinessLrcRightPointGetResponse
>
()
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
<
boolean
>
(
false
)
const
[
payDisabled
,
setPayDisabled
]
=
useState
<
boolean
>
(
false
)
const
[
pageLoading
,
setPageLoading
]
=
useState
<
boolean
>
(
true
)
const
[
relType
,
setRelType
]
=
useState
<
number
>
(
0
)
// 0: 平台;1:会员
const
handlePasswordChange
=
(
value
:
string
)
=>
{
setPayPassword
(
value
)
}
const
handleChangeType
=
(
type
:
string
)
=>
{
setType
(
type
)
const
handleChangeType
=
(
type
:
number
)
=>
{
set
Rel
Type
(
type
)
}
useEffect
(()
=>
{
if
(
orderInfo
)
{
fetchPointInfo
()
fetchSecurity
()
}
},
[
orderInfo
])
const
fetchPointInfo
=
()
=>
{
let
param
=
{
memberId
:
orderInfo
.
supplyMembersId
,
roleId
:
orderInfo
.
supplyMembersRoleId
}
//@ts-ignore
PublicApi
.
getMemberBusinessLrcRightPointGet
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setPointInfo
(
res
.
data
)
setPageLoading
(
false
)
}
else
{
setPageLoading
(
false
)
onChange
(
true
,
res
.
message
)
}
}).
catch
(()
=>
{
})
}
const
fetchSecurity
=
()
=>
{
PublicApi
.
getMemberSecurityGet
().
then
(
res
=>
{
...
...
@@ -52,6 +74,10 @@ const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
}
const
pay
=
()
=>
{
if
(
!
checkPoint
())
{
message
.
error
(
"积分不足"
)
return
}
if
(
!
payPassword
||
payPassword
.
length
<
6
)
{
message
.
error
(
"请输入支付密码"
)
return
...
...
@@ -80,8 +106,24 @@ const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
}
const
checkPoint
=
()
=>
{
if
(
relType
===
0
)
{
if
(
Number
(
pointInfo
?.
platformScore
)
>=
Number
(
payInfo
?.
payPrice
))
{
return
true
}
else
{
return
false
}
}
else
{
if
(
Number
(
pointInfo
?.
memberScore
)
>=
Number
(
payInfo
?.
payPrice
))
{
return
true
}
else
{
return
false
}
}
}
return
(
<>
<
Spin
spinning=
{
pageLoading
}
>
<
div
className=
{
styles
.
common_title
}
>
<
span
>
积分支付
</
span
>
<
div
className=
{
styles
.
common_title_amount
}
>
...
...
@@ -92,21 +134,21 @@ const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
</
div
>
<
div
className=
{
styles
.
pay_point
}
>
<
div
className=
{
styles
.
pay_point_way_list
}
>
<
div
className=
{
cx
(
styles
.
pay_point_way_list_item
,
type
===
'normal'
?
styles
.
active
:
''
)
}
onClick=
{
()
=>
handleChangeType
(
'normal'
)
}
>
<
div
className=
{
cx
(
styles
.
pay_point_way_list_item
,
relType
===
0
?
styles
.
active
:
''
)
}
onClick=
{
()
=>
handleChangeType
(
0
)
}
>
<
div
className=
{
styles
.
pay_point_way_list_item_title
}
>
平台通用积分
</
div
>
<
div
className=
{
styles
.
pay_point_way_list_item_content
}
>
<
div
className=
{
styles
.
pay_point_way_list_item_point
}
>
<
label
>
30,000
</
label
>
<
label
>
{
numFormat
(
pointInfo
?.
platformScore
)
}
</
label
>
<
span
>
分
</
span
>
</
div
>
<
p
>
可用积分
</
p
>
</
div
>
</
div
>
<
div
className=
{
cx
(
styles
.
pay_point_way_list_item
,
type
===
'member'
?
styles
.
active
:
''
)
}
onClick=
{
()
=>
handleChangeType
(
'member'
)
}
>
<
div
className=
{
cx
(
styles
.
pay_point_way_list_item
,
relType
===
1
?
styles
.
active
:
''
)
}
onClick=
{
()
=>
handleChangeType
(
1
)
}
>
<
div
className=
{
cx
(
styles
.
pay_point_way_list_item_title
,
styles
.
member
)
}
>
会员专有积分
</
div
>
<
div
className=
{
styles
.
pay_point_way_list_item_content
}
>
<
div
className=
{
styles
.
pay_point_way_list_item_point
}
>
<
label
>
40,000
</
label
>
<
label
>
{
numFormat
(
pointInfo
?.
memberScore
)
}
</
label
>
<
span
>
分
</
span
>
</
div
>
<
p
>
可用积分
</
p
>
...
...
@@ -128,7 +170,7 @@ const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
</
div
>
)
}
</>
</
Spin
>
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment