bookingSuccessPageComponent.tsx 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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
  27. style={{ flex: 1, backgroundColor: 'white' }}
  28. edges={['top', 'left', 'right']}
  29. >
  30. <ScrollView className="flex-1">
  31. <View>
  32. <View className="flex-row pl-8 pt-8 space-x-4 items-center">
  33. <TickLogoSvg />
  34. <Text className="text-3xl">成功預約</Text>
  35. </View>
  36. <View
  37. className="m-4"
  38. style={{
  39. borderWidth: 1,
  40. borderColor: '#EEEEEE',
  41. borderRadius: 12
  42. }}
  43. >
  44. <View className="space-y-3 py-4 mx-[5%]">
  45. <View className="flex-1 flex-row items-center ">
  46. <View className="flex-1 flex-column">
  47. <Text
  48. style={styles.grayColor}
  49. className="text-xs "
  50. >
  51. 時間日期
  52. </Text>
  53. <Text
  54. style={styles.greenColor}
  55. className="text-4xl pt-2 "
  56. >
  57. {bookDateForDisplay} ·{' '}
  58. {bookTimeForDisplay}
  59. </Text>
  60. </View>
  61. </View>
  62. <View className="flex-1 flex-column justify-center">
  63. <Text
  64. style={styles.grayColor}
  65. className="text-xs"
  66. >
  67. 充電地點
  68. </Text>
  69. <Text
  70. style={styles.greenColor}
  71. className="text-xl"
  72. >
  73. {chargeStationNameForDisplay}
  74. </Text>
  75. <Text
  76. style={styles.grayColor}
  77. className="text-base"
  78. >
  79. {chargeStationAddressForDisplay}
  80. </Text>
  81. </View>
  82. <View className="flex-1 flex-row items-center ">
  83. <View className="flex-column flex-1">
  84. <Text
  85. style={styles.grayColor}
  86. className="text-xs"
  87. >
  88. 方案
  89. </Text>
  90. {chargingWatt === '' ? (
  91. <>
  92. <Text
  93. style={styles.greenColor}
  94. className="text-lg"
  95. >
  96. 按每度電結算
  97. </Text>
  98. <Text
  99. style={styles.grayColor}
  100. className="text-sm"
  101. >
  102. 充滿停機預估費用
  103. </Text>
  104. </>
  105. ) : (
  106. <>
  107. <Text
  108. style={styles.greenColor}
  109. className="text-lg"
  110. >
  111. 按每度電結算
  112. </Text>
  113. <Text
  114. style={styles.grayColor}
  115. className="text-sm"
  116. >
  117. 度數:{' '}
  118. {chargingWatt.split('~')[0]}
  119. </Text>
  120. </>
  121. )}
  122. </View>
  123. <View className="flex-column flex-1">
  124. <Text
  125. style={styles.grayColor}
  126. className="text-xs"
  127. >
  128. 車輛
  129. </Text>
  130. <Text
  131. style={styles.greenColor}
  132. className="text-lg"
  133. >
  134. {carNameForDisplay}
  135. </Text>
  136. </View>
  137. </View>
  138. </View>
  139. </View>
  140. </View>
  141. <View className="mx-[5%]">
  142. <Text className="text-xl py-4">收費概要</Text>
  143. <View className="flex-row justify-between">
  144. <Text className="text-base">充電費用</Text>
  145. <Text className="text-base">HK$ {paymentFee}</Text>
  146. </View>
  147. <Text style={styles.grayColor} className="text-base">
  148. 按每度電結算: {chargingWatt.split('~')[0]}
  149. </Text>
  150. <View className="h-0.5 my-3 bg-[#f4f4f4]" />
  151. <View className="flex-row justify-between ">
  152. <Text className="text-xl">總計</Text>
  153. <Text className="text-xl">HK$ {paymentFee}</Text>
  154. </View>
  155. <View className="w-full h-1 my-4 bg-[#DBE4E8]" />
  156. <View className="space-y-4">
  157. <Text className="text-xl ">付款資訊</Text>
  158. <View>
  159. <Text
  160. className="text-base"
  161. style={styles.grayColor}
  162. >
  163. 訂單編號
  164. </Text>
  165. <Text className="text-base">CXZ-16336958</Text>
  166. </View>
  167. <View>
  168. <Text
  169. className="text-base"
  170. style={styles.grayColor}
  171. >
  172. 付款方式
  173. </Text>
  174. <Text className="text-base">預付銀包</Text>
  175. </View>
  176. {/* <View>
  177. <Text
  178. className="text-base"
  179. style={styles.grayColor}
  180. >
  181. 電郵地址
  182. </Text>
  183. <Text className="text-base">
  184. mikechan123@gmail.com
  185. </Text>
  186. </View> */}
  187. </View>
  188. <View className="my-4 pb-8">
  189. <NormalButton
  190. title={
  191. <Text
  192. style={{
  193. color: 'white',
  194. fontSize: 16,
  195. fontWeight: '800'
  196. }}
  197. >
  198. 返回主頁
  199. </Text>
  200. }
  201. onPress={() => router.replace('bookingMenuPage')}
  202. extendedStyle={{ padding: 24 }}
  203. />
  204. </View>
  205. </View>
  206. </ScrollView>
  207. </SafeAreaView>
  208. );
  209. };
  210. export default BookingSuccessPageComponent;
  211. const styles = StyleSheet.create({
  212. grayColor: {
  213. color: '#888888'
  214. },
  215. greenColor: {
  216. color: '#02677D'
  217. }
  218. });