StepStop.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /**
  2. * 新充电流程:停止充电模块
  3. * @邠心vbe on 2023/06/20
  4. */
  5. import React, { useEffect, useState } from 'react';
  6. import { View, Text, Image, StyleSheet } from 'react-native';
  7. import { PaymentList } from '../chargeV2/Payment';
  8. export default StepStop = ({
  9. currentPayment,
  10. curerntPerUse
  11. }) => {
  12. const [loadingEmps, setEmps] = useState("");
  13. useEffect(() => {
  14. changeEmps();
  15. }, []);
  16. useEffect(() => {
  17. setTimeout(() => {
  18. changeEmps();
  19. }, 500);
  20. }, [loadingEmps]);
  21. const changeEmps = () => {
  22. let emp = loadingEmps;
  23. if (loadingEmps.length == 3) {
  24. emp = "";
  25. } else {
  26. emp += ".";
  27. }
  28. setEmps(emp);
  29. }
  30. return (
  31. <View style={styles.container}>
  32. <View style={styles.content}>
  33. <Image
  34. style={styles.stepImage}
  35. resizeMode="contain"
  36. source={require('../../images/site/charging-status-ready.png')}
  37. />
  38. <View style={ui.flexcc}>
  39. <Text style={styles.stepTitle}>{$t('charging.stepStoppingCharge')}</Text>
  40. <Text style={[styles.stepTitle, {width: 30, marginRight: -10}]}>{loadingEmps}</Text>
  41. </View>
  42. <Text style={styles.stepDesc}>{$t('charging.stepStoppingChargeDesc')}</Text>
  43. </View>
  44. <View style={styles.bottomView}>
  45. <Text style={styles.label}>{$t('charging.paymentMethod')}</Text>
  46. <PaymentList
  47. payType={currentPayment}
  48. payPerUse={curerntPerUse}
  49. />
  50. <View style={{height: 56}}/>
  51. </View>
  52. </View>
  53. )
  54. }
  55. const styles = StyleSheet.create({
  56. container: {
  57. flex: 1,
  58. padding: 16
  59. },
  60. content: {
  61. flex: 1,
  62. alignItems: 'center',
  63. justifyContent: 'center'
  64. },
  65. stepImage: {
  66. width: $vw(70),
  67. height: $vw(16),
  68. margin: 16
  69. },
  70. stepTitle: {
  71. fontSize: 24,
  72. fontWeight: 'bold',
  73. color: colorAccent
  74. },
  75. stepDesc: {
  76. color: textPrimary,
  77. fontSize: 16,
  78. textAlign: 'center',
  79. ...$padding(0, 32, 48)
  80. },
  81. label: {
  82. color: '#000',
  83. fontSize: 14,
  84. fontWeight: 'bold',
  85. paddingTop: 16,
  86. paddingBottom: 8
  87. },
  88. bottomView: {
  89. paddingBottom: 16
  90. },
  91. buttonView: {
  92. marginTop: 8
  93. }
  94. })