StepChargeView.js 3.2 KB

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