|
|
@@ -5,6 +5,7 @@ import NormalButton from '../global/normal_button';
|
|
|
import { useEffect } from 'react';
|
|
|
import { chargeStationService } from '../../service/chargeStationService';
|
|
|
import useUserInfoStore from '../../providers/userinfo_store';
|
|
|
+import { PreviousPageBlackSvg } from '../global/SVG';
|
|
|
|
|
|
const PenaltyPaymentPageComponent = () => {
|
|
|
const params = useLocalSearchParams();
|
|
|
@@ -62,12 +63,15 @@ const PenaltyPaymentPageComponent = () => {
|
|
|
const handlePayment = async () => {
|
|
|
try {
|
|
|
const result = await chargeStationService.payPenalty(payload);
|
|
|
- if (result) {
|
|
|
+ console.log('Payment result:', result);
|
|
|
+ if (result.status) {
|
|
|
Alert.alert('支付成功', '罰款已成功支付', [
|
|
|
{ text: '確認', onPress: () => router.replace('/mainPage') }
|
|
|
]);
|
|
|
} else {
|
|
|
- Alert.alert('支付失敗', '請稍後再試');
|
|
|
+ Alert.alert('支付失敗', '餘額不足,即將跳轉到錢包', [
|
|
|
+ { text: '確認', onPress: () => router.push('/(account)/(wallet)/walletPage') }
|
|
|
+ ]);
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.error('Payment error:', error);
|
|
|
@@ -78,63 +82,75 @@ const PenaltyPaymentPageComponent = () => {
|
|
|
return (
|
|
|
<SafeAreaView style={{ flex: 1, backgroundColor: 'white' }} edges={['top', 'left', 'right']}>
|
|
|
<ScrollView className="flex-1" showsVerticalScrollIndicator={false}>
|
|
|
- <View className="flex-1">
|
|
|
- <View className="pl-8 pt-8">
|
|
|
- <Text className="text-3xl mt-8">尚未繳付罰款的充電記錄</Text>
|
|
|
- </View>
|
|
|
+ <View style={{ marginTop: 25 }} className="mx-[5%]">
|
|
|
+ <Pressable
|
|
|
+ onPress={() => {
|
|
|
+ if (router.canGoBack()) {
|
|
|
+ router.back();
|
|
|
+ } else {
|
|
|
+ router.replace('/mainPage');
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <PreviousPageBlackSvg />
|
|
|
+ </Pressable>
|
|
|
+ <Text className="text-3xl my-8 text-center">尚未繳付罰款的充電記錄</Text>
|
|
|
+ </View>
|
|
|
+ {/* <View className="pl-8 pt-8">
|
|
|
+ <Text className="text-3xl mt-8">尚未繳付罰款的充電記錄</Text>
|
|
|
+ </View> */}
|
|
|
|
|
|
- <View className="flex-1 mt-4 mx-[5%]">
|
|
|
- <View className="flex-1 flex-row items-center pb-3">
|
|
|
- <View className="flex-1 flex-column">
|
|
|
- <Text style={styles.grayColor} className="text-base">
|
|
|
- 實際充電到期時間
|
|
|
- </Text>
|
|
|
- <Text style={styles.greenColor} className="text-4xl text-center pt-2">
|
|
|
- {actual_end_time}
|
|
|
- </Text>
|
|
|
- </View>
|
|
|
- <View className="flex-1 flex-column">
|
|
|
- <Text style={styles.grayColor} className="text-base pl-7">
|
|
|
- 實際充電結束時間
|
|
|
- </Text>
|
|
|
- <Text style={styles.greenColor} className="text-4xl text-center pt-2">
|
|
|
- {user_end_time}
|
|
|
- </Text>
|
|
|
- </View>
|
|
|
- </View>
|
|
|
- <View className="flex-1 flex-column justify-center space-y-1 pb-3">
|
|
|
- <Text style={styles.grayColor} className="text-base">
|
|
|
- 充電日期
|
|
|
- </Text>
|
|
|
- <Text style={styles.greenColor} className="text-base">
|
|
|
- {date}
|
|
|
- </Text>
|
|
|
- </View>
|
|
|
- {/* <View className="flex-1 flex-column justify-center space-y-1 pb-3">
|
|
|
- <Text style={styles.grayColor} className="text-base">
|
|
|
- 充電地點
|
|
|
- </Text>
|
|
|
- <Text style={styles.greenColor} className="text-base ">
|
|
|
- Crazy Charge(偉業街)
|
|
|
- </Text>
|
|
|
- </View> */}
|
|
|
- <View className="flex-1 flex-column justify-center space-y-1 pb-3">
|
|
|
+ <View className="flex-1 mt-4 mx-[5%]">
|
|
|
+ <View className="flex-1 flex-row items-center pb-3">
|
|
|
+ <View className="flex-1 flex-column">
|
|
|
<Text style={styles.grayColor} className="text-base">
|
|
|
- 罰款金額
|
|
|
+ 實際充電到期時間
|
|
|
</Text>
|
|
|
- <Text style={styles.greenColor} className="text-lg ">
|
|
|
- {params.penalty_fee}
|
|
|
+ <Text style={styles.greenColor} className="text-4xl text-center pt-2">
|
|
|
+ {actual_end_time}
|
|
|
</Text>
|
|
|
</View>
|
|
|
- <View className="flex-1 flex-column justify-center space-y-1 pb-3">
|
|
|
- <Text style={styles.grayColor} className="text-base">
|
|
|
- 訂單編號
|
|
|
+ <View className="flex-1 flex-column">
|
|
|
+ <Text style={styles.grayColor} className="text-base pl-7">
|
|
|
+ 實際充電結束時間
|
|
|
</Text>
|
|
|
- <Text style={styles.greenColor} className=" ">
|
|
|
- {params.format_order_id}
|
|
|
+ <Text style={styles.greenColor} className="text-4xl text-center pt-2">
|
|
|
+ {user_end_time}
|
|
|
</Text>
|
|
|
</View>
|
|
|
</View>
|
|
|
+ <View className="flex-1 flex-column justify-center space-y-1 pb-3">
|
|
|
+ <Text style={styles.grayColor} className="text-base">
|
|
|
+ 充電日期
|
|
|
+ </Text>
|
|
|
+ <Text style={styles.greenColor} className="text-base">
|
|
|
+ {date}
|
|
|
+ </Text>
|
|
|
+ </View>
|
|
|
+ {/* <View className="flex-1 flex-column justify-center space-y-1 pb-3">
|
|
|
+ <Text style={styles.grayColor} className="text-base">
|
|
|
+ 充電地點
|
|
|
+ </Text>
|
|
|
+ <Text style={styles.greenColor} className="text-base ">
|
|
|
+ Crazy Charge(偉業街)
|
|
|
+ </Text>
|
|
|
+ </View> */}
|
|
|
+ <View className="flex-1 flex-column justify-center space-y-1 pb-3">
|
|
|
+ <Text style={styles.grayColor} className="text-base">
|
|
|
+ 罰款金額
|
|
|
+ </Text>
|
|
|
+ <Text style={styles.greenColor} className="text-lg ">
|
|
|
+ {params.penalty_fee}
|
|
|
+ </Text>
|
|
|
+ </View>
|
|
|
+ <View className="flex-1 flex-column justify-center space-y-1 pb-3">
|
|
|
+ <Text style={styles.grayColor} className="text-base">
|
|
|
+ 訂單編號
|
|
|
+ </Text>
|
|
|
+ <Text style={styles.greenColor} className=" ">
|
|
|
+ {params.format_order_id}
|
|
|
+ </Text>
|
|
|
+ </View>
|
|
|
</View>
|
|
|
|
|
|
<View className="border-t mx-4 border-[#CCCCCC]"></View>
|