Commit 90f46fa3 authored by GuanHua's avatar GuanHua

fix:修改支付页面

parent cf8357af
......@@ -12,11 +12,12 @@ const { Dragger } = Upload
interface TransferPayWayPropsType {
payInfo: GetOrderOrderPayDetailsResponse
orderId: number
orderId: number,
onChange: Function
}
const TransferPayWay: React.FC<TransferPayWayPropsType> = (props) => {
const { payInfo, orderId } = props
const { payInfo, orderId, onChange } = props
const [loading, setLoading] = useState<boolean>(false)
const [payOrderUrl, setPayOrderUrls] = useState<string>()
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
......@@ -75,11 +76,13 @@ const TransferPayWay: React.FC<TransferPayWayPropsType> = (props) => {
if (res.code === 1000) {
message.destroy()
message.success("支付成功")
onChange(true)
} else {
setConfirmLoading(false)
onChange(false)
}
}).catch(() => {
onChange(false)
setConfirmLoading(false)
})
}
......
......@@ -48,6 +48,7 @@ const getPayTypeTitle = (type) => {
const PayPage: React.FC<PayPagePropsType> = (props) => {
const { shopInfo, mallInfo, layoutType, } = props
const [payState, setPayState] = useState<boolean>(false)
const { orderId } = props.location.query
const [pageTitle, setPageTitle] = useState<string>()
const [payType] = useState<string | number>(PayWayType.bank)
......@@ -72,6 +73,10 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
})
}
const handlePayChangge = (state) => {
setPayState(state)
}
const renderPayWay = () => {
if (!payInfo) {
return
......@@ -89,7 +94,7 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
case PayWayType.bank:
return <BankPayWay />
case PayWayType.transfer:
return <TransferPayWay payInfo={payInfo} orderId={orderId} />
return <TransferPayWay payInfo={payInfo} orderId={orderId} onChange={(state) => handlePayChangge(state)} />
default:
return null
}
......@@ -98,7 +103,7 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
window.location.href = '/'
}
return payInfo ? (
return payInfo ? !payState ? (
<div className={styles.pay}>
<CommonHeader
logoUrl={(layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) ? shopInfo?.logo : mallInfo.logoUrl}
......@@ -110,7 +115,16 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
}
</div>
</div>
) : <div>
) : (<div>
<CommonHeader
logoUrl={(layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) ? shopInfo?.logo : mallInfo.logoUrl}
title="支付成功"
/>
<div className={styles.errmsg}>
<p>支付成功</p>
<Button type="primary" className={styles.backbtn} onClick={() => backHome()}>继续购物</Button>
</div>
</div>) : <div>
<CommonHeader
logoUrl={(layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) ? shopInfo?.logo : mallInfo.logoUrl}
title="支付错误"
......
......@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react'
import CommonHeader from '../components/CommonHeader'
import InputNumber from '@/components/InputNumber'
import Recommand from '../components/Recommand'
import { history } from 'umi'
import cx from 'classnames'
import { Checkbox, Affix, message, Modal, Button } from 'antd'
import styles from './index.less'
......
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