ChargingStartView.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /**
  2. * V4充电页:扫码认证之后-充电开始之前
  3. * @邠心vbe on 2024/05/15
  4. */
  5. import React from 'react';
  6. import { StyleSheet, View } from 'react-native';
  7. import Button from '../../components/Button';
  8. import { ChargeStyle } from '../chargeV2/Charging';
  9. import { PageList } from '../Router';
  10. import TextView from '../../components/TextView';
  11. import utils from '../../utils/utils';
  12. export default ChargingStartView = ({
  13. isPrivate,
  14. stationInfo={},
  15. onEnterStation,
  16. canIntoCharging=false,
  17. onIntoCharging
  18. }) => (
  19. <View>
  20. <View style={{minHeight: $vht(70)}}>
  21. <EndView/>
  22. <View style={ui.flexcc}>
  23. <MaterialIcons
  24. name="info-outline"
  25. size={20}
  26. color="#ED3F3F"/>
  27. <TextView style={styles.gstText}>{$t('charging.tipsRatesTax2')}</TextView>
  28. </View>
  29. <View style={ui.flexc}>
  30. <MaterialCommunityIcons
  31. name="ev-plug-type2"
  32. size={24}
  33. color={textPrimary}
  34. />
  35. <TextView style={styles.title}>{$t('charging.acChargers')}</TextView>
  36. </View>
  37. { stationInfo.acRates?.length > 0
  38. ? stationInfo.acRates.map((item, index) => {
  39. return (
  40. <View key={index} style={styles.connectorInfoItem}>
  41. <View style={styles.infoGroup}>
  42. <TextView style={styles.infoText}>{item.typePower}</TextView>
  43. </View>
  44. <View style={styles.infoGroup}>
  45. <TextView style={styles.infoText}>{item.rates}</TextView>
  46. </View>
  47. <View style={styles.infoGroup}>
  48. <MaterialCommunityIcons
  49. name="circle"
  50. size={10}
  51. color={colorAccent}/>
  52. <TextView style={[styles.infoText, {paddingLeft: 4}]}>{item.connectorCount?.available + "/" + item.connectorCount?.all}</TextView>
  53. </View>
  54. </View>
  55. );
  56. })
  57. : <TextView style={ui.noData}>{$t('charging.noRates')}</TextView>
  58. }
  59. <View style={ui.flexc}>
  60. <MaterialCommunityIcons
  61. name="ev-plug-ccs2"
  62. size={24}
  63. color={textPrimary}
  64. />
  65. <TextView style={styles.title}>{$t('charging.dcChargers')}</TextView>
  66. </View>
  67. { stationInfo.dcRates?.length > 0
  68. ? stationInfo.dcRates.map((item, index) => {
  69. return (
  70. <View key={index} style={styles.connectorInfoItem}>
  71. <View style={styles.infoGroup}>
  72. <TextView style={styles.infoText}>{item.typePower}</TextView>
  73. </View>
  74. <View style={styles.infoGroup}>
  75. <TextView style={styles.infoText}>{item.rates}</TextView>
  76. </View>
  77. <View style={styles.infoGroup}>
  78. <MaterialCommunityIcons
  79. name="circle"
  80. size={10}
  81. color={colorAccent}/>
  82. <TextView style={[styles.infoText, {paddingLeft: 4}]}>{item.connectorCount?.available + "/" + item.connectorCount?.all}</TextView>
  83. </View>
  84. </View>
  85. );
  86. })
  87. : <TextView style={ui.noData}>{$t('charging.noRates')}</TextView>
  88. }
  89. { isPrivate &&
  90. <View style={styles.privateView}>
  91. <TextView style={styles.privateText}>{$t('charging.ratesPrivateNote')}</TextView>
  92. </View>
  93. }
  94. { utils.isNotEmpty(stationInfo.idleFee) && <>
  95. <View style={ui.flexc}>
  96. <MaterialCommunityIcons
  97. name="timeline-clock"
  98. size={24}
  99. color={"#ED3F3F"}
  100. />
  101. <TextView style={styles.title}>Idle Fee</TextView>
  102. </View>
  103. <TextView style={styles.discountText}>{"Grace Period of " + stationInfo.idleFee.gracePeriod + " Minutes. Rates are " + stationInfo.idleFee.idleFee + " per " + stationInfo.idleFee.everyMinute + ". Idle Fee is capped at " + stationInfo.idleFee.crapFee}</TextView>
  104. </>}
  105. { !!(stationInfo.hasDiscount) && <>
  106. <View style={ui.flexc}>
  107. <MaterialCommunityIcons
  108. name="brightness-percent"
  109. size={24}
  110. color={colorAccent}
  111. />
  112. <TextView style={styles.title}>{$t('charging.tipsDiscountTitle')}</TextView>
  113. </View>
  114. <TextView style={styles.discountText}>{$t('charging.tipsDiscount')}</TextView>
  115. </>}
  116. </View>
  117. {/* <Payment refreshId={refreshId}/> */}
  118. { canIntoCharging
  119. ? <Button
  120. style={styles.buttonView}
  121. borderRadius={4}
  122. text={$t('charging.btnIntoCharging')}
  123. //disabled={available}
  124. onClick={onIntoCharging}/>
  125. : <View style={styles.buttonGroup}>
  126. <Button
  127. style={styles.buttonLeft}
  128. text={$t('charging.enterStationId')}
  129. //disabled={available}
  130. onClick={onEnterStation}/>
  131. <Button
  132. style={styles.buttonRight}
  133. text={$t('charging.scanQR')}
  134. //disabled={available}
  135. onClick={() => {
  136. PagerUtil.onInnerScanQR();
  137. startPage(PageList.scanqr, {actionDetail: false, id: stationInfo?.id});
  138. }}/>
  139. </View>
  140. }
  141. </View>
  142. );
  143. const styles = StyleSheet.create({
  144. gstText: {
  145. color: '#ED3F3F',
  146. fontSize: 14,
  147. lineHeight: 20,
  148. fontWeight: 'bold',
  149. textAlign: 'center',
  150. paddingLeft: 4
  151. },
  152. title: {
  153. color: '#000',
  154. fontSize: 14,
  155. fontWeight: 'bold',
  156. paddingTop: 16,
  157. paddingLeft: 8,
  158. paddingBottom: 16
  159. },
  160. connectorInfoItem: {
  161. ...$padding(8, 16),
  162. alignItems: 'center',
  163. flexDirection: 'row'
  164. },
  165. infoGroup: {
  166. flex: 1,
  167. alignItems: 'center',
  168. justifyContent: 'center',
  169. flexDirection: 'row'
  170. },
  171. infoText: {
  172. color: textPrimary,
  173. fontSize: 12
  174. },
  175. updateTip: {
  176. color: '#aaa',
  177. fontSize: 10,
  178. textAlign: 'center',
  179. paddingTop: 32,
  180. paddingBottom: 16
  181. },
  182. privateView: {
  183. height: $vht(25),
  184. alignItems: 'center',
  185. justifyContent: 'center'
  186. },
  187. privateText: {
  188. color: '#FA5759'
  189. },
  190. buttonGroup: {
  191. marginTop: 16,
  192. marginBottom: 16,
  193. alignItems: 'center',
  194. flexDirection: 'row'
  195. },
  196. buttonView: {
  197. marginTop: 16,
  198. marginBottom: 32
  199. },
  200. buttonLeft: {
  201. flex: 1,
  202. elevation: 1.5,
  203. borderRadius: 4,
  204. backgroundColor: colorPrimary
  205. },
  206. buttonRight: {
  207. flex: 1,
  208. marginLeft: 16,
  209. elevation: 1.5,
  210. borderRadius: 4
  211. },
  212. discountView: {
  213. borderWidth: 1,
  214. borderColor: colorAccent
  215. },
  216. discountText: {
  217. fontSize: 12,
  218. textAlign: 'left',
  219. color: textPrimary,
  220. ...$padding(2, 10)
  221. }
  222. })