bookingSuccessPageComponent.tsx 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. import { View, Text, ScrollView, StyleSheet } from 'react-native';
  2. import { SafeAreaView } from 'react-native-safe-area-context';
  3. import NormalButton from '../global/normal_button';
  4. import { TickLogoSvg } from '../global/SVG';
  5. import { router } from 'expo-router';
  6. import useBookingStore from '../../providers/booking_store';
  7. const BookingSuccessPageComponent = () => {
  8. const {
  9. bookTime,
  10. carID,
  11. date,
  12. chargingWatt,
  13. connectorID,
  14. price,
  15. stationID,
  16. user,
  17. paymentFee,
  18. carCapacitance,
  19. bookDateForDisplay,
  20. bookTimeForDisplay,
  21. chargeStationAddressForDisplay,
  22. chargeStationNameForDisplay,
  23. carNameForDisplay
  24. } = useBookingStore();
  25. return (
  26. <SafeAreaView style={{ flex: 1, backgroundColor: 'white' }} edges={['top', 'left', 'right']}>
  27. <ScrollView className="flex-1">
  28. <View>
  29. <View className="flex-row pl-8 pt-8 space-x-4 items-center">
  30. <TickLogoSvg />
  31. <Text className="text-3xl">成功預約</Text>
  32. </View>
  33. <View
  34. className="m-4"
  35. style={{
  36. borderWidth: 1,
  37. borderColor: '#EEEEEE',
  38. borderRadius: 12
  39. }}
  40. >
  41. <View className="space-y-3 py-4 mx-[5%]">
  42. <View className="flex-1 flex-row items-center ">
  43. <View className="flex-1 flex-column">
  44. <Text style={styles.grayColor} className="text-xs ">
  45. 時間日期
  46. </Text>
  47. <Text style={styles.greenColor} className="text-4xl pt-2 ">
  48. {bookDateForDisplay} · {bookTimeForDisplay}
  49. </Text>
  50. </View>
  51. </View>
  52. <View className="flex-1 flex-column justify-center">
  53. <Text style={styles.grayColor} className="text-xs">
  54. 充電地點
  55. </Text>
  56. <Text style={styles.greenColor} className="text-xl">
  57. {chargeStationNameForDisplay}
  58. </Text>
  59. <Text style={styles.grayColor} className="text-base">
  60. {chargeStationAddressForDisplay}
  61. </Text>
  62. </View>
  63. <View className="flex-1 flex-row items-center ">
  64. <View className="flex-column flex-1">
  65. <Text style={styles.grayColor} className="text-xs">
  66. 方案
  67. </Text>
  68. {chargingWatt === '' ? (
  69. <>
  70. <Text style={styles.greenColor} className="text-lg">
  71. 按每度電結算
  72. </Text>
  73. <Text style={styles.grayColor} className="text-sm">
  74. 充滿停機預估費用
  75. </Text>
  76. </>
  77. ) : (
  78. <>
  79. <Text style={styles.greenColor} className="text-lg">
  80. 按每度電結算
  81. </Text>
  82. <Text style={styles.grayColor} className="text-sm">
  83. 度數: {chargingWatt.split('~')[0]}
  84. </Text>
  85. </>
  86. )}
  87. </View>
  88. <View className="flex-column flex-1">
  89. <Text style={styles.grayColor} className="text-xs">
  90. 車輛
  91. </Text>
  92. <Text style={styles.greenColor} className="text-lg">
  93. {carNameForDisplay}
  94. </Text>
  95. </View>
  96. </View>
  97. </View>
  98. </View>
  99. </View>
  100. <View className="mx-[5%]">
  101. <Text className="text-xl py-4">收費概要</Text>
  102. <View className="flex-row justify-between">
  103. <Text className="text-base">充電費用</Text>
  104. <Text className="text-base">HK$ {paymentFee}</Text>
  105. </View>
  106. <Text style={styles.grayColor} className="text-base">
  107. 按每度電結算: {chargingWatt.split('~')[0]}
  108. </Text>
  109. <View className="h-0.5 my-3 bg-[#f4f4f4]" />
  110. <View className="flex-row justify-between ">
  111. <Text className="text-xl">總計</Text>
  112. <Text className="text-xl">HK$ {paymentFee}</Text>
  113. </View>
  114. <View className="w-full h-1 my-4 bg-[#DBE4E8]" />
  115. <View className="space-y-4">
  116. <Text className="text-xl ">付款資訊</Text>
  117. <View>
  118. <Text className="text-base" style={styles.grayColor}>
  119. 訂單編號
  120. </Text>
  121. <Text className="text-base">CXZ-16336958</Text>
  122. </View>
  123. <View>
  124. <Text className="text-base" style={styles.grayColor}>
  125. 付款方式
  126. </Text>
  127. <Text className="text-base">預付銀包</Text>
  128. </View>
  129. {/* <View>
  130. <Text
  131. className="text-base"
  132. style={styles.grayColor}
  133. >
  134. 電郵地址
  135. </Text>
  136. <Text className="text-base">
  137. mikechan123@gmail.com
  138. </Text>
  139. </View> */}
  140. </View>
  141. <View className="my-4 pb-8">
  142. <NormalButton
  143. title={
  144. <Text
  145. style={{
  146. color: 'white',
  147. fontSize: 16,
  148. fontWeight: '800'
  149. }}
  150. >
  151. 返回主頁
  152. </Text>
  153. }
  154. onPress={() => router.replace('bookingMenuPage')}
  155. extendedStyle={{ padding: 24 }}
  156. />
  157. </View>
  158. </View>
  159. </ScrollView>
  160. </SafeAreaView>
  161. );
  162. };
  163. export default BookingSuccessPageComponent;
  164. const styles = StyleSheet.create({
  165. grayColor: {
  166. color: '#888888'
  167. },
  168. greenColor: {
  169. color: '#02677D'
  170. }
  171. });