StepStop.js 2.2 KB

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