Commit 90f46fa3 authored by GuanHua's avatar GuanHua

fix:修改支付页面

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