|
|
@@ -1,5 +1,5 @@
|
|
|
-import {useSelector} from "react-redux";
|
|
|
-import {getCurrPayOrder} from "@features/paySlice";
|
|
|
+import {useDispatch, useSelector} from "react-redux";
|
|
|
+import {getCurrPayOrder, getPaymentOrderQRStatus} from "@features/paySlice";
|
|
|
import React, {useEffect, useState} from "react";
|
|
|
import Spring from "@components/Spring";
|
|
|
import styles from "./styles.module.scss";
|
|
|
@@ -11,11 +11,19 @@ import {ReactComponent as Warning} from '@assets/singlesvg/warning.svg';
|
|
|
import {ROUTE_PATH} from "@constants/routes";
|
|
|
import {useNavigate} from "react-router-dom";
|
|
|
import WOrderSuccess from "@widgets/WPaymentOrder/WOrderSuccess";
|
|
|
+import qricon from "@assets/pay/mx/qricon.png";
|
|
|
+import qrlogo from "@assets/pay/mx/qrlogo.png";
|
|
|
+import {REQ_STATUS} from "@api/config";
|
|
|
+import {reqPaymentOrderQR} from "@features/api";
|
|
|
+import {getUserInfo} from "@features/mainSlice";
|
|
|
const i18n=global.i18n;
|
|
|
const MXPayOrder = ({close}) => {
|
|
|
const orderInfo=useSelector(getCurrPayOrder);
|
|
|
const [leftTime,setLeftTime]=useState(0);
|
|
|
const navigate=useNavigate();
|
|
|
+ const qrstatus=useSelector(getPaymentOrderQRStatus);
|
|
|
+ const dispatch = useDispatch();
|
|
|
+ const user=useSelector(getUserInfo);
|
|
|
const getLeftTime=()=>{
|
|
|
if (orderInfo==null)return 0;
|
|
|
let deadline=Number(orderInfo.deadline);
|
|
|
@@ -51,9 +59,21 @@ const MXPayOrder = ({close}) => {
|
|
|
}
|
|
|
};
|
|
|
},[orderInfo])
|
|
|
+
|
|
|
const onClickCustom=()=>{
|
|
|
navigate(ROUTE_PATH.CUSTOMER);
|
|
|
}
|
|
|
+ const callback=()=>{
|
|
|
+ navigate(ROUTE_PATH.PAY_ORDER_QR,{replace:true});
|
|
|
+ }
|
|
|
+ const onClickQR=()=>{
|
|
|
+ if (qrstatus===REQ_STATUS.LOADING)return;
|
|
|
+ if (global.loadingCircular)global.loadingCircular.show(true);
|
|
|
+ let data={...orderInfo.arg,user,callback};
|
|
|
+ dispatch(reqPaymentOrderQR(data)).then((respose)=>{
|
|
|
+ if (global.loadingCircular)global.loadingCircular.hide();
|
|
|
+ })
|
|
|
+ }
|
|
|
const renderCopyAll=()=>{
|
|
|
let content=i18n.t("deposit.order_info_mx.title1")+":"+orderInfo.bank+"\n";
|
|
|
content+=i18n.t("deposit.order_info_mx.title2")+":"+orderInfo.benefi+"\n";
|
|
|
@@ -191,13 +211,34 @@ const MXPayOrder = ({close}) => {
|
|
|
</>
|
|
|
)
|
|
|
}
|
|
|
+ const renderQRBtn=()=>{
|
|
|
+ return (
|
|
|
+ <button className={"button-green"} onClick={() => {
|
|
|
+ onClickQR();
|
|
|
+ }}>
|
|
|
+ <div className={styles.qr_btn_con}>
|
|
|
+ <div className={styles.qr_sub_con}>
|
|
|
+ <img className={styles.qr_icon} src={qricon}/>
|
|
|
+ <div className={styles.qr_text}>
|
|
|
+ <span>{i18n.t("deposit.order_info_mx.qr_via")}</span>
|
|
|
+ <span>{i18n.t("deposit.order_info_mx.qr_code")}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className={styles.qr_sub_con}>
|
|
|
+ <img className={styles.qr_logo} src={qrlogo}/>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </button>
|
|
|
+ )
|
|
|
+ }
|
|
|
const renderOrderInfo = () => {
|
|
|
return (
|
|
|
<div className={styles.order_info}>
|
|
|
{renderBasic()}
|
|
|
{/*{renderCopyAll()}*/}
|
|
|
{renderTips()}
|
|
|
- {renderCustomer()}
|
|
|
+ {/*{renderCustomer()}*/}
|
|
|
+ {renderQRBtn()}
|
|
|
</div>
|
|
|
)
|
|
|
}
|