StepChargeView.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /**
  2. * 充电页:扫码认证之后-充电开始之前
  3. * @邠心vbe on 2023/03/10
  4. */
  5. import React from 'react';
  6. import { StyleSheet, Text, View } from 'react-native';
  7. import Button from '../../components/Button';
  8. import { circleSize, DashboardView } from '../chargeV2/Charging';
  9. import { PaymentList } from '../chargeV2/Payment';
  10. import StationInfoView from './StationInfoView';
  11. export default StepStartView = ({
  12. isStart=false,
  13. isPending,
  14. isCharging,
  15. connectorInfo,
  16. currentPayment,
  17. curerntPerUser,
  18. lastUpdated,
  19. onStartCharge,
  20. onStopCharge,
  21. onPaymentMethodChanged
  22. }) => (
  23. <>
  24. <View style={{minHeight: $vht(80)}}>
  25. <DashboardView
  26. isCharging={isCharging}
  27. connectorInfo={connectorInfo}/>
  28. <Text style={styles.title}>{$t('charging.selectedCharger')}</Text>
  29. <StationInfoView
  30. isCharging={isCharging}
  31. isPending={isPending}
  32. connectorInfo={connectorInfo}/>
  33. {/* <BatteryView
  34. soc={this.state.connectorInfo.batteryPercent}
  35. isCharging={this.state.isCharging}
  36. isPending={this.state.isPending}
  37. /> */}
  38. {/* <View style={ui.center}>
  39. <ImageBackground
  40. style={styles.batteryBorder}
  41. source={require('../../images/charge/ic-charge-circle.png')}>
  42. <Text style={{
  43. color: textPrimary,
  44. fontSize: 16,
  45. lineHeight: 22,
  46. textAlign: 'center'
  47. }}>
  48. Press<Text style={{padding: 10, fontWeight: 'bold'}}> Start </Text>to begin Charging
  49. </Text>
  50. </ImageBackground>
  51. </View> */}
  52. <Text style={styles.title}>{$t('charging.selectPaymentMethod')}</Text>
  53. <PaymentList
  54. payType={currentPayment}
  55. payPerUse={curerntPerUser}
  56. onMethodChange={onPaymentMethodChanged}
  57. />
  58. {/* <Payment
  59. refreshId={this.state.refreshId}
  60. payType={this.state.currentPaytype}
  61. balance={this.state.curerntPerUser}
  62. isPayPerUse={this.state.currentPayment == PAYTYPE.PAY_PER_USE}
  63. onMethodChange={() => this.onMethodChange()}
  64. /> */}
  65. { lastUpdated
  66. ? <Text style={styles.updateTip}>{$t('charging.lastUpdatedAt') + lastUpdated + '\n' + $t('charging.pullDownRefresh')}</Text>
  67. : <></>
  68. }
  69. </View>
  70. { isStart
  71. ? <Button
  72. style={styles.buttonView}
  73. disabled={isPending}
  74. text={isCharging ? $t('charging.btnStopCharging') : $t('charging.btnComplete')}
  75. elevation={1.5}
  76. onClick={onStopCharge}/>
  77. : <Button
  78. style={styles.buttonView}
  79. text={$t('charging.btnStartCharging')}
  80. elevation={1.5}
  81. onClick={onStartCharge}/>
  82. }
  83. </>
  84. );
  85. const styles = StyleSheet.create({
  86. title: {
  87. color: '#000',
  88. fontSize: 14,
  89. fontWeight: 'bold',
  90. paddingTop: 16,
  91. paddingBottom: 16
  92. },
  93. buttonView: {
  94. marginTop: 16,
  95. marginBottom: 32
  96. },
  97. updateTip: {
  98. color: '#aaa',
  99. fontSize: 10,
  100. textAlign: 'center',
  101. paddingTop: 32,
  102. paddingBottom: 16
  103. },
  104. listView: {
  105. padding: 8,
  106. },
  107. batteryBorder: {
  108. margin: 30,
  109. padding: 32,
  110. width: circleSize,
  111. height: circleSize,
  112. alignItems: 'center',
  113. justifyContent: 'center'
  114. }
  115. })