import { View, Text, ScrollView, Pressable, Image, useWindowDimensions, ActivityIndicator } from 'react-native'; import React, { useContext, useEffect, useState } from 'react'; import { SafeAreaView } from 'react-native-safe-area-context'; import { router } from 'expo-router'; import { CrossLogoSvg, RightArrowIconSvg } from '../global/SVG'; import { walletService } from '../../service/walletService'; const VipQrPageComponent = () => { const { width } = useWindowDimensions(); const qrCodeSize = width * 0.8; // 80% of screen width const [loading, setLoading] = useState(true); const [transactions, setTransactions] = useState([]); useEffect(() => { const fetchTransactionRecords = async () => { try { setLoading(true); const response = await walletService.getTransactionRecord(); if (response && Array.isArray(response)) { setTransactions(response); } else { setTransactions([]); } } catch (error) { console.error('Error fetching transaction records:', error); setTransactions([]); } finally { setLoading(false); } }; fetchTransactionRecords(); }, []); return ( { router.replace('/mainPage'); }} > 專屬會員二維碼 {loading ? ( Loading... ) : transactions.length > 0 ? ( 掃描以下二維碼即可進入專屬VIP區域。 ) : ( 您需要至少消費一次才可享用VIP專屬優惠! )} ); }; export default VipQrPageComponent;