import React, { FC, useEffect, useState } from "react"; import { withRouter, RouteComponentProps } from "react-router-dom"; import { Typography, Button, Checkbox, message } from "antd"; import { CodeInput } from "@/components/CustComponents"; import { ConfirmParams } from "@/api/service/PurchaseService"; import MainLayout from "@/layout"; import Api from "@/api"; import "./index.scss"; import { HTTP_STATUS } from "@/shared/common/constants"; type P = RouteComponentProps & {}; const { Paragraph, Text, Title } = Typography; const PaymentConfirm: FC

= props => { const [contextId, setContextId] = useState(""); const [code, setCode] = useState(""); const [entity, setEntity] = useState(null); const [agreement, setAgreement] = useState(false); useEffect(() => { const { state } = props.location; if (state && state.contextId) { const contextId = state.contextId; setContextId(contextId); console.log({ contextId }); Api.purchase .getConfirmParams({ contextId: encodeURIComponent(contextId) }) .then(r => { console.log({ r }); setEntity(r.data); }); } }, []); const handelChange = e => { setCode(e.target.value); }; const onCancel = () => { props.history.goBack(); }; const onSubmit = () => { if (contextId && code) { const params = { contextId, verifyCode: code }; console.log({ params }); Api.purchase.confirm(params).then(r => { console.log(r); if (HTTP_STATUS.SUCCESSS === r.code) { message.success("订单确认成功"); props.history.push("/order"); } else { message.error(r.message); } }); } else { message.error("请输入验证码"); } }; return (

请确认支付信息
公司名称: {entity ? entity.companyName : ""} 公司联系人: {entity ? entity.contactName : "--"} 现金账户可用余额: {entity ? entity.balance : "--"} 订单金额: {entity ? entity.totalAmount : "--"} 应付货款: {entity ? entity.payAmount : "--"} 联系人手机: {entity ? entity.phone : "--"} 手机验证码: { setAgreement(e.target.checked); }} > 我同意:下单后,从我的现金账户扣取应付货款金额!
); }; export default withRouter(PaymentConfirm);