walletPageComponent.tsx 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. import {
  2. View,
  3. Text,
  4. ScrollView,
  5. Pressable,
  6. ImageBackground
  7. } from 'react-native';
  8. import { SafeAreaView } from 'react-native-safe-area-context';
  9. import { router } from 'expo-router';
  10. import { CrossLogoSvg } from '../global/SVG';
  11. const coupons = [
  12. {
  13. title: '迎新優惠券',
  14. price: '999',
  15. detail: '這是一段有關迎新優惠券的說明',
  16. date: '至14/3/2025'
  17. },
  18. {
  19. title: '折扣優惠券',
  20. price: '888',
  21. detail: '這是另一段有關迎新優惠券的說明',
  22. date: '至15/4/2025'
  23. },
  24. {
  25. title: '三張優惠券',
  26. price: '777',
  27. detail: '這是第三段有關迎新優惠券的說明',
  28. date: '至16/9/2026'
  29. }
  30. ];
  31. export const IndividualCouponComponent = ({
  32. title,
  33. price,
  34. detail,
  35. date
  36. }: {
  37. title: string;
  38. price: string;
  39. detail: string;
  40. date: string;
  41. }) => (
  42. <View className="bg-[#e7f2f8] h-[124px] rounded-xl flex-row mb-3">
  43. <View className="bg-white mx-3 my-3 w-[28%] rounded-xl">
  44. <View className="flex-row justify-center items-center pr-4 pt-4 ">
  45. <Text className="color-[#02677d] text-2xl pl-2 pr-1">$</Text>
  46. <Text
  47. className="color-[#02677d] text-3xl font-bold"
  48. adjustsFontSizeToFit={true}
  49. >
  50. {price}
  51. </Text>
  52. </View>
  53. <View className="items-center justify-center">
  54. <Text className="text-base mt-1">{title}</Text>
  55. </View>
  56. </View>
  57. {/* //dash line */}
  58. <View style={{ overflow: 'hidden' }}>
  59. <View
  60. style={{
  61. borderStyle: 'dashed',
  62. borderWidth: 1,
  63. borderColor: '#CCCCCC',
  64. margin: -1,
  65. width: 0,
  66. marginRight: 0,
  67. height: '100%'
  68. }}
  69. >
  70. <View style={{ height: 60 }}></View>
  71. </View>
  72. </View>
  73. <View className="flex-col flex-1 m-[5%] justify-center ">
  74. <Text className="text-lg">{title}</Text>
  75. <Text className="color-[#888888] text-sm">{detail}</Text>
  76. <View className="flex-row items-center ">
  77. <Text className="text-base">有效期 </Text>
  78. <Text className="text-base font-bold text-[#02677d]">
  79. {' '}
  80. {date}
  81. </Text>
  82. </View>
  83. </View>
  84. </View>
  85. );
  86. const WalletPageComponent = () => {
  87. const image = { uri: 'https://legacy.reactjs.org/logo-og.png' };
  88. return (
  89. <SafeAreaView
  90. className="flex-1 bg-white"
  91. edges={['top', 'right', 'left']}
  92. >
  93. <ScrollView className="flex-1 ">
  94. <View className="flex-1 mx-[5%]">
  95. <View style={{ marginTop: 25 }}>
  96. <Pressable
  97. onPress={() => {
  98. if (router.canGoBack()) {
  99. router.back();
  100. } else {
  101. router.replace('/accountMainPage');
  102. }
  103. }}
  104. >
  105. <CrossLogoSvg />
  106. </Pressable>
  107. <Text style={{ fontSize: 45, marginVertical: 25 }}>
  108. 錢包
  109. </Text>
  110. </View>
  111. <View>
  112. <ImageBackground
  113. className="flex-col-reverse shadow-lg"
  114. style={{ height: 200 }}
  115. source={require('../../assets/walletCard1.png')}
  116. resizeMode="contain"
  117. >
  118. <View className="mx-[5%] pb-6">
  119. <Text className="text-white text-xl">
  120. 餘額 (HKD)
  121. </Text>
  122. <View className="flex-row items-center justify-between ">
  123. <Text
  124. style={{ fontSize: 52 }}
  125. className=" text-white font-bold"
  126. >
  127. $2711.8
  128. </Text>
  129. <Pressable
  130. className="rounded-2xl items-center justify-center p-3 px-5 pr-6 "
  131. style={{
  132. backgroundColor:
  133. 'rgba(231, 242, 248, 0.2)'
  134. }}
  135. onPress={() => console.log('增值')}
  136. >
  137. <Text className="text-white font-bold">
  138. + 增值
  139. </Text>
  140. </Pressable>
  141. </View>
  142. </View>
  143. </ImageBackground>
  144. </View>
  145. <View className="flex-row-reverse mt-2 mb-6">
  146. <Text className="text-[#02677D] text-lg underline">
  147. 更多錢包資訊
  148. </Text>
  149. </View>
  150. </View>
  151. <View className="w-full h-1 bg-[#DBE4E8]" />
  152. <View className="flex-row justify-between mx-[5%] pt-6 pb-3">
  153. <Text className="text-xl">優惠券</Text>
  154. <Pressable onPress={() => router.push('couponPage')}>
  155. <Text className="text-xl text-[#888888]">顯示所有</Text>
  156. </Pressable>
  157. </View>
  158. <View className="flex-1 flex-col mx-[5%]">
  159. {coupons.slice(0, 2).map((coupon, index) => (
  160. <IndividualCouponComponent
  161. key={index}
  162. title={coupon.title}
  163. price={coupon.price}
  164. detail={coupon.detail}
  165. date={coupon.date}
  166. />
  167. ))}
  168. </View>
  169. </ScrollView>
  170. </SafeAreaView>
  171. );
  172. };
  173. export default WalletPageComponent;