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

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

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