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
df3affc3
Commit
df3affc3
authored
Dec 15, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2' of
http://10.0.0.22:3000/lingxi/lingxi-business-paltform
into v2
parents
239fba41
bf4237fe
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
4 deletions
+88
-4
useCycleRequest.tsx
.../accountsPayable/settlementList/hooks/useCycleRequest.tsx
+44
-0
useHandleSettlementList.tsx
...sPayable/settlementList/hooks/useHandleSettlementList.tsx
+29
-2
index.tsx
src/pages/balance/accountsPayable/settlementList/index.tsx
+15
-2
No files found.
src/pages/balance/accountsPayable/settlementList/hooks/useCycleRequest.tsx
0 → 100644
View file @
df3affc3
import
{
postSettleAccountsMemberSettlementCommunicationPayResult
}
from
'@/services/SettleV2Api'
;
import
React
,
{
useEffect
,
useRef
,
useState
}
from
'react'
;
type
Options
=
{
/** 间隔秒 */
offsetTime
:
number
/** 达到多少次就停止 */
endCount
:
number
,
}
const
useCycleRequest
=
(
options
:
Options
)
=>
{
const
{
offsetTime
=
3
,
endCount
=
10
}
=
options
||
{}
const
times
=
useRef
(
0
);
const
interval
=
useRef
<
null
|
ReturnType
<
typeof
setInterval
>>
(
null
);
const
[
result
,
setResult
]
=
useState
(
null
);
const
start
=
(
fn
:
(
params
)
=>
Promise
<
any
>
,
params
)
=>
{
interval
.
current
=
setInterval
(
async
()
=>
{
// const res = await postSettleAccountsMemberSettlementCommunicationPayResult();
const
res
=
await
fn
(
params
);
setResult
(
res
);
times
.
current
+=
1
;
if
(
times
.
current
>
endCount
)
{
cancel
();
}
},
offsetTime
*
1000
)
}
const
cancel
=
()
=>
{
if
(
interval
.
current
)
{
clearInterval
(
interval
.
current
)
}
}
useEffect
(()
=>
{
return
()
=>
{
cancel
()
}
},
[])
return
{
cycleStart
:
start
,
cycleCancel
:
cancel
,
result
}
}
export
default
useCycleRequest
;
src/pages/balance/accountsPayable/settlementList/hooks/useHandleSettlementList.tsx
View file @
df3affc3
...
...
@@ -12,6 +12,8 @@ import { useCallback } from 'react';
import
{
GetSettleAccountsMemberSettlementPagePayableSettlementResponseDetail
}
from
'@/services/SettleV2Api'
;
import
{
ColumnsType
}
from
'antd/lib/table'
;
import
{
getIntl
}
from
'umi'
;
import
{
getPayAllInPayGetUserInfo
}
from
'@/services/PayV2Api'
;
import
{
message
}
from
'antd'
;
const
intl
=
getIntl
();
const
format
=
"YYYY-MM-DD HH:mm:ss"
const
URL_MAP
=
{
...
...
@@ -23,6 +25,19 @@ const URL_MAP = {
const
STATUS_COLOR
=
[
"default"
,
"warning"
,
"primary"
,
"danger"
,
"success"
];
/** 通联支付 个人会员 */
const
USER_MEMBER_TYPE
=
2
/** 通联支付企业会员 */
const
ENTERPRISE_MERBER_TYPE
=
3
/** 通联支付 未认证提示 */
const
UNVERIFY_TIPS
=
{
[
USER_MEMBER_TYPE
]:
'该会员未进行通联实名认证,暂不可收款'
,
[
ENTERPRISE_MERBER_TYPE
]:
'该会员暂未完成企业信息审核,暂不可收款;'
,
}
type
ModalsType
=
{
/** 查看付款 */
viewPay
:
boolean
,
...
...
@@ -67,9 +82,21 @@ function useHandleSettlementList() {
})
},
[])
const
handleAction
=
(
record
:
GetSettleAccountsMemberSettlementPagePayableSettlementResponseDetail
,
key
:
keyof
ModalsType
)
=>
{
const
handleAction
=
async
(
record
:
GetSettleAccountsMemberSettlementPagePayableSettlementResponseDetail
,
key
:
keyof
ModalsType
)
=>
{
setItemInfo
(
record
);
console
.
log
(
"key"
,
key
);
if
(
key
===
'universalPay'
)
{
const
{
code
,
data
,
message
:
msg
}
=
await
getPayAllInPayGetUserInfo
();
if
(
code
!==
1000
)
{
message
.
error
(
msg
);
return
;
}
if
(
!
(
data
.
memberType
===
USER_MEMBER_TYPE
&&
data
.
isIdentityChecked
===
1
||
data
.
memberType
===
ENTERPRISE_MERBER_TYPE
&&
data
.
status
===
2
))
{
message
.
error
(
UNVERIFY_TIPS
[
data
.
memberType
])
return
;
}
}
handleOpen
(
key
);
/** 通联支付 */
// if (record.payWay === 2 && record.status === COMPLETED) {
...
...
src/pages/balance/accountsPayable/settlementList/index.tsx
View file @
df3affc3
...
...
@@ -15,7 +15,7 @@ import { fetchOptions } from '../../common'
import
UploadVoucherModal
from
'../../components/UploadVoucherModal'
;
import
Voucher
from
'../../components/Voucher'
;
import
useSetSearchValueInTable
from
'@/hooks/useSetSearchValueInTable'
;
import
{
getSettleAccountsCommonGetSettlementOrderType
,
getSettleAccountsCommonGetSettlementStatus
,
getSettleAccountsMemberSettlementGetPayablePayProve
,
getSettleAccountsMemberSettlementPagePayableSettlement
,
GetSettleAccountsMemberSettlementPagePayableSettlementRequest
,
postSettleAccountsMemberSettlementCommunicationPay
,
postSettleAccountsMemberSettlementPay
}
from
'@/services/SettleV2Api'
;
import
{
getSettleAccountsCommonGetSettlementOrderType
,
getSettleAccountsCommonGetSettlementStatus
,
getSettleAccountsMemberSettlementGetPayablePayProve
,
getSettleAccountsMemberSettlementPagePayableSettlement
,
GetSettleAccountsMemberSettlementPagePayableSettlementRequest
,
postSettleAccountsMemberSettlementCommunicationPay
,
postSettleAccountsMemberSettlement
CommunicationPayResult
,
postSettleAccountsMemberSettlement
Pay
}
from
'@/services/SettleV2Api'
;
import
{
postReportSettlementMemberManualSettlement
}
from
'@/services/ReportV2Api'
;
import
OtherPayModal
from
'../components/OtherPayModal'
;
import
useHandleSettlementList
from
'./hooks/useHandleSettlementList'
;
...
...
@@ -24,6 +24,7 @@ import { UNIVERSAL_PAY_ALIPAY, UNIVERSAL_PAY_BALANCE, UNIVERSAL_PAY_QUICK, UNIVE
import
GetCodeModal
from
'../components/GetCodeModal'
;
import
{
postPayEAccountAllInPayConfirmPay
}
from
'@/services/PayV2Api'
;
import
QrcodeModal
from
'../components/QrcodeModal'
;
import
useCycleRequest
from
'./hooks/useCycleRequest'
;
const
{
onFieldValueChange$
}
=
FormEffectHooks
const
{
RangePicker
}
=
DatePicker
;
...
...
@@ -54,6 +55,9 @@ const SettlementList = () => {
const
[
qrcodeUrl
,
setQrcodeUrl
]
=
useState
<
string
>
(
""
);
const
[
currentUniversalPay
,
setCurrentUniversalPay
]
=
useState
<
UniversalPay
|
null
>
(
null
);
/** 轮询请求支付状态 */
const
{
cycleCancel
,
cycleStart
,
result
}
=
useCycleRequest
({
offsetTime
:
3
,
endCount
:
10
});
const
universalPayInfo1
=
useMemo
(()
=>
({
name
:
itemInfo
?.
settlementName
,
amount
:
itemInfo
?.
amount
,
...
...
@@ -151,6 +155,7 @@ const SettlementList = () => {
return
;
}
handleClose
(
'smsCodeModal'
);
formActions
.
submit
();
}
/** 通联支付, 付款 */
...
...
@@ -196,10 +201,18 @@ const SettlementList = () => {
/** 轮询接口 */
useEffect
(()
=>
{
if
(
modals
.
qrcodeModal
)
{
cycleStart
(
postSettleAccountsMemberSettlementCommunicationPayResult
,
{
settlementNo
:
itemInfo
.
settlementNo
});
}
},
[
modals
])
useEffect
(()
=>
{
if
(
result
&&
result
.
code
===
1000
&&
result
.
data
)
{
message
.
success
(
'支付成功'
)
cycleCancel
();
formActions
.
submit
();
}
},
[
result
])
/**
* 搜索
*/
...
...
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