/** * 新充电流程:验证插头模块 * @邠心vbe on 2023/06/20 */ import React, { useEffect, useState } from 'react'; import { View, Text, Image, StyleSheet, ScrollView, Pressable } from 'react-native'; import app from '../../../app.json'; import Button from '../../components/Button'; import TextView from '../../components/TextView'; import { PaymentList } from '../chargeV2/Payment'; import PaymentListV2 from '../chargeV2/PaymentListV2'; import StatusImage from './StatusImage'; import ConnectorInfo from './ConnectorInfo'; import utils from '../../utils/utils'; import PagerUtil from '../chargeV2/PagerUtil'; 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')} { isAuthentic && <> {$t('charging.paymentMethod')} { app.charge.paymentMethod ? : } { app.v3.vouchers && <> {$t('voucher.vouchers')} PagerUtil.toSelectVoucher(connectorInfo.chargeBoxId, connectorInfo.connectorId)}> { utils.isNotEmpty(selectedVoucher.userVoucherId) ? {selectedVoucher.voucherName} {selectedVoucher.voucherDesc} : {$t("voucher.selectVoucher")} } } } { isAuthentic &&