Commit 88f9d246 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 订单线下支付线上确认方式凭证数据格式更改为数组

parent bceb5830
......@@ -311,7 +311,8 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
}
params.payPassword = encryptedByAES(code)
} else if(current === 1) {
params.payOrderUrls = payOrderUrls.join(',')
// params.payOrderUrls = payOrderUrls.join(',')
params.payOrderUrls = payOrderUrls
}
if(!settleAccountsError) {
......
import React, { useState, useEffect, useContext, useRef } from 'react'
import { Modal, List, Avatar, Button, Space } from 'antd'
import { usePageStatus } from '@/hooks/usePageStatus'
import { OrderDetailContext } from '../../_public/order/context'
import { PayOutWorkState } from '@/constants'
import { PublicApi } from '@/services/api'
import { history, Link } from 'umi'
import OverflowText from '@/components/OverflowText'
import { useHttpRequest } from '@/hooks/useHttpRequest'
import ImagePreview from '@/components/ImagePreview'
export interface OrderPayResultModalProps {
type: 'default' | 'preview',
currentRef: any
}
const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRef}) => {
const imgRef = useRef<any>({})
const { data } = useContext(OrderDetailContext)
const { id } = usePageStatus()
const [visible, setVisible] = useState(false)
const canCtlData = data?.paymentInformationResponses.find(v => v.externalState === PayOutWorkState.READY_CONFIRM_RESULT) || {}
const { run, loading } = useHttpRequest(PublicApi.postOrderConfirmedPaymentResultsOrder)
const transData = canCtlData.payOrderUrls ? canCtlData.payOrderUrls.split(',') : []
useEffect(() => {
if (currentRef) {
currentRef.current = {
visible,
setVisible
}
}
}, [])
const handleCancel = () => {
setVisible(false)
}
const handleConfirm = async (isReady) => {
const params = {
state: isReady,
id: Number(id),
paymentInformationId: canCtlData.id
}
const { code } = await run(params)
if (code === 1000) {
history.goBack()
}
}
return (
<Modal
title={type === 'default' ? '确认支付结果' : '查看支付结果'}
visible={visible}
onCancel={handleCancel}
confirmLoading={loading}
footer={(type === 'default' && transData) ? <Space>
<Button onClick={handleCancel}>取消</Button>
<Button onClick={() => handleConfirm(0)} type='dashed'>确认未到账</Button>
<Button onClick={() => handleConfirm(1)} type='primary'>确认到账</Button>
</Space> : null}
>
<List
itemLayout="horizontal"
dataSource={transData || []}
renderItem={(item: string, index: number) => (
<List.Item style={{fontSize: 12}} extra={<Button type='link' onClick={() => imgRef.current.toggle(index)}>预览</Button>}>
<OverflowText style={{flex: '.9'}}>
{item}
</OverflowText>
<ImagePreview src={transData || []} currentRef={imgRef}/>
</List.Item>
)}
/>
</Modal>
)
}
OrderPayResultModal.defaultProps = {}
export default OrderPayResultModal
\ No newline at end of file
import React, { useState, useEffect, useContext, useRef } from 'react'
import { Modal, List, Avatar, Button, Space } from 'antd'
import { usePageStatus } from '@/hooks/usePageStatus'
import { OrderDetailContext } from '../../_public/order/context'
import { PayOutWorkState } from '@/constants'
import { PublicApi } from '@/services/api'
import { history, Link } from 'umi'
import OverflowText from '@/components/OverflowText'
import { useHttpRequest } from '@/hooks/useHttpRequest'
import ImagePreview from '@/components/ImagePreview'
export interface OrderPayResultModalProps {
type: 'default' | 'preview',
currentRef: any
}
const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRef}) => {
const imgRef = useRef<any>({})
const { data } = useContext(OrderDetailContext)
const { id } = usePageStatus()
const [visible, setVisible] = useState(false)
const canCtlData = data?.paymentInformationResponses.find(v => v.externalState === PayOutWorkState.READY_CONFIRM_RESULT) || {}
const { run, loading } = useHttpRequest(PublicApi.postOrderConfirmedPaymentResultsOrder)
// const transData = canCtlData.payOrderUrls ? canCtlData.payOrderUrls.split(',') : []
const transData = canCtlData.payOrderUrls ? canCtlData.payOrderUrls : []
useEffect(() => {
if (currentRef) {
currentRef.current = {
visible,
setVisible
}
}
}, [])
const handleCancel = () => {
setVisible(false)
}
const handleConfirm = async (isReady) => {
const params = {
state: isReady,
id: Number(id),
paymentInformationId: canCtlData.id
}
const { code } = await run(params)
if (code === 1000) {
history.goBack()
}
}
return (
<Modal
title={type === 'default' ? '确认支付结果' : '查看支付结果'}
visible={visible}
onCancel={handleCancel}
confirmLoading={loading}
footer={(type === 'default' && transData) ? <Space>
<Button onClick={handleCancel}>取消</Button>
<Button onClick={() => handleConfirm(0)} type='dashed'>确认未到账</Button>
<Button onClick={() => handleConfirm(1)} type='primary'>确认到账</Button>
</Space> : null}
>
<List
itemLayout="horizontal"
dataSource={transData || []}
renderItem={(item: string, index: number) => (
<List.Item style={{fontSize: 12}} extra={<Button type='link' onClick={() => imgRef.current.toggle(index)}>预览</Button>}>
<OverflowText style={{flex: '.9'}}>
{item}
</OverflowText>
<ImagePreview src={transData || []} currentRef={imgRef}/>
</List.Item>
)}
/>
</Modal>
)
}
OrderPayResultModal.defaultProps = {}
export default OrderPayResultModal
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