StepStart.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /**
  2. * 新充电流程:充电前的模块
  3. * @邠心vbe on 2023/06/20
  4. */
  5. import React from 'react';
  6. import { View, Text, Image, StyleSheet, ScrollView } from 'react-native';
  7. import Button, { ElevationObject } from '../../components/Button';
  8. import TextView from '../../components/TextView';
  9. import { ChargeStyle } from '../chargeV2/Charging';
  10. import { PaymentList } from '../chargeV2/Payment';
  11. export default StepStart = ({
  12. connectorInfo={},
  13. currentPayment,
  14. curerntPerUse,
  15. onPaymentMethodChanged,
  16. onAuthenticate
  17. }) => {
  18. return (
  19. <ScrollView
  20. style={ui.flex1}
  21. contentContainerStyle={$padding(16)}>
  22. <View style={ui.center}>
  23. <Image
  24. style={styles.stepImage}
  25. resizeMode="contain"
  26. source={require('../../images/site/charging-status-unknow.png')}/>
  27. <TextView style={styles.stepTitle}>{$t('charging.stepInsertConnector')}</TextView>
  28. <TextView style={styles.stepDesc}>{$t('charging.stepInsertConnectorDesc')}</TextView>
  29. </View>
  30. <View style={styles.infoRow}>
  31. <View style={styles.infoCard}>
  32. <TextView style={styles.infoTitle}>{$t('charging.labelType')}</TextView>
  33. <TextView
  34. numberOfLines={1}
  35. ellipsizeMode="tail"
  36. style={styles.infoText}>{connectorInfo.chargeType}{connectorInfo.wattage || "AC22"}</TextView>
  37. <TextView style={styles.infoDesc}></TextView>
  38. </View>
  39. <View style={styles.infoCard}>
  40. <TextView style={styles.infoTitle}>{$t('charging.labelPower')}</TextView>
  41. <TextView
  42. numberOfLines={1}
  43. ellipsizeMode="tail"
  44. style={styles.infoText}>{connectorInfo.wattage || "0"} kW{/*connectorInfo.rateType*/}</TextView>
  45. <TextView style={styles.infoDesc}></TextView>
  46. </View>
  47. </View>
  48. <View style={styles.infoRow}>
  49. <View style={styles.infoCard}>
  50. <TextView style={styles.infoTitle}>{$t('charging.labelRate')}</TextView>
  51. {/* <Text
  52. numberOfLines={1}
  53. ellipsizeMode="tail"
  54. style={styles.infoText}>{connectorInfo.rate || "0.00"}/{connectorInfo.rateType || "kWh"}</Text> */}
  55. <TextView
  56. numberOfLines={2}
  57. ellipsizeMode="tail"
  58. style={styles.infoText}>{connectorInfo.rates || "S$0.00/kWh"}</TextView>
  59. <TextView
  60. numberOfLines={1}
  61. ellipsizeMode="tail"
  62. style={styles.infoDesc}>({connectorInfo.userRates || "S$0.00/kWh"})</TextView>
  63. </View>
  64. <View style={styles.infoCard}>
  65. <TextView style={styles.infoTitle}>{$t('charging.labelStatus')}</TextView>
  66. <TextView
  67. style={[ChargeStyle.statusAuthenticated, styles.infoStatus]}>
  68. {$t('charging.statusAvailable')}
  69. </TextView>
  70. </View>
  71. </View>
  72. <EndView/>
  73. <EndView half/>
  74. <TextView style={styles.label}>{$t('charging.paymentMethod')}</TextView>
  75. <PaymentList
  76. payType={currentPayment}
  77. payPerUse={curerntPerUse}
  78. onMethodChange={onPaymentMethodChanged}
  79. />
  80. <Button
  81. style={styles.buttonView}
  82. text={$t('charging.btnAuthenticate')}
  83. elevation={1.5}
  84. borderRadius={6}
  85. onClick={onAuthenticate}/>
  86. </ScrollView>
  87. );
  88. }
  89. const styles = StyleSheet.create({
  90. stepImage: {
  91. width: $vw(70),
  92. height: $vw(16),
  93. margin: 16
  94. },
  95. stepTitle: {
  96. fontSize: 24,
  97. fontWeight: 'bold',
  98. color: colorAccent
  99. },
  100. stepDesc: {
  101. color: textPrimary,
  102. fontSize: 16,
  103. textAlign: 'center',
  104. ...$padding(0, 32, 48)
  105. },
  106. infoRow: {
  107. marginLeft: 16,
  108. marginBottom: 16,
  109. flexDirection: 'row'
  110. },
  111. infoCard: {
  112. flex: 1,
  113. paddingTop: 12,
  114. paddingBottom: 12,
  115. borderRadius: 10,
  116. marginRight: 16,
  117. alignItems: 'center',
  118. ...ElevationObject(5),
  119. backgroundColor: colorLight,
  120. },
  121. infoTitle: {
  122. color: textPrimary,
  123. fontSize: 12,
  124. paddingTop: 1
  125. },
  126. infoText: {
  127. color: textPrimary,
  128. fontSize: 15,
  129. textAlign: 'center',
  130. fontWeight: 'bold',
  131. ...$padding(12, 6)
  132. },
  133. infoDesc: {
  134. color: textPrimary,
  135. fontSize: 12,
  136. marginTop: -12,
  137. paddingBottom: 8
  138. },
  139. infoStatus: {
  140. fontSize: 16,
  141. fontWeight: 'bold',
  142. ...$padding(16, 8)
  143. },
  144. label: {
  145. color: '#000',
  146. fontSize: 14,
  147. fontWeight: 'bold',
  148. paddingTop: 16,
  149. paddingBottom: 8
  150. },
  151. buttonView: {
  152. marginTop: 8,
  153. marginBottom: 16
  154. }
  155. })