Commit 5b6e6d9f authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix:处理订单确认支付结果无法返回列表页

parent 032b8057
......@@ -4,9 +4,8 @@ import { usePageStatus } from '@/hooks/usePageStatus'
import { OrderDetailContext } from '../../context'
import { PayOutWorkState } from '@/constants'
import { PublicApi } from '@/services/api'
import { history, Link } from 'umi'
import { history } from 'umi'
import OverflowText from '@/components/OverflowText'
import { useHttpRequest } from '@/hooks/useHttpRequest'
export interface OrderPayResultModalProps {
type: 'default' | 'preview',
......@@ -17,9 +16,8 @@ const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRe
const { data } = useContext(OrderDetailContext)
const { id } = usePageStatus()
const [visible, setVisible] = useState(false)
const [isReady, setIsReady] = useState()
const [isReady, setIsReady] = useState<any>()
const canCtlData = data.paymentInformationResponses.find(v => v.externalState === PayOutWorkState.READY_CONFIRM_RESULT) || {}
const { run, loading } = useHttpRequest(PublicApi.postOrderPlatformConfirmedPaymentResultsOrder)
const transData = canCtlData.payOrderUrls?.split(',') || []
useEffect(() => {
......@@ -35,7 +33,7 @@ const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRe
setVisible(false)
}
const handleConfirm = async (isReady) => {
const handleConfirm = (isReady) => {
setIsReady(isReady)
const params = {
state: isReady,
......@@ -43,10 +41,15 @@ const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRe
paymentInformationId: canCtlData.id
}
const res = await run(params)
if (res && res.code === 1000) {
history.goBack()
}
PublicApi.postOrderPlatformConfirmedPaymentResultsOrder(params).then(res => {
if (res.code === 1000) {
setTimeout(() => {
history.goBack()
}, 1000)
} else {
setIsReady(null)
}
})
}
return (
......@@ -56,8 +59,8 @@ const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRe
onCancel={handleCancel}
footer={(type === 'default' && transData) ? <Space>
<Button onClick={handleCancel}>取消</Button>
<Button loading={isReady === 0 && loading} onClick={() => handleConfirm(0)} type='dashed'>确认未到账</Button>
<Button loading={isReady === 1 && loading} onClick={() => handleConfirm(1)} type='primary'>确认到账</Button>
<Button loading={isReady === 0} onClick={() => handleConfirm(0)} type='dashed'>确认未到账</Button>
<Button loading={isReady === 1} onClick={() => handleConfirm(1)} type='primary'>确认到账</Button>
</Space> : null}
>
<List
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment