paymentFinishPageComponent.tsx 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. import { View, Text, ScrollView, StyleSheet, Pressable } from 'react-native';
  2. import React, { useEffect } from 'react';
  3. import { SafeAreaView } from 'react-native-safe-area-context';
  4. import NormalButton from '../global/normal_button';
  5. import { router, useLocalSearchParams, useNavigation } from 'expo-router';
  6. import {
  7. BatteryIconSvg,
  8. BatteryLogoSvg,
  9. DownArrowSvg,
  10. LightingLogoSvg,
  11. TemperatureIconSvg,
  12. TickLogoSvg,
  13. TimeClockLogoSvg,
  14. UpArrowSvg
  15. } from '../global/SVG';
  16. import useBookingStore from '../../providers/booking_store';
  17. import userStore from '../../providers/user_store';
  18. const PaymentFinishPageComponent = () => {
  19. const { bookTime, carID, date, chargingWatt, connectorID, price, stationID, user, paymentFee, carCapacitance } =
  20. useBookingStore();
  21. const navigation = useNavigation();
  22. useEffect(() => {
  23. navigation.setOptions({
  24. gestureEnabled: false
  25. });
  26. }, [navigation]);
  27. // const [isMoreInfoButtonPressed, setIsMoreInfoButtonPressed] =
  28. // React.useState<boolean>(false);
  29. const params = useLocalSearchParams();
  30. const formatOrderId = params.formatOrderId;
  31. return (
  32. <SafeAreaView className="flex-1 bg-white">
  33. <ScrollView className="flex-1 mx-[5%]" showsVerticalScrollIndicator={false}>
  34. <View style={{ marginTop: 25, flex: 1 }}>
  35. <View className="flex-row items-center">
  36. <TickLogoSvg />
  37. <Text className="text-3xl pl-2">成功付款</Text>
  38. </View>
  39. {/* <View className="items-center pt-4 justify-center">
  40. <SlideInImage source={require('../../assets/car.png')} />
  41. <Text className="text-2xl font-light pb-4">
  42. TESLA Model 3
  43. </Text>
  44. </View>
  45. <View
  46. style={{ borderWidth: 1 }}
  47. className="border-[#EEEEEE] rounded-2xl"
  48. >
  49. <View className="mx-[5%] flex-column p-4 ">
  50. <View className="flex-row justify-evenly gap-6">
  51. <View className="flex-row items-center space-x-4">
  52. <BatteryLogoSvg />
  53. <View className="flex-column ">
  54. <Text
  55. className="text-sm"
  56. style={styles.grayColor}
  57. >
  58. 已充電
  59. </Text>
  60. <Text
  61. style={styles.greenColor}
  62. className="text-4xl font-light"
  63. >
  64. 95%
  65. </Text>
  66. </View>
  67. </View>
  68. <View className="flex-row items-center space-x-4">
  69. <TimeClockLogoSvg />
  70. <View className="flex-column">
  71. <Text
  72. className="text-sm"
  73. style={styles.grayColor}
  74. >
  75. 充電歷時
  76. </Text>
  77. <View className="flex-row items-end">
  78. <Text
  79. style={styles.greenColor}
  80. className="text-4xl font-light"
  81. >
  82. 39
  83. </Text>
  84. <Text
  85. style={styles.greenColor}
  86. className="text-sm font-light"
  87. >
  88. mins
  89. </Text>
  90. </View>
  91. </View>
  92. </View>
  93. </View>
  94. <View className="h-0.5 w-full my-4 bg-[#EEEEEE]" />
  95. {isMoreInfoButtonPressed ? (
  96. <>
  97. <View className="h-[100px] flex-row items-center">
  98. <View className="flex-1 flex-column items-center space-y-2">
  99. <LightingLogoSvg />
  100. <Text
  101. style={styles.grayColor}
  102. className="text-base"
  103. >
  104. 充電功率
  105. </Text>
  106. <Text
  107. style={styles.greenColor}
  108. className="font-bold text-base"
  109. >
  110. 22.1kW
  111. </Text>
  112. </View>
  113. <View className="flex-1 flex-column items-center space-y-2">
  114. <BatteryIconSvg />
  115. <Text
  116. style={styles.grayColor}
  117. className="text-base"
  118. >
  119. 實際功率
  120. </Text>
  121. <Text
  122. style={styles.greenColor}
  123. className="font-bold text-base"
  124. >
  125. 30.0kW
  126. </Text>
  127. </View>
  128. <View className="flex-1 flex-column items-center space-y-2">
  129. <TemperatureIconSvg />
  130. <Text
  131. style={styles.grayColor}
  132. className="text-base"
  133. >
  134. 溫度
  135. </Text>
  136. <Text
  137. style={styles.greenColor}
  138. className="font-bold text-base"
  139. >
  140. 36°c
  141. </Text>
  142. </View>
  143. </View>
  144. <Pressable
  145. onPress={() => {
  146. setIsMoreInfoButtonPressed(
  147. !isMoreInfoButtonPressed
  148. );
  149. }}
  150. style={{ padding: 2 }}
  151. >
  152. <View className="flex-row pt-4 items-center justify-center">
  153. <Text className="text-sm">
  154. 收起{' '}
  155. </Text>
  156. <UpArrowSvg />
  157. </View>
  158. </Pressable>
  159. </>
  160. ) : (
  161. <Pressable
  162. onPress={() => {
  163. setIsMoreInfoButtonPressed(
  164. !isMoreInfoButtonPressed
  165. );
  166. }}
  167. style={{ padding: 2 }}
  168. >
  169. <View className="flex-row items-center justify-center">
  170. <Text className="text-sm">
  171. 更多資訊{' '}
  172. </Text>
  173. <DownArrowSvg />
  174. </View>
  175. </Pressable>
  176. )}
  177. </View>
  178. </View> */}
  179. {/*
  180. <View
  181. className="my-4"
  182. style={{
  183. borderWidth: 1,
  184. borderColor: '#EEEEEE',
  185. borderRadius: 12
  186. }}
  187. >
  188. <View className="space-y-3 py-4 mx-[5%]">
  189. <View className="flex-1 flex-row items-center ">
  190. <View className="flex-1 flex-column">
  191. <Text
  192. style={styles.grayColor}
  193. className="text-xs "
  194. >
  195. 時間日期
  196. </Text>
  197. <Text
  198. style={styles.greenColor}
  199. className="text-4xl pt-2 "
  200. >
  201. 3月14 · 16:15
  202. </Text>
  203. </View>
  204. </View>
  205. <View className="flex-1 flex-column justify-center">
  206. <Text
  207. style={styles.grayColor}
  208. className="text-xs"
  209. >
  210. 充電地點
  211. </Text>
  212. <Text
  213. style={styles.greenColor}
  214. className="text-xl"
  215. >
  216. 上環街市充電站
  217. </Text>
  218. <Text
  219. style={styles.grayColor}
  220. className="text-base"
  221. >
  222. 香港上環皇后大道中345號
  223. </Text>
  224. </View>
  225. <View className="flex-1 flex-row items-center ">
  226. <View className="flex-column flex-1">
  227. <Text
  228. style={styles.grayColor}
  229. className="text-xs"
  230. >
  231. 方案
  232. </Text>
  233. <Text
  234. style={styles.greenColor}
  235. className="text-lg"
  236. >
  237. 按每度電結算
  238. </Text>
  239. <Text
  240. style={styles.grayColor}
  241. className="text-sm"
  242. >
  243. 度數: 50kWh
  244. </Text>
  245. </View>
  246. <View className="flex-column flex-1">
  247. <Text
  248. style={styles.grayColor}
  249. className="text-xs"
  250. >
  251. 車輛
  252. </Text>
  253. <Text
  254. style={styles.greenColor}
  255. className="text-lg"
  256. >
  257. TESLA Model 3
  258. </Text>
  259. </View>
  260. </View>
  261. </View>
  262. </View> */}
  263. <View>
  264. <Text className="text-xl py-4">收費概要</Text>
  265. <View className="flex-row justify-between">
  266. <Text className="text-base">充電費用</Text>
  267. <Text className="text-base">HK$ {paymentFee}</Text>
  268. </View>
  269. {chargingWatt === '' ? (
  270. <Text style={styles.grayColor} className="text-base">
  271. 充滿停機預估費用
  272. </Text>
  273. ) : (
  274. <Text style={styles.grayColor} className="text-base">
  275. 按每度電結算: {chargingWatt.split('~')[0]}
  276. </Text>
  277. )}
  278. <View className="h-0.5 my-3 bg-[#f4f4f4]" />
  279. <View className="flex-row justify-between ">
  280. <Text className="text-xl">總計</Text>
  281. <Text className="text-xl">HK$ {paymentFee}</Text>
  282. </View>
  283. <View className="mt-4"></View>
  284. </View>
  285. <View className="w-full h-1 bg-[#DBE4E8]" />
  286. <View className="space-y-4 my-4">
  287. <Text className="text-xl ">付款資訊</Text>
  288. <View>
  289. <Text className="text-base" style={styles.grayColor}>
  290. 訂單編號
  291. </Text>
  292. <Text className="text-base">{formatOrderId}</Text>
  293. </View>
  294. <View>
  295. <Text className="text-base" style={styles.grayColor}>
  296. 付款方式
  297. </Text>
  298. <Text className="text-base">預付銀包</Text>
  299. </View>
  300. {/* <View>
  301. <Text
  302. className="text-base"
  303. style={styles.grayColor}
  304. >
  305. 電郵地址
  306. </Text>
  307. <Text className="text-base">
  308. mikechan123@.com
  309. </Text>
  310. </View> */}
  311. </View>
  312. <NormalButton
  313. title={<Text style={{ color: '#fff', fontSize: 18 }}>下一頁</Text>}
  314. onPress={() => {
  315. // router.replace('bookingSuccessPage');
  316. router.replace({
  317. pathname: 'bookingSuccessPage',
  318. params: { formatOrderId: formatOrderId }
  319. });
  320. }}
  321. />
  322. </View>
  323. </ScrollView>
  324. </SafeAreaView>
  325. );
  326. };
  327. export default PaymentFinishPageComponent;
  328. const styles = StyleSheet.create({
  329. grayColor: {
  330. color: '#888888'
  331. },
  332. greenColor: {
  333. color: '#02677D'
  334. }
  335. });