index.tsx 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. import { Image } from 'expo-image';
  2. import { useLocalSearchParams, useRouter } from 'expo-router';
  3. import React, { useCallback, useEffect, useRef, useState } from 'react';
  4. import {
  5. ActivityIndicator,
  6. Alert,
  7. Animated,
  8. Dimensions,
  9. ImageBackground,
  10. ScrollView,
  11. StatusBar,
  12. StyleSheet,
  13. Text,
  14. TouchableOpacity,
  15. View,
  16. } from 'react-native';
  17. import { useSafeAreaInsets } from 'react-native-safe-area-context';
  18. import { Images } from '@/constants/images';
  19. import { useAuth } from '@/contexts/AuthContext';
  20. import { getBoxDetail, poolIn, poolOut, previewOrder, unlockBox } from '@/services/award';
  21. import { get } from '@/services/http';
  22. import { CheckoutModal } from '../award-detail/components/CheckoutModal';
  23. import { RuleModal } from '../award-detail/components/RuleModal';
  24. import { BoxPopup, BoxPopupRef } from './components/BoxPopup';
  25. const { width: SCREEN_WIDTH } = Dimensions.get('window');
  26. interface PoolData {
  27. id: string;
  28. poolName: string;
  29. name?: string;
  30. cover: string;
  31. price: number;
  32. specialPrice?: number;
  33. bigBoxPrizes?: ProductItem[];
  34. activityGoods?: any[];
  35. }
  36. interface ProductItem {
  37. id: string;
  38. name: string;
  39. cover: string;
  40. level: string;
  41. price?: number;
  42. }
  43. interface BoxData {
  44. number: string;
  45. leftQuantity: number;
  46. lastNumber: number;
  47. lock?: { locker: string; leftTime: number };
  48. usedStat?: Record<string, { spuId: string; quantity: number }>;
  49. }
  50. // 使用正确的 API 接口
  51. const getBoxPoolDetail = async (poolId: string) => {
  52. const res = await get('/api/luck/treasure-box/pool-detail', { poolId });
  53. return res.data;
  54. };
  55. const getBoxHistory = async (poolId: string) => {
  56. const res = await get('/api/luck/treasure-box/box-history', { poolId });
  57. return res.data;
  58. };
  59. const getEmptyRunStatus = async (poolId: string) => {
  60. const res = await get('/api/luck/treasure-box/empty-run-status', { poolId });
  61. return res.data;
  62. };
  63. export default function BoxInBoxScreen() {
  64. const { poolId } = useLocalSearchParams<{ poolId: string }>();
  65. const router = useRouter();
  66. const insets = useSafeAreaInsets();
  67. const { user } = useAuth();
  68. const [loading, setLoading] = useState(true);
  69. const [data, setData] = useState<PoolData | null>(null);
  70. const [products, setProducts] = useState<ProductItem[]>([]);
  71. const [activityGoods, setActivityGoods] = useState<any[]>([]);
  72. const [boxHistory, setBoxHistory] = useState<any[]>([]);
  73. const [boxHistoryInfo, setBoxHistoryInfo] = useState<any>(null);
  74. const [box, setBox] = useState<BoxData | null>(null);
  75. const [boxNum, setBoxNum] = useState<string>('');
  76. const [currentIndex, setCurrentIndex] = useState(0);
  77. const [leftTime, setLeftTime] = useState(0);
  78. const [emptyRuns, setEmptyRuns] = useState(0);
  79. const [scrollTop, setScrollTop] = useState(0);
  80. const [tabIndex, setTabIndex] = useState(0);
  81. const checkoutRef = useRef<any>(null);
  82. const ruleRef = useRef<any>(null);
  83. const boxPopupRef = useRef<BoxPopupRef>(null);
  84. const floatAnim = useRef(new Animated.Value(0)).current;
  85. const timerRef = useRef<ReturnType<typeof setInterval> | null>(null);
  86. useEffect(() => {
  87. Animated.loop(
  88. Animated.sequence([
  89. Animated.timing(floatAnim, { toValue: 10, duration: 1500, useNativeDriver: true }),
  90. Animated.timing(floatAnim, { toValue: -10, duration: 1500, useNativeDriver: true }),
  91. ])
  92. ).start();
  93. }, []);
  94. const loadData = useCallback(async () => {
  95. if (!poolId) return;
  96. setLoading(true);
  97. try {
  98. const detail = await getBoxPoolDetail(poolId);
  99. if (detail) {
  100. setData({ ...detail, name: detail.poolName, price: detail.price || detail.specialPrice || 0 });
  101. setProducts(detail.bigBoxPrizes || []);
  102. setActivityGoods(detail.activityGoods || []);
  103. }
  104. } catch (error) {
  105. console.error('加载数据失败:', error);
  106. }
  107. setLoading(false);
  108. }, [poolId]);
  109. const loadBoxHistory = useCallback(async () => {
  110. if (!poolId) return;
  111. try {
  112. const res = await getBoxHistory(poolId);
  113. if (res && res.length > 0) {
  114. setBoxHistory(res);
  115. setBoxHistoryInfo(res[0]);
  116. }
  117. } catch {}
  118. }, [poolId]);
  119. const loadBox = useCallback(
  120. async (num?: string) => {
  121. if (!poolId) return;
  122. try {
  123. const res = await getBoxDetail(poolId, num);
  124. if (res) handleBoxResult(res);
  125. } catch (error) {
  126. console.error('加载盒子失败:', error);
  127. }
  128. },
  129. [poolId]
  130. );
  131. const loadEmptyRuns = useCallback(async () => {
  132. if (!poolId) return;
  133. try {
  134. const res = await getEmptyRunStatus(poolId);
  135. if (res) setEmptyRuns(res.emptyRuns || 0);
  136. } catch {}
  137. }, [poolId]);
  138. const refreshBox = useCallback(async () => {
  139. if (!poolId) return;
  140. try {
  141. const res = await getBoxHistory(poolId);
  142. if (res && res.length > 0) {
  143. setBoxHistory(res);
  144. setBoxHistoryInfo(res[0]);
  145. loadData();
  146. loadBox(res[0].boxNumber);
  147. }
  148. loadEmptyRuns();
  149. } catch {}
  150. }, [poolId, loadData, loadBox, loadEmptyRuns]);
  151. // 打开换盒弹窗
  152. const openBoxPopup = useCallback(async () => {
  153. if (!poolId) return;
  154. try {
  155. const res = await getBoxHistory(poolId);
  156. if (res && res.length > 0) {
  157. boxPopupRef.current?.open(res);
  158. }
  159. } catch {}
  160. }, [poolId]);
  161. // 选择盒子
  162. const handleSelectBox = useCallback((item: any) => {
  163. setBoxHistoryInfo(item);
  164. loadBox(item.boxNumber);
  165. loadEmptyRuns();
  166. }, [loadBox, loadEmptyRuns]);
  167. const handleBoxResult = (res: any) => {
  168. const map: Record<string, any> = {};
  169. if (res.usedStat)
  170. res.usedStat.forEach((item: any) => {
  171. map[item.spuId] = item;
  172. });
  173. res.usedStat = map;
  174. setBox(res);
  175. setBoxNum(res.number);
  176. lockTimeStart(res);
  177. };
  178. const lockTimeStart = (boxData: BoxData) => {
  179. lockTimeEnd();
  180. if (boxData?.lock) {
  181. setLeftTime(boxData.lock.leftTime);
  182. timerRef.current = setInterval(() => {
  183. setLeftTime((prev) => {
  184. if (prev <= 1) {
  185. lockTimeEnd();
  186. loadBox();
  187. return 0;
  188. }
  189. return prev - 1;
  190. });
  191. }, 1000);
  192. }
  193. };
  194. const lockTimeEnd = () => {
  195. if (timerRef.current) {
  196. clearInterval(timerRef.current);
  197. timerRef.current = null;
  198. }
  199. setLeftTime(0);
  200. };
  201. useEffect(() => {
  202. loadData();
  203. loadBox();
  204. loadBoxHistory();
  205. loadEmptyRuns();
  206. if (poolId) poolIn(poolId);
  207. return () => {
  208. if (poolId) poolOut(poolId);
  209. lockTimeEnd();
  210. };
  211. }, [poolId]);
  212. const handlePay = async (num: number) => {
  213. if (!poolId || !data || !box) {
  214. Alert.alert('提示', '请先选择盒子');
  215. return;
  216. }
  217. try {
  218. const preview = await previewOrder(poolId, num, box.number);
  219. if (preview) checkoutRef.current?.show(num, preview, box.number);
  220. } catch (error) {
  221. console.error('预览订单失败:', error);
  222. }
  223. };
  224. const handleSuccess = () => {
  225. setTimeout(() => {
  226. loadData();
  227. loadBox(boxNum);
  228. loadEmptyRuns();
  229. }, 500);
  230. };
  231. const handleUnlock = async () => {
  232. if (!poolId || !boxNum) return;
  233. try {
  234. await unlockBox(poolId, boxNum);
  235. loadBox(boxNum);
  236. } catch {}
  237. };
  238. const handlePrev = () => {
  239. if (currentIndex > 0) setCurrentIndex(currentIndex - 1);
  240. };
  241. const handleNext = () => {
  242. if (currentIndex < products.length - 1) setCurrentIndex(currentIndex + 1);
  243. };
  244. const getLevelName = (level: string) => {
  245. const map: Record<string, string> = { A: '超神款', B: '欧皇款', C: '隐藏款', D: '普通款', NESTED_BOX_GUARANTEED: '保底款' };
  246. return map[level] || level;
  247. };
  248. const getLevelBg = (level: string) => {
  249. const map: Record<string, string> = {
  250. A: Images.box.detail.productItemA,
  251. B: Images.box.detail.productItemB,
  252. C: Images.box.detail.productItemC,
  253. D: Images.box.detail.productItemD,
  254. NESTED_BOX_GUARANTEED: Images.box.detail.productItemD,
  255. };
  256. return map[level] || Images.box.detail.productItemD;
  257. };
  258. const leftNum = box?.lock ? (leftTime / box.lock.leftTime) * 100 : 0;
  259. const headerBg = scrollTop > 0 ? '#333' : 'transparent';
  260. if (loading) return <View style={styles.loadingContainer}><ActivityIndicator size="large" color="#fff" /></View>;
  261. if (!data)
  262. return (
  263. <View style={styles.loadingContainer}>
  264. <Text style={styles.errorText}>奖池不存在</Text>
  265. <TouchableOpacity style={styles.backBtn2} onPress={() => router.back()}>
  266. <Text style={styles.backBtn2Text}>返回</Text>
  267. </TouchableOpacity>
  268. </View>
  269. );
  270. const currentProduct = products[currentIndex];
  271. return (
  272. <View style={styles.container}>
  273. <StatusBar barStyle="light-content" />
  274. <ImageBackground source={{ uri: Images.common.indexBg }} style={styles.background} resizeMode="cover">
  275. {/* 顶部导航 */}
  276. <View style={[styles.header, { paddingTop: insets.top, backgroundColor: headerBg }]}>
  277. <TouchableOpacity style={styles.backBtn} onPress={() => router.back()}>
  278. <Text style={styles.backText}>{'<'}</Text>
  279. </TouchableOpacity>
  280. <Text style={styles.headerTitle} numberOfLines={1}>{data.poolName || data.name}</Text>
  281. <View style={styles.placeholder} />
  282. </View>
  283. <ScrollView style={styles.scrollView} showsVerticalScrollIndicator={false} onScroll={(e) => setScrollTop(e.nativeEvent.contentOffset.y)} scrollEventThrottle={16}>
  284. {/* 主商品展示区域 */}
  285. <ImageBackground source={{ uri: Images.box.detail.mainGoodsSection }} style={styles.mainGoodsSection} resizeMode="cover">
  286. <View style={{ height: 72 + insets.top }} />
  287. <View style={styles.mainSwiper}>
  288. {currentProduct && (
  289. <>
  290. <Animated.View style={[styles.productImageBox, { transform: [{ translateY: floatAnim }] }]}>
  291. <Image source={{ uri: currentProduct.cover }} style={styles.productImage} contentFit="contain" />
  292. </Animated.View>
  293. {currentProduct.price && <Text style={styles.priceText}>¥{currentProduct.price}</Text>}
  294. <ImageBackground source={{ uri: Images.box.detail.detailsBut }} style={styles.detailsBut} resizeMode="contain">
  295. <Text style={styles.levelText}>{getLevelName(currentProduct.level)}</Text>
  296. </ImageBackground>
  297. <ImageBackground source={{ uri: Images.box.detail.nameBg }} style={styles.goodsNameBg} resizeMode="contain">
  298. <Text style={styles.goodsNameText} numberOfLines={6}>{currentProduct.name}</Text>
  299. </ImageBackground>
  300. </>
  301. )}
  302. {currentIndex > 0 && (
  303. <TouchableOpacity style={styles.prevBtn} onPress={handlePrev}>
  304. <Image source={{ uri: Images.box.detail.left }} style={styles.arrowImg} contentFit="contain" />
  305. </TouchableOpacity>
  306. )}
  307. {currentIndex < products.length - 1 && (
  308. <TouchableOpacity style={styles.nextBtn} onPress={handleNext}>
  309. <Image source={{ uri: Images.box.detail.right }} style={styles.arrowImg} contentFit="contain" />
  310. </TouchableOpacity>
  311. )}
  312. </View>
  313. <Image source={{ uri: Images.box.detail.positionBgleftBg }} style={styles.positionBgleftBg} contentFit="contain" />
  314. <Image source={{ uri: Images.box.detail.positionBgRightBg }} style={styles.positionBgRightBg} contentFit="contain" />
  315. </ImageBackground>
  316. <Image source={{ uri: Images.box.detail.mainGoodsSectionBtext }} style={styles.mainGoodsSectionBtext} contentFit="cover" />
  317. {/* 侧边按钮 */}
  318. <TouchableOpacity style={[styles.positionBut, styles.positionRule]} onPress={() => ruleRef.current?.show()}>
  319. <ImageBackground source={{ uri: Images.box.detail.positionBgLeft }} style={styles.positionButBg} resizeMode="contain">
  320. <Text style={styles.positionButText}>规则</Text>
  321. </ImageBackground>
  322. </TouchableOpacity>
  323. {box?.lock && user && box.lock.locker === (user.userId || user.id) && (
  324. <TouchableOpacity style={[styles.positionBut, styles.positionLock]} onPress={handleUnlock}>
  325. <ImageBackground source={{ uri: Images.box.detail.positionBgLeft }} style={styles.positionButBg} resizeMode="contain">
  326. <Text style={styles.positionButText}>解锁</Text>
  327. </ImageBackground>
  328. </TouchableOpacity>
  329. )}
  330. <TouchableOpacity style={[styles.positionBut, styles.positionStore]} onPress={() => router.push('/boxInBox/boxList' as any)}>
  331. <ImageBackground source={{ uri: Images.box.detail.positionBgRight }} style={styles.positionButBg} resizeMode="contain">
  332. <Text style={styles.positionButTextR}>宝箱</Text>
  333. </ImageBackground>
  334. </TouchableOpacity>
  335. <TouchableOpacity style={[styles.positionBut, styles.positionRefresh]} onPress={() => refreshBox()}>
  336. <ImageBackground source={{ uri: Images.box.detail.positionBgRight }} style={styles.positionButBg} resizeMode="contain">
  337. <Text style={styles.positionButTextR}>刷新</Text>
  338. </ImageBackground>
  339. </TouchableOpacity>
  340. {/* 空车计数 */}
  341. <View style={styles.emptyRunsBox}>
  342. <Text style={styles.emptyRunsText}>连续空车:{emptyRuns}</Text>
  343. </View>
  344. {/* 锁定倒计时 */}
  345. {box?.lock && (
  346. <View style={styles.lockTimeBox}>
  347. <Text style={styles.lockTimeLabel}>剩余时间:</Text>
  348. <View style={styles.lockTimeBarBox}>
  349. <View style={styles.lockTimeBar}>
  350. <View style={[styles.processBar, { width: `${leftNum}%` }]} />
  351. </View>
  352. <Text style={[styles.lockTimeText, { left: `${leftNum}%` }]}>{leftTime}</Text>
  353. </View>
  354. </View>
  355. )}
  356. {/* 箱子信息区域 */}
  357. <View style={styles.firstLastWrapper}>
  358. {/* 标题栏 */}
  359. <View style={styles.firstLastTitle}>
  360. <View style={styles.firstLastInfo}>
  361. {boxHistoryInfo && (
  362. <>
  363. <View style={styles.sizeInfo}>
  364. <Text style={styles.sizeLabel}>箱数:</Text>
  365. <Text style={styles.sizeValue}>{boxHistoryInfo.boxNumber}</Text>
  366. <Text style={styles.sizeLabel}>/{boxHistory.length || '-'}箱</Text>
  367. </View>
  368. <View style={styles.sizeInfo}>
  369. <Text style={styles.sizeLabel}>总数:</Text>
  370. <Text style={styles.sizeValue}>{boxHistoryInfo.leftQuantity}</Text>
  371. <Text style={styles.sizeLabel}>/{boxHistoryInfo.quantity}</Text>
  372. </View>
  373. </>
  374. )}
  375. </View>
  376. <TouchableOpacity style={styles.changeBoxBtn} onPress={openBoxPopup}>
  377. <Text style={styles.changeBoxText}>换箱</Text>
  378. </TouchableOpacity>
  379. </View>
  380. {/* Tab 切换 */}
  381. <View style={styles.tabSection}>
  382. <TouchableOpacity style={[styles.tabItem, tabIndex === 0 && styles.tabItemActive]} onPress={() => setTabIndex(0)}>
  383. <Text style={[styles.tabText, tabIndex === 0 && styles.tabTextActive]}>赏品预览</Text>
  384. </TouchableOpacity>
  385. <TouchableOpacity style={[styles.tabItem, tabIndex === 1 && styles.tabItemActive]} onPress={() => setTabIndex(1)}>
  386. <Text style={[styles.tabText, tabIndex === 1 && styles.tabTextActive]}>中奖记录</Text>
  387. </TouchableOpacity>
  388. </View>
  389. {/* 活动商品列表 */}
  390. {tabIndex === 0 && (
  391. <View style={styles.activityGoodsGrid}>
  392. {activityGoods.map((item, index) => (
  393. <View key={item.id || index} style={styles.activityGoodsItem}>
  394. <View style={styles.activityImageBox}>
  395. <Image source={{ uri: item.cover }} style={styles.activityImage} contentFit="cover" />
  396. <View style={styles.probabilityBadge}>
  397. <Text style={styles.probabilityText}>概率:{(item.probability * 100).toFixed(2)}%</Text>
  398. </View>
  399. <View style={styles.priceBadge}>
  400. <Text style={styles.priceTextSmall}>参考价:{item.price}</Text>
  401. </View>
  402. </View>
  403. <View style={[styles.levelBadgeSmall, item.level === 'NESTED_BOX_GUARANTEED' ? styles.levelD : styles.levelAll]}>
  404. <Text style={styles.levelBadgeText}>{item.level === 'NESTED_BOX_GUARANTEED' ? 'D赏' : '全局赏'}</Text>
  405. </View>
  406. <Text style={styles.activityName} numberOfLines={1}>{item.name}</Text>
  407. </View>
  408. ))}
  409. </View>
  410. )}
  411. {/* 中奖记录 - 暂时显示空状态 */}
  412. {tabIndex === 1 && (
  413. <View style={styles.emptyRecord}>
  414. <Text style={styles.emptyRecordText}>暂无中奖记录</Text>
  415. </View>
  416. )}
  417. </View>
  418. {/* 奖品列表 */}
  419. <View style={styles.productGrid}>
  420. <Text style={styles.gridTitle}>奖品列表</Text>
  421. <View style={styles.gridContent}>
  422. {products.map((item, index) => (
  423. <View key={item.id || index} style={styles.gridItem}>
  424. <ImageBackground source={{ uri: getLevelBg(item.level) }} style={styles.gridItemBg} resizeMode="stretch">
  425. <View style={styles.gridImageBox}>
  426. <Image source={{ uri: item.cover }} style={styles.gridImage} contentFit="cover" />
  427. </View>
  428. <Text style={styles.gridName} numberOfLines={2}>{item.name}</Text>
  429. <Text style={styles.gridLevel}>{getLevelName(item.level)}</Text>
  430. {item.price && <Text style={styles.gridPrice}>¥{item.price}</Text>}
  431. </ImageBackground>
  432. </View>
  433. ))}
  434. </View>
  435. </View>
  436. <View style={{ height: 150 }} />
  437. </ScrollView>
  438. {/* 底部购买栏 */}
  439. <ImageBackground source={{ uri: Images.box.detail.boxDetailBott }} style={[styles.bottomBar, { paddingBottom: insets.bottom + 10 }]} resizeMode="cover">
  440. <View style={styles.bottomBtns}>
  441. <TouchableOpacity style={styles.btnItemFull} onPress={() => handlePay(1)} activeOpacity={0.8}>
  442. <ImageBackground source={{ uri: Images.common.butBgV }} style={styles.btnBg} resizeMode="contain">
  443. <Text style={styles.btnText}>×1</Text>
  444. </ImageBackground>
  445. </TouchableOpacity>
  446. </View>
  447. </ImageBackground>
  448. </ImageBackground>
  449. <CheckoutModal ref={checkoutRef} data={data} poolId={poolId!} boxNumber={boxNum} onSuccess={handleSuccess} />
  450. <RuleModal ref={ruleRef} />
  451. <BoxPopup ref={boxPopupRef} onSelect={handleSelectBox} />
  452. </View>
  453. );
  454. }
  455. const styles = StyleSheet.create({
  456. container: { flex: 1, backgroundColor: '#1a1a2e' },
  457. background: { flex: 1 },
  458. loadingContainer: { flex: 1, backgroundColor: '#1a1a2e', justifyContent: 'center', alignItems: 'center' },
  459. errorText: { color: '#999', fontSize: 16 },
  460. backBtn2: { marginTop: 20, backgroundColor: '#ff6600', paddingHorizontal: 20, paddingVertical: 10, borderRadius: 8 },
  461. backBtn2Text: { color: '#fff', fontSize: 14 },
  462. header: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 10, paddingBottom: 10, position: 'absolute', top: 0, left: 0, right: 0, zIndex: 100 },
  463. backBtn: { width: 40, height: 40, justifyContent: 'center', alignItems: 'center' },
  464. backText: { color: '#fff', fontSize: 16, fontWeight: 'bold' },
  465. headerTitle: { color: '#fff', fontSize: 15, fontWeight: 'bold', flex: 1, textAlign: 'center', width: 250 },
  466. placeholder: { width: 40 },
  467. scrollView: { flex: 1 },
  468. mainGoodsSection: { width: SCREEN_WIDTH, height: 504, position: 'relative' },
  469. mainSwiper: { position: 'relative', width: '100%', height: 375, alignItems: 'center', justifyContent: 'center', marginTop: -50 },
  470. productImageBox: { width: 200, height: 280, justifyContent: 'center', alignItems: 'center' },
  471. productImage: { width: 200, height: 280 },
  472. priceText: { color: '#fff', fontSize: 16, fontWeight: 'bold', marginTop: -20 },
  473. detailsBut: { width: 120, height: 45, justifyContent: 'center', alignItems: 'center', marginTop: -10 },
  474. levelText: { fontSize: 14, color: '#FBC400', fontWeight: 'bold' },
  475. goodsNameBg: { position: 'absolute', left: 47, top: 53, width: 43, height: 100, paddingTop: 8, justifyContent: 'flex-start', alignItems: 'center' },
  476. goodsNameText: { fontSize: 12, fontWeight: 'bold', color: '#000', width: 20, textAlign: 'center' },
  477. prevBtn: { position: 'absolute', left: 35, top: '40%' },
  478. nextBtn: { position: 'absolute', right: 35, top: '40%' },
  479. arrowImg: { width: 33, height: 38 },
  480. positionBgleftBg: { position: 'absolute', left: 0, top: 225, width: 32, height: 188 },
  481. positionBgRightBg: { position: 'absolute', right: 0, top: 225, width: 32, height: 188 },
  482. mainGoodsSectionBtext: { width: SCREEN_WIDTH, height: 74, marginTop: -10 },
  483. positionBut: { position: 'absolute', zIndex: 10, width: 35, height: 34 },
  484. positionButBg: { width: 35, height: 34, justifyContent: 'center', alignItems: 'center' },
  485. positionButText: { fontSize: 12, fontWeight: 'bold', color: '#fff', transform: [{ rotate: '14deg' }], textShadowColor: '#000', textShadowOffset: { width: 1, height: 1 }, textShadowRadius: 1 },
  486. positionButTextR: { fontSize: 12, fontWeight: 'bold', color: '#fff', transform: [{ rotate: '-16deg' }], textShadowColor: '#000', textShadowOffset: { width: 1, height: 1 }, textShadowRadius: 1 },
  487. positionRule: { top: 256, left: 0 },
  488. positionLock: { top: 300, left: 0 },
  489. positionStore: { top: 256, right: 0 },
  490. positionRefresh: { top: 300, right: 0 },
  491. emptyRunsBox: { alignItems: 'center', marginTop: -60, marginBottom: 10 },
  492. emptyRunsText: { color: '#fff', fontSize: 12, backgroundColor: 'rgba(0,0,0,0.5)', paddingHorizontal: 15, paddingVertical: 5, borderRadius: 10 },
  493. lockTimeBox: { flexDirection: 'row', alignItems: 'center', backgroundColor: '#71ccff', padding: 10, marginHorizontal: 10, borderRadius: 8, marginBottom: 10 },
  494. lockTimeLabel: { color: '#000', fontSize: 12 },
  495. lockTimeBarBox: { flex: 1, height: 30, position: 'relative', justifyContent: 'center' },
  496. lockTimeBar: { height: 8, backgroundColor: 'rgba(255,255,255,0.6)', borderRadius: 4, overflow: 'hidden' },
  497. processBar: { height: '100%', backgroundColor: '#209ae5', borderRadius: 4 },
  498. lockTimeText: { position: 'absolute', top: -5, fontSize: 10, backgroundColor: '#000', color: '#fff', paddingHorizontal: 4, borderRadius: 2, marginLeft: -13 },
  499. // 箱子信息区域样式
  500. firstLastWrapper: { marginHorizontal: 10, marginBottom: 10, backgroundColor: '#fff', borderRadius: 8, overflow: 'hidden', borderWidth: 2, borderColor: '#000' },
  501. firstLastTitle: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', backgroundColor: '#ffc900', paddingHorizontal: 20, paddingVertical: 15, borderBottomWidth: 2, borderBottomColor: '#000' },
  502. firstLastInfo: { flexDirection: 'row', alignItems: 'center' },
  503. sizeInfo: { flexDirection: 'row', alignItems: 'center', marginRight: 15 },
  504. sizeLabel: { fontSize: 11, color: '#fff' },
  505. sizeValue: { fontSize: 16, fontWeight: 'bold', color: '#fff' },
  506. changeBoxBtn: { backgroundColor: '#ff8c16', paddingHorizontal: 15, paddingVertical: 8, borderRadius: 4, borderWidth: 1, borderColor: '#333' },
  507. changeBoxText: { fontSize: 11, color: '#fff' },
  508. // Tab 切换样式
  509. tabSection: { flexDirection: 'row', borderBottomWidth: 1, borderBottomColor: '#E4E4E4' },
  510. tabItem: { flex: 1, paddingVertical: 12, alignItems: 'center' },
  511. tabItemActive: {},
  512. tabText: { fontSize: 14, color: '#9E9E9E' },
  513. tabTextActive: { color: '#ff8c16', fontWeight: 'bold' },
  514. // 活动商品列表样式
  515. activityGoodsGrid: { flexDirection: 'row', flexWrap: 'wrap', padding: 8 },
  516. activityGoodsItem: { width: '33.33%', padding: 4, alignItems: 'center', marginBottom: 10 },
  517. activityImageBox: { width: 100, height: 100, borderWidth: 2, borderColor: '#1A1A1A', borderRadius: 4, overflow: 'hidden', position: 'relative' },
  518. activityImage: { width: '100%', height: '100%' },
  519. probabilityBadge: { position: 'absolute', top: 0, left: 0, right: 0, backgroundColor: 'rgba(0,0,0,0.5)', paddingVertical: 2 },
  520. probabilityText: { fontSize: 7, color: '#fff', textAlign: 'center' },
  521. priceBadge: { position: 'absolute', bottom: 5, left: 5, right: 5, backgroundColor: 'rgba(0,0,0,0.5)', paddingVertical: 4, borderRadius: 2 },
  522. priceTextSmall: { fontSize: 7, color: '#fff', textAlign: 'center' },
  523. levelBadgeSmall: { marginTop: 5, paddingHorizontal: 10, paddingVertical: 3, borderRadius: 2 },
  524. levelD: { backgroundColor: '#6340FF', borderWidth: 1, borderColor: '#A2BBFF' },
  525. levelAll: { backgroundColor: '#A3E100', borderWidth: 1, borderColor: '#EAFFB1' },
  526. levelBadgeText: { fontSize: 12, textAlign: 'center' },
  527. activityName: { fontSize: 12, color: '#333', marginTop: 4, textAlign: 'center' },
  528. // 空记录样式
  529. emptyRecord: { padding: 40, alignItems: 'center' },
  530. emptyRecordText: { fontSize: 14, color: '#999' },
  531. productGrid: { margin: 10, backgroundColor: 'rgba(0,0,0,0.3)', borderRadius: 15, padding: 15 },
  532. gridTitle: { color: '#fff', fontSize: 16, fontWeight: 'bold', marginBottom: 15 },
  533. gridContent: { flexDirection: 'row', flexWrap: 'wrap', marginHorizontal: -5 },
  534. gridItem: { width: '33.33%', paddingHorizontal: 5, marginBottom: 10 },
  535. gridItemBg: { width: '100%', aspectRatio: 0.75, padding: 8, alignItems: 'center' },
  536. gridImageBox: { width: '100%', aspectRatio: 1, borderRadius: 5, overflow: 'hidden', backgroundColor: 'rgba(255,255,255,0.1)' },
  537. gridImage: { width: '100%', height: '100%' },
  538. gridName: { color: '#fff', fontSize: 10, marginTop: 5, textAlign: 'center', height: 26 },
  539. gridLevel: { color: '#FBC400', fontSize: 9, marginTop: 2 },
  540. gridPrice: { color: '#ff6600', fontSize: 10, marginTop: 2 },
  541. bottomBar: { position: 'absolute', bottom: 0, left: 0, right: 0, height: 69, paddingHorizontal: 5 },
  542. bottomBtns: { flexDirection: 'row', height: 64, alignItems: 'center', justifyContent: 'center' },
  543. btnItemFull: { width: 200 },
  544. btnBg: { width: '100%', height: 54, justifyContent: 'center', alignItems: 'center' },
  545. btnText: { fontSize: 18, fontWeight: 'bold', color: '#fff' },
  546. });