paymentFinishPageComponent.tsx 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. // component/chargingPage/paymentFinishPageComponent.tsx
  2. import { View, Text, ScrollView, StyleSheet, Pressable } from 'react-native';
  3. import React, { useEffect } from 'react';
  4. import { SafeAreaView } from 'react-native-safe-area-context';
  5. import NormalButton from '../global/normal_button';
  6. import { router, useLocalSearchParams, useNavigation } from 'expo-router';
  7. import {
  8. BatteryIconSvg,
  9. BatteryLogoSvg,
  10. DownArrowSvg,
  11. LightingLogoSvg,
  12. TemperatureIconSvg,
  13. TickLogoSvg,
  14. TimeClockLogoSvg,
  15. UpArrowSvg
  16. } from '../global/SVG';
  17. import useBookingStore from '../../providers/booking_store';
  18. import userStore from '../../providers/user_store';
  19. import { useTranslation } from '../../util/hooks/useTranslation';
  20. const PaymentFinishPageComponent = () => {
  21. const { t } = useTranslation();
  22. const { bookTime, carID, date, chargingWatt, connectorID, price, stationID, user, paymentFee, carCapacitance } =
  23. useBookingStore();
  24. const navigation = useNavigation();
  25. useEffect(() => {
  26. navigation.setOptions({
  27. gestureEnabled: false
  28. });
  29. }, [navigation]);
  30. // const [isMoreInfoButtonPressed, setIsMoreInfoButtonPressed] =
  31. // React.useState<boolean>(false);
  32. const params = useLocalSearchParams();
  33. const formatOrderId = params.formatOrderId;
  34. return (
  35. <SafeAreaView className="flex-1 bg-white">
  36. <ScrollView className="flex-1 mx-[5%]" showsVerticalScrollIndicator={false}>
  37. <View style={{ marginTop: 25, flex: 1 }}>
  38. <View className="flex-row items-center">
  39. <TickLogoSvg />
  40. <Text className="text-3xl pl-2">{t('payment_finish.success_title')}</Text>
  41. </View>
  42. <View>
  43. <Text className="text-xl py-4">{t('payment_finish.fee_summary')}</Text>
  44. <View className="flex-row justify-between">
  45. <Text className="text-base">{t('payment_finish.charging_fee')}</Text>
  46. <Text className="text-base">HK$ {paymentFee}</Text>
  47. </View>
  48. {chargingWatt === '' ? (
  49. <Text style={styles.grayColor} className="text-base">
  50. {t('payment_finish.estimated_full_charge')}
  51. </Text>
  52. ) : (
  53. <Text style={styles.grayColor} className="text-base">
  54. {t('payment_finish.settled_per_kwh')}{chargingWatt.split('~')[0]}
  55. </Text>
  56. )}
  57. <View className="h-0.5 my-3 bg-[#f4f4f4]" />
  58. <View className="flex-row justify-between ">
  59. <Text className="text-xl">{t('payment_finish.total')}</Text>
  60. <Text className="text-xl">HK$ {paymentFee}</Text>
  61. </View>
  62. <View className="mt-4"></View>
  63. </View>
  64. <View className="w-full h-1 bg-[#DBE4E8]" />
  65. <View className="space-y-4 my-4">
  66. <Text className="text-xl ">{t('payment_finish.payment_info')}</Text>
  67. <View>
  68. <Text className="text-base" style={styles.grayColor}>
  69. {t('payment_finish.order_number')}
  70. </Text>
  71. <Text className="text-base">{formatOrderId}</Text>
  72. </View>
  73. <View>
  74. <Text className="text-base" style={styles.grayColor}>
  75. {t('payment_finish.payment_method')}
  76. </Text>
  77. <Text className="text-base">{t('payment_finish.prepaid_wallet')}</Text>
  78. </View>
  79. </View>
  80. <NormalButton
  81. title={<Text style={{ color: '#fff', fontSize: 18 }}>{t('common.nextPage')}</Text>}
  82. onPress={() => {
  83. // router.replace('bookingSuccessPage');
  84. router.replace({
  85. pathname: 'bookingSuccessPage',
  86. params: { formatOrderId: formatOrderId }
  87. });
  88. }}
  89. />
  90. </View>
  91. </ScrollView>
  92. </SafeAreaView>
  93. );
  94. };
  95. export default PaymentFinishPageComponent;
  96. const styles = StyleSheet.create({
  97. grayColor: {
  98. color: '#888888'
  99. },
  100. greenColor: {
  101. color: '#02677D'
  102. }
  103. });