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
黄庭坚
jinfa-platform
Commits
924ec0e0
Commit
924ec0e0
authored
Dec 15, 2021
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改结算支付订单相同导致服务支付
parent
f41c8893
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
8 deletions
+24
-8
index.tsx
...balance/accountsPayable/components/GetCodeModal/index.tsx
+13
-5
index.tsx
src/pages/balance/accountsPayable/settlementList/index.tsx
+11
-3
No files found.
src/pages/balance/accountsPayable/components/GetCodeModal/index.tsx
View file @
924ec0e0
import
React
,
{
useState
}
from
'react'
;
import
React
,
{
use
Effect
,
use
State
}
from
'react'
;
import
{
Button
,
Input
,
message
,
Modal
}
from
'antd'
;
import
styles
from
'./index.less'
import
useCountDown
from
'@/utils/hooks'
;
...
...
@@ -13,11 +13,13 @@ interface Iprops {
// onResendCode: () => void,
/** 商户订单号 */
tradeCode
:
string
onClose
?:
()
=>
void
onClose
?:
()
=>
void
,
/** 时间戳随机码 */
randomCode
:
string
}
const
GetCodeModal
:
React
.
FC
<
Iprops
>
=
(
props
:
Iprops
)
=>
{
const
{
title
=
'验证码'
,
onOk
,
visible
,
tradeCode
,
onClose
}
=
props
;
const
{
title
=
'验证码'
,
onOk
,
visible
,
tradeCode
,
onClose
,
randomCode
}
=
props
;
const
[
code
,
setCode
]
=
useState
<
string
>
(
""
);
const
{
text
,
isActive
,
start
}
=
useCountDown
({
maxTime
:
60
,
...
...
@@ -35,13 +37,19 @@ const GetCodeModal: React.FC<Iprops> = (props: Iprops) => {
onOk
?.(
code
)
}
useEffect
(()
=>
{
if
(
visible
)
{
start
();
}
},
[
visible
])
const
handleChange
=
(
e
)
=>
{
setCode
(
e
.
target
.
value
);
}
const
handleSendCode
=
async
()
=>
{
const
{
code
,
data
}
=
await
getPayEAccountAllInPayReSendPayCode
({
tradeCode
:
tradeCode
tradeCode
:
`
${
tradeCode
}
-
${
randomCode
}
`
})
if
(
code
===
1000
)
{
start
();
...
...
@@ -70,7 +78,7 @@ const GetCodeModal: React.FC<Iprops> = (props: Iprops) => {
</
div
>
<
Button
disabled=
{
isActive
}
onClick=
{
handleSendCode
}
>
{
text
}
</
Button
>
</
div
>
<
div
className=
{
styles
.
tips
}
>
已将验证码发送到您尾号为2800的手机号
</
div
>
{
/* <div className={styles.tips}>已将验证码发送到您尾号为2800的手机号</div> */
}
</
div
>
</
Modal
>
)
...
...
src/pages/balance/accountsPayable/settlementList/index.tsx
View file @
924ec0e0
...
...
@@ -54,6 +54,11 @@ const SettlementList = () => {
const
[
files
,
setFiles
]
=
useState
([]);
const
[
qrcodeUrl
,
setQrcodeUrl
]
=
useState
<
string
>
(
""
);
const
[
currentUniversalPay
,
setCurrentUniversalPay
]
=
useState
<
UniversalPay
|
null
>
(
null
);
/**
* 时间戳做随机码,
* 这里有个场景就是当我付款时,点微信支付等,然后取消了付款,再次点付款(微信支付),此时通联那边会认为这个支付订单会重复了,所以需要虚构一个随机码去标识一下
* */
const
[
randomCode
,
setRandomCode
]
=
useState
<
string
>
(
""
);
/** 轮询请求支付状态 */
const
{
cycleCancel
,
cycleStart
,
result
}
=
useCycleRequest
({
offsetTime
:
3
,
endCount
:
10
});
...
...
@@ -163,14 +168,16 @@ const SettlementList = () => {
const
channel
=
params
.
payChannel
;
try
{
setUniversalPayLoading
(
true
)
// TODO 加一个随机数
const
{
data
,
code
,
message
:
msg
}
=
await
postSettleAccountsMemberSettlementCommunicationPay
({
id
:
itemInfo
.
id
,
payChannelType
:
params
.
payChannel
,
})
}
,
{
ctlType
:
'none'
}
)
if
(
code
!==
1000
)
{
message
.
error
(
msg
);
return
;
}
setRandomCode
(
""
+
new
Date
().
valueOf
());
setCurrentUniversalPay
(
channel
as
UniversalPay
);
if
([
UNIVERSAL_PAY_WECHAT
,
UNIVERSAL_PAY_ALIPAY
].
includes
(
channel
))
{
message
.
loading
({
...
...
@@ -201,13 +208,14 @@ const SettlementList = () => {
/** 轮询接口 */
useEffect
(()
=>
{
if
(
modals
.
qrcodeModal
)
{
cycleStart
(
postSettleAccountsMemberSettlementCommunicationPayResult
,
{
settlementNo
:
itemInfo
.
settlementNo
});
cycleStart
(
postSettleAccountsMemberSettlementCommunicationPayResult
,
{
settlementNo
:
`
${
itemInfo
.
settlementNo
}
-
${
randomCode
}
`
});
}
},
[
modals
])
useEffect
(()
=>
{
if
(
result
&&
result
.
code
===
1000
&&
result
.
data
)
{
message
.
success
(
'支付成功'
)
handleClose
(
'qrcodeModal'
);
cycleCancel
();
formActions
.
submit
();
}
...
...
@@ -304,7 +312,7 @@ const SettlementList = () => {
onOk=
{
handleCompleteSmsCode
}
tradeCode=
{
itemInfo
?.
settlementNo
}
onClose=
{
()
=>
handleClose
(
'smsCodeModal'
)
}
randomCode=
{
randomCode
}
/>
</
PageHeaderWrapper
>
)
...
...
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