diff --git a/src/pages/Payment/MultiPaymentWindow.js b/src/pages/Payment/MultiPaymentWindow.js index 9525b53..77e3131 100644 --- a/src/pages/Payment/MultiPaymentWindow.js +++ b/src/pages/Payment/MultiPaymentWindow.js @@ -34,7 +34,7 @@ import FpsIcon from "assets/images/icons/fps.svg"; const MultiPaymentWindow = (props) => { const windowTitle = "請選擇付款方式"; - const [content, setContent] = useState(); + // const [content, setContent] = useState(); const [loadtTransactionData, setLoadtTransactionData] = useState({}); const [loadAvailableMethodData, setLoadAvailableMethodData] = useState([]); const [paymentMethod, setPaymentMethod] = useState(""); @@ -106,110 +106,10 @@ const MultiPaymentWindow = (props) => { props.setConfirmPayment(true); }; - // const getMethodImgClass = (method) => () =>{ - // setPaymentMethodClass() - // return paymentMethod == method || paymentMethod == "" ? "" : "grayscale"; - // } - useEffect(() => { if(props.selectedPaymentMethod === ""){ setPaymentMethod("") } - if (availableMethodData.length>0){ - setContent( - - {/* - - - - 交易參考編號: - - - - - {props.transactionData.transactionid} - - - - - - - - - 付款金額: - - - - - {"HK$ "+FormatUtils.currencyFormat(props.totalAmount)} - - - - */} - - - - - 請選擇付款方法: - - - - - - - - - - - - - - - - - - - - - - - {paymentMethod !=""? - - - - - 已選擇付款方法: - - - - - {paymentMethod} - - - - - : null} - - ) - }else{ - - - 付款功能現在不可用。 - - - } }, [availableMethodData]); const formik = useFormik({ @@ -256,19 +156,80 @@ const MultiPaymentWindow = (props) => { */} {!props.onReady ? - :content + :availableMethodData.length>0? + + + + + + 請選擇付款方法: + + + + + + + + + + + + + + + + + + + + + + + {paymentMethod !=""? + + + + + 已選擇付款方法:  + + + + + {paymentMethod} + + + + + : null} + : + + + 付款功能現在不可用。 + + } - - - 付款總額(HK$): + + 付款總額(HK$):  - + {" HK$ " + FormatUtils.currencyFormat(props.totalAmount)} diff --git a/src/pages/Payment/index.js b/src/pages/Payment/index.js index c64bf6e..fbf037d 100644 --- a/src/pages/Payment/index.js +++ b/src/pages/Payment/index.js @@ -47,7 +47,7 @@ const Index = () => { const navigate = useNavigate() const location = useLocation(); - // const local = {en:"en_us", zh:"zh_hk", cn:"zh_cn"}; + // const local = {en:"en-us", zh:"zh-hk", cn:"zh-cn"}; const preferpaymentmethods = ['visa', 'mastercard', 'pps', 'creditcard', 'fps']; const [totalAmount, setTotalAmount] = useState(0); const [appIds, setAppIds] = useState([]); @@ -169,8 +169,12 @@ const Index = () => { let availableMethods = responseData.availablepaymentmethods; setAvailableMethods(availableMethods); + }, + onError: () =>{ + setOnReady(true) } }); + // const responseData = { // "availablepaymentmethods": [ // { @@ -298,25 +302,6 @@ const Index = () => { // }; // let availableMethods = responseData.availablepaymentmethods; // setAvailableMethods(availableMethods); - // if (availableMethods.length>0){ - // availableMethods.forEach((method)=>{ - // if(method.subtype === "FPS" ){ - // setFPSStatus(method) - // }else if (method.subtype === "CreditCard"){ - // method.supportedcard.forEach((supportedcard)=>{ - // if (supportedcard === "JCB" || supportedcard === "MasterCard" || supportedcard === "Visa"){ - // setCreditCardStatus(method) - // } else { - // if (supportedcard === "UnionPay"){ - // setUnionPayStatus(method) - // } - // } - // }) - // }else if (method.subtype === "PPS" ){ - // setPPSStatus(method) - // } - // }); - // } } useEffect(() => {