/** * 新充电流程:验证插头模块 * @邠心vbe on 2023/06/20 */ import React, { useEffect, useState } from 'react'; import { View, Image, StyleSheet, Pressable } from 'react-native'; import app from '../../../app.json'; import Button, { ElevationObject } from '../../components/Button'; import TextView from '../../components/TextView'; import { PaymentList } from '../chargeV2/Payment'; import PaymentListV2 from '../chargeV2/PaymentListV2'; import utils from '../../utils/utils'; export default StepAuth = ({ status="", currentPayment, onStartCharge, connectorInfo={}, selectedVoucher={}, onPaymentMethodChanged }) => { const [loadingEmps, setEmps] = useState(""); const [isAuthentic, setAuthentic] = useState(false) useEffect(() => { if (status == "Preparing") { setAuthentic(true); } else { changeEmps(); } }, []); useEffect(() => { if (status == "Preparing") { setAuthentic(true); } else { setTimeout(() => { changeEmps(); }, 500); } }, [loadingEmps, status]); const changeEmps = () => { let emp = loadingEmps; if (loadingEmps.length == 3) { emp = ""; } else { emp += "."; } setEmps(emp); } return ( { isAuthentic ? {$t('charging.stepAuthenticated')} : {$t('charging.stepAuthenticating')} {loadingEmps} } {$t(isAuthentic ? 'charging.stepAuthenticatedDesc' : 'charging.stepAuthenticatingDesc')} {$t('charging.paymentMethod')} { app.v3.vouchers && {$t('voucher.vouchers')} } {/* */} { app.charge.paymentMethod ? : } { app.v3.vouchers && isAuthentic && PagerUtil.toSelectVoucher(connectorInfo.chargeBoxId, connectorInfo.connectorId)}> { utils.isNotEmpty(selectedVoucher.userVoucherId) ? {selectedVoucher.voucherName} {selectedVoucher.voucherDesc} : {$t("voucher.selectVoucher")} } { isAuthentic && } } { isAuthentic ?