StepStart.js 4.5 KB

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