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

fix: 订单支付对接联通网银/快捷支付

parent b770926a
...@@ -170,6 +170,9 @@ const ProductImageForm: React.FC<{}> = (props) => { ...@@ -170,6 +170,9 @@ const ProductImageForm: React.FC<{}> = (props) => {
} }
/** 编辑的时候 监听mousemove判断是否有选文件上传 */ /** 编辑的时候 监听mousemove判断是否有选文件上传 */
const addMonitor = () => {
}
const monitor = (ele) => { const monitor = (ele) => {
document.removeEventListener('mousemove', monitor); document.removeEventListener('mousemove', monitor);
if (ele.files && ele.files.length > 0) { if (ele.files && ele.files.length > 0) {
......
...@@ -66,6 +66,7 @@ const EAccountDetail: React.FC<{}> = () => { ...@@ -66,6 +66,7 @@ const EAccountDetail: React.FC<{}> = () => {
const [rechargeType, setRechargeType] = useState<string>('') const [rechargeType, setRechargeType] = useState<string>('')
const [loading, setLoading] = useState<boolean>(false) const [loading, setLoading] = useState<boolean>(false)
const [sendCodeVisible, setSendCodeVisible] = useState<boolean>(false) const [sendCodeVisible, setSendCodeVisible] = useState<boolean>(false)
const [payResultVisible, setPayResultVisible] = useState<boolean>(false)
const [tradeCode, setTradeCode] = useState<string>('') const [tradeCode, setTradeCode] = useState<string>('')
const [extra, setExtra] = useState<string>('') const [extra, setExtra] = useState<string>('')
...@@ -97,7 +98,7 @@ const EAccountDetail: React.FC<{}> = () => { ...@@ -97,7 +98,7 @@ const EAccountDetail: React.FC<{}> = () => {
const getAccountInfo = async () => { const getAccountInfo = async () => {
let res = await getPayEAccountAllInPayGetAccountDetail() let res = await getPayEAccountAllInPayGetAccountDetail()
const { code, data, message: msg } = res const { code, data, message: msg } = res
if(code !== 1000) { return message.error(msg) } if(code !== 1000) { return false }
setDetails(data) setDetails(data)
setExtra(`已将验证码发送至您尾号为${data.phone.substr(7, 4)}的手机号`) setExtra(`已将验证码发送至您尾号为${data.phone.substr(7, 4)}的手机号`)
getPayEAccountAllInPayGetEAccountStatusRecord({id: data.id + ''}).then(res => { getPayEAccountAllInPayGetEAccountStatusRecord({id: data.id + ''}).then(res => {
...@@ -114,7 +115,7 @@ const EAccountDetail: React.FC<{}> = () => { ...@@ -114,7 +115,7 @@ const EAccountDetail: React.FC<{}> = () => {
params.endTime = endTime params.endTime = endTime
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getPayEAccountAllInPayGetEAccountTradeRecord({...params}).then(res => { getPayEAccountAllInPayGetEAccountTradeRecord({...params}, {ctlType: 'none'}).then(res => {
const { data } = res const { data } = res
resolve(data) resolve(data)
}) })
...@@ -268,6 +269,8 @@ const EAccountDetail: React.FC<{}> = () => { ...@@ -268,6 +269,8 @@ const EAccountDetail: React.FC<{}> = () => {
setSendCodeVisible(true) setSendCodeVisible(true)
setTradeCode(data.tradeCode) setTradeCode(data.tradeCode)
} else if(code === 1000 && parasm.type === 'GATEWAY_VSP') { } else if(code === 1000 && parasm.type === 'GATEWAY_VSP') {
modalRef.current.setVisible(false)
setPayResultVisible(true)
// 网银 // 网银
window.open(data.codeUrl, '_blank') window.open(data.codeUrl, '_blank')
} }
...@@ -686,6 +689,16 @@ const EAccountDetail: React.FC<{}> = () => { ...@@ -686,6 +689,16 @@ const EAccountDetail: React.FC<{}> = () => {
</Form.Item> </Form.Item>
</Form> </Form>
</Modal> </Modal>
<Modal
title="支付"
visible={payResultVisible}
onOk={()=>{getAccountInfo();setPayResultVisible(false)}}
onCancel={()=>setPayResultVisible(false)}
okText="已完成支付"
cancelText="未完成支付"
>
<p>付款完成前请不要关闭此窗口。完成付款后请根据您的情况点击下面的按钮。</p>
</Modal>
</PageHeaderWrapper> </PageHeaderWrapper>
) )
} }
......
...@@ -60,6 +60,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -60,6 +60,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
const [tradeNo, setTradeNo] = useState<string>() // 需要轮询支付结果的交易号 const [tradeNo, setTradeNo] = useState<string>() // 需要轮询支付结果的交易号
const [fileLists, setFileLists] = useState<any>([]) const [fileLists, setFileLists] = useState<any>([])
const [tradeCode, setTradeCode] = useState<string>('') // 交易号 const [tradeCode, setTradeCode] = useState<string>('') // 交易号
const [payResultVisible, setPayResultVisible] = useState<boolean>(false)
useEffect(() => { useEffect(() => {
if (currentRef) { if (currentRef) {
...@@ -273,15 +274,13 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -273,15 +274,13 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
} }
setCurrent(99) setCurrent(99)
setPayStep(1) setPayStep(1)
} else if(checked.id === 14) {
console.log('选择了通联【网银】模式')
setTonglian(true)
mobilePayFlag.current = 0
setCurrent(99)
setPayStep(1)
} }
// else if(checked.id === 11 || checked.id === 12 || checked.id === 13 || checked.id === 14 || checked.id === 15) {
// console.log('选择了通联模式')
// // mobilePayFlag.current = 0
// // setCurrent(99)
// // setPayStep(1)
// // 11是微信 走微信模式
// // 12是支付宝 走支付宝模式
// }
} else { } else {
message.error(intl.formatMessage({id: 'transaction_components.qingxianxuanzezhifufangshi'})) message.error(intl.formatMessage({id: 'transaction_components.qingxianxuanzezhifufangshi'}))
} }
...@@ -380,11 +379,17 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -380,11 +379,17 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
setQrCodeInfo({ ...qrCodeInfo, generateCharacter: res.data.codeUrl }) setQrCodeInfo({ ...qrCodeInfo, generateCharacter: res.data.codeUrl })
setTradeNo(res.data.tradeNo) setTradeNo(res.data.tradeNo)
setQrLoading(false) setQrLoading(false)
} else if(tonglian && (checked.id === 15 || checked.id === 13)) { } else if(tonglian && (checked.id === 15 || checked.id === 13)) { // 快捷/余额走验证码模式
console.log(current, checked, '通联') console.log(current, checked, '通联验证码')
setPayStep(3) setPayStep(3)
setTradeCode(res.data.tradeNo) setTradeCode(res.data.tradeNo)
setCurrent(1000) setCurrent(1000)
} else if(tonglian && checked.id === 14) {
console.log(current, checked, '通联快捷跳转')
setCurrent(1000)
setVisible(false)
setPayResultVisible(true)
window.open(res.data.codeUrl, '_blank')
} else { } else {
history.goBack() history.goBack()
} }
...@@ -446,7 +451,10 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -446,7 +451,10 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
const submitFormCode = async (values) => { const submitFormCode = async (values) => {
const { code, data } = await postPayEAccountAllInPayConfirmPay({...values, tradeCode}) const { code, data } = await postPayEAccountAllInPayConfirmPay({...values, tradeCode})
console.log(code, data) if(code === 1000) {
setVisible(false)
history.goBack()
}
} }
const renderModalFooter = () => { const renderModalFooter = () => {
...@@ -487,7 +495,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -487,7 +495,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
return footer; return footer;
} }
return ( return (<>
<Modal <Modal
width={704} width={704}
title={<HeaderTitle current={current} />} title={<HeaderTitle current={current} />}
...@@ -817,6 +825,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -817,6 +825,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
<Form.Item <Form.Item
label="验证码" label="验证码"
// extra={extra} // extra={extra}
style={{textAlign: "left"}}
> >
<Row gutter={8}> <Row gutter={8}>
<Col span={19}> <Col span={19}>
...@@ -837,7 +846,17 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -837,7 +846,17 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
</div> </div>
} }
</Modal> </Modal>
) <Modal
title="支付"
visible={payResultVisible}
onOk={()=>{history.goBack();setPayResultVisible(false)}}
onCancel={()=>setPayResultVisible(false)}
okText="已完成支付"
cancelText="未完成支付"
>
<p>付款完成前请不要关闭此窗口。完成付款后请根据您的情况点击下面的按钮。</p>
</Modal>
</>)
} }
OrderPayModal.defaultProps = {} OrderPayModal.defaultProps = {}
......
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