import { AVPlaybackStatus, ResizeMode, Video } from 'expo-av'; import { Image } from 'expo-image'; import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react'; import { ActivityIndicator, Alert, Animated, Dimensions, ImageBackground, Modal, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { convertApply, getApplyResult } from '@/services/award'; const { width: SCREEN_WIDTH } = Dimensions.get('window'); const CARD_WIDTH = (SCREEN_WIDTH - 60) / 3; const CARD_HEIGHT = CARD_WIDTH * 1.5; const CDN_BASE = 'https://cdn.acetoys.cn'; const imgUrl = `${CDN_BASE}/kai_xin_ma_te/supermart`; const imgUrlSupermart = `${CDN_BASE}/supermart`; const LEVEL_MAP: Record = { A: { title: '超神款', color: '#F62C71', rgba: 'rgba(246, 44, 113, 1)', resultBg: `${imgUrlSupermart}/supermart/box/resultBgA.png`, borderImg: `${imgUrlSupermart}/supermart/box/borderImgA.png` }, B: { title: '欧皇款', color: '#E9C525', rgba: 'rgba(233,197,37, 1)', resultBg: `${imgUrlSupermart}/supermart/box/resultBgB.png`, borderImg: `${imgUrlSupermart}/supermart/box/borderImgB.png` }, C: { title: '隐藏款', color: '#A72CF6', rgba: 'rgba(167, 44, 246, 1)', resultBg: `${imgUrlSupermart}/supermart/box/resultBgC.png`, borderImg: `${imgUrlSupermart}/supermart/box/borderImgC.png` }, D: { title: '普通款', color: '#40c9d7', rgba: 'rgba(64, 201, 215, 1)', resultBg: `${imgUrlSupermart}/supermart/box/resultBgD.png`, borderImg: `${imgUrlSupermart}/supermart/box/borderImgD.png` }, }; const LotteryImages = { lotteryBg: `${imgUrlSupermart}/supermart/box/sequence/sequence0.jpg`, cardBack: `${imgUrl}/box/back1.png`, halo: `${imgUrlSupermart}/supermart/box/halo.gif`, levelA_bg: `${imgUrlSupermart}/supermart/box/levelD.png`, // Using levelD as placeholder if specific not found, or specific bg levelA_title: `${imgUrlSupermart}/supermart/box/detail/levelTextA.png`, close: `${imgUrlSupermart}/supermart/box/qiji_close.png`, }; const DEFAULT_JACKPOT_VIDEO = 'https://cdn.acetoys.cn/kai_xin_ma_te/supermart/box/lottery/jackpot.mp4'; const KingModal = ({ visible, data, onClose }: { visible: boolean; data: LotteryItem | null; onClose: () => void }) => { if (!visible || !data) return null; return ( ); }; interface LotteryItem { id: string; name: string; cover: string; level: string; magicAmount?: number; spu?: { marketPrice: number }; } export interface LotteryResultModalRef { show: (tradeNo: string) => void; close: () => void; } interface LotteryResultModalProps { onClose?: () => void; onGoStore?: () => void; } export const LotteryResultModal = forwardRef( ({ onClose, onGoStore }, ref) => { const insets = useSafeAreaInsets(); const [visible, setVisible] = useState(false); const [loading, setLoading] = useState(true); const [tableData, setTableData] = useState([]); const [total, setTotal] = useState(0); const [showResult, setShowResult] = useState(false); const [showDh, setShowDh] = useState(false); const [haloShow, setHaloShow] = useState(false); const [rebateAmount, setRebateAmount] = useState(0); const [animationEnabled, setAnimationEnabled] = useState(true); const [isSkip, setIsSkip] = useState(true); const [tradeNo, setTradeNo] = useState(''); const [kingVisible, setKingVisible] = useState(false); const [kingData, setKingData] = useState(null); const [videoVisible, setVideoVisible] = useState(false); const [videoUrl, setVideoUrl] = useState(''); const videoRef = useRef