index.tsx 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. import { Image } from 'expo-image';
  2. import { useRouter } from 'expo-router';
  3. import React, { useCallback, useEffect, useState } from 'react';
  4. import {
  5. ActivityIndicator,
  6. Alert,
  7. FlatList,
  8. ImageBackground,
  9. Platform,
  10. Pressable,
  11. RefreshControl,
  12. ScrollView,
  13. StatusBar,
  14. StyleSheet,
  15. Text,
  16. TouchableOpacity,
  17. View
  18. } from 'react-native';
  19. import { useSafeAreaInsets } from 'react-native-safe-area-context';
  20. import { Images } from '@/constants/images';
  21. import {
  22. getStore,
  23. getTakeList,
  24. moveOutSafeStore,
  25. moveToSafeStore,
  26. } from '@/services/award';
  27. import { getParamConfig } from '@/services/user';
  28. import CheckoutModal from './components/CheckoutModal';
  29. import TransferModal from './components/TransferModal';
  30. const LEVEL_MAP: Record<string, { title: string; color: string }> = {
  31. A: { title: '超神', color: '#ff0000' }, // 红色
  32. B: { title: '欧皇', color: '#ffae00' }, // 黄色
  33. C: { title: '隐藏', color: '#9745e6' },
  34. D: { title: '普通', color: '#666666' },
  35. SUBSTITUTE: { title: '置换款', color: '#666666' },
  36. OTHER: { title: '其他', color: '#666666' },
  37. };
  38. const LEVEL_TABS = [
  39. { title: '全部', value: '' },
  40. { title: '普通', value: 'D' },
  41. { title: '隐藏', value: 'C' },
  42. { title: '欧皇', value: 'B' },
  43. { title: '超神', value: 'A' },
  44. { title: '其他', value: 'OTHER' },
  45. ];
  46. const FROM_TYPE_MAP: Record<string, string> = {
  47. LUCK: '奖池', MALL: '商城', LUCK_ROOM: '福利房', LUCK_WHEEL: '魔天轮',
  48. DOLL_MACHINE: '扭蛋', ACTIVITY: '活动', SUBSTITUTE: '商品置换', TRANSFER: '商品转赠',
  49. DISTRIBUTION: '分销', LUCK_PICKUP: '商品提货', LUCK_EXCHANGE: '商品兑换',
  50. RECHARGE: '充值', WITHDRAW: '提现', OFFICIAL: '官方',
  51. LUCK_ACTIVITY: '奖池活动', CONSUMPTION_ACTIVITY: '消费活动',
  52. NEW_USER_RANK_ACTIVITY: '拉新排名活动', CONSUMPTION_RANK_ACTIVITY: '消费排行榜活动',
  53. WHEEL_ACTIVITY: '大转盘活动', TA_ACTIVITY: '勇者之塔活动',
  54. ISLAND_ACTIVITY: '海岛活动', REDEEM_CODE_ACTIVITY: '兑换码活动',
  55. };
  56. interface StoreItem {
  57. id: string;
  58. level: string;
  59. safeFlag: number;
  60. magicAmount?: number;
  61. fromRelationType: string;
  62. spu: { id: string; name: string; cover: string; marketPrice?: number };
  63. }
  64. interface PickupItem {
  65. tradeNo: string;
  66. createTime: string;
  67. status: number;
  68. contactName: string;
  69. contactNo: string;
  70. province: string;
  71. city: string;
  72. district: string;
  73. address: string;
  74. expressAmount: number;
  75. paymentTime?: string;
  76. paymentTimeoutTime?: string;
  77. cancelRemark?: string;
  78. itemList: Array<{ id: string; spuId: string; level: string; cover: string }>;
  79. }
  80. const STATUS_MAP: Record<number, { text: string; color: string }> = {
  81. 0: { text: '待支付运费', color: '#ff6b00' },
  82. 1: { text: '已进仓库进行配货', color: '#ff6b00' },
  83. 2: { text: '待收货', color: '#ff6b00' },
  84. 10: { text: '已取消', color: '#ff6b00' },
  85. 11: { text: '超时取消', color: '#ff6b00' },
  86. 12: { text: '系统取消', color: '#ff6b00' },
  87. 99: { text: '已完成', color: '#52c41a' },
  88. };
  89. export default function StoreScreen() {
  90. const router = useRouter();
  91. const insets = useSafeAreaInsets();
  92. const [mainTabIndex, setMainTabIndex] = useState(0);
  93. const [levelTabIndex, setLevelTabIndex] = useState(0);
  94. const [list, setList] = useState<any[]>([]);
  95. const [loading, setLoading] = useState(false);
  96. const [refreshing, setRefreshing] = useState(false);
  97. const [page, setPage] = useState(1);
  98. const [hasMore, setHasMore] = useState(true);
  99. const [checkMap, setCheckMap] = useState<Record<string, StoreItem>>({});
  100. const [checkoutVisible, setCheckoutVisible] = useState(false);
  101. const [transferVisible, setTransferVisible] = useState(false);
  102. const [shareOnState, setShareOnState] = useState(0);
  103. const mainTabs = ['未使用', '保险柜', '已提货'];
  104. const loadData = useCallback(async (pageNum: number, isRefresh = false) => {
  105. if (loading && !isRefresh) return;
  106. if (!hasMore && pageNum > 1 && !isRefresh) return;
  107. try {
  108. if (pageNum === 1) setLoading(true);
  109. let res: any;
  110. if (mainTabIndex === 0) {
  111. res = await getStore(pageNum, 20, 0, LEVEL_TABS[levelTabIndex].value);
  112. } else if (mainTabIndex === 1) {
  113. res = await getStore(pageNum, 20, 1);
  114. } else {
  115. res = await getTakeList(pageNum, 20);
  116. }
  117. let records = Array.isArray(res) ? res : (res?.records || res || []);
  118. // 处理已提货数据,合并相同商品
  119. if (mainTabIndex === 2 && records.length > 0) {
  120. records = records.map((item: PickupItem) => {
  121. const goodsMap: Record<string, { total: number; data: any }> = {};
  122. (item.itemList || []).forEach((goods: any) => {
  123. const key = `${goods.spuId}_${goods.level}`;
  124. if (goodsMap[key]) {
  125. goodsMap[key].total += 1;
  126. } else {
  127. goodsMap[key] = { total: 1, data: goods };
  128. }
  129. });
  130. return { ...item, groupedList: Object.values(goodsMap) };
  131. });
  132. }
  133. if (records.length < 20) setHasMore(false);
  134. if (pageNum === 1 || isRefresh) setList(records);
  135. else setList(prev => [...prev, ...records]);
  136. } catch (e) {
  137. console.error('加载仓库数据失败:', e);
  138. } finally {
  139. setLoading(false);
  140. setRefreshing(false);
  141. }
  142. }, [mainTabIndex, levelTabIndex, loading, hasMore]);
  143. // 获取转赠开关
  144. useEffect(() => {
  145. const fetchShareOn = async () => {
  146. try {
  147. const config = await getParamConfig('share_on');
  148. console.log('[DEBUG] share_on config:', config);
  149. // 如果未取到数据可能默认应显示,此处做兼容保留原有1状态,没配置也暂且视作1(开启)或以服务器为主
  150. setShareOnState(config?.state ?? 1);
  151. } catch (e) {
  152. console.error('获取转赠开关失败:', e);
  153. setShareOnState(1); // 网络请求失败时降级开启转赠
  154. }
  155. };
  156. fetchShareOn();
  157. }, []);
  158. useEffect(() => {
  159. setPage(1); setList([]); setHasMore(true); setCheckMap({});
  160. loadData(1, true);
  161. }, [mainTabIndex]);
  162. useEffect(() => {
  163. if (mainTabIndex === 0) {
  164. setPage(1); setList([]); setHasMore(true); setCheckMap({});
  165. loadData(1, true);
  166. }
  167. }, [levelTabIndex]);
  168. const handleRefresh = () => { setRefreshing(true); setPage(1); setHasMore(true); loadData(1, true); };
  169. const handleLoadMore = () => { if (!loading && hasMore) { const np = page + 1; setPage(np); loadData(np); } };
  170. const handleChoose = (item: StoreItem) => {
  171. if (item.safeFlag === 1 && mainTabIndex === 0) return;
  172. setCheckMap(prev => {
  173. const newMap = { ...prev };
  174. if (newMap[item.id]) delete newMap[item.id];
  175. else newMap[item.id] = item;
  176. return newMap;
  177. });
  178. };
  179. const handleLock = async (item: StoreItem, index: number) => {
  180. const res = await moveToSafeStore([item.id]);
  181. if (res) {
  182. const newList = [...list]; newList[index] = { ...item, safeFlag: 1 }; setList(newList);
  183. setCheckMap(prev => { const m = { ...prev }; delete m[item.id]; return m; });
  184. }
  185. };
  186. const handleUnlock = async (item: StoreItem, index: number) => {
  187. const res = await moveOutSafeStore([item.id]);
  188. if (res) {
  189. if (mainTabIndex === 1) setList(list.filter((_, i) => i !== index));
  190. else { const newList = [...list]; newList[index] = { ...item, safeFlag: 0 }; setList(newList); }
  191. }
  192. };
  193. const handleMoveOutAll = async () => {
  194. const selected = Object.values(checkMap);
  195. if (selected.length === 0) { showAlert('请至少选择一个商品!'); return; }
  196. const res = await moveOutSafeStore(selected.map(i => i.id));
  197. if (res) { setCheckMap({}); handleRefresh(); }
  198. };
  199. const handleTakeGoods = () => {
  200. const selected = Object.values(checkMap);
  201. if (selected.length === 0) { showAlert('请至少选择一个商品!'); return; }
  202. setCheckoutVisible(true);
  203. };
  204. const handleSelectAll = () => {
  205. const allSelected = list.every(item => checkMap[item.id]);
  206. if (allSelected) {
  207. setCheckMap({});
  208. } else {
  209. const newMap: Record<string, StoreItem> = {};
  210. list.forEach(item => {
  211. newMap[item.id] = item;
  212. });
  213. setCheckMap(newMap);
  214. }
  215. };
  216. const handleCheckoutSuccess = () => {
  217. setCheckoutVisible(false);
  218. setCheckMap({});
  219. handleRefresh();
  220. };
  221. const handleTransfer = () => {
  222. const selected = Object.values(checkMap);
  223. if (selected.length === 0) { showAlert('请至少选择一个商品!'); return; }
  224. setTransferVisible(true);
  225. };
  226. const handleTransferSuccess = () => {
  227. setTransferVisible(false);
  228. setCheckMap({});
  229. handleRefresh();
  230. };
  231. const showAlert = (msg: string) => {
  232. if (Platform.OS === 'web') window.alert(msg);
  233. else Alert.alert('提示', msg);
  234. };
  235. const renderStoreItem = ({ item, index }: { item: StoreItem; index: number }) => {
  236. const levelInfo = LEVEL_MAP[item.level] || LEVEL_MAP.D;
  237. const isChecked = !!checkMap[item.id];
  238. const canSelect = mainTabIndex === 1 || item.safeFlag !== 1;
  239. return (
  240. <ImageBackground source={{ uri: Images.mine.storeItemBg }} style={styles.cell} resizeMode="stretch">
  241. <Pressable style={styles.cellContent} onPress={() => {
  242. console.log('[仓库store] 点击商品详情, id:', item.id);
  243. router.push({ pathname: '/store/detail', params: { id: item.id } } as any);
  244. }}>
  245. <TouchableOpacity style={styles.cellHeader} onPress={() => canSelect && handleChoose(item)}>
  246. <View style={styles.headerLeft}>
  247. {canSelect && (
  248. <View style={[styles.checkBox, isChecked && styles.checkBoxChecked]}>
  249. {isChecked && <Text style={styles.checkIcon}>✓</Text>}
  250. </View>
  251. )}
  252. <Text style={[styles.levelTitle, { color: levelInfo.color }]}>{levelInfo.title}</Text>
  253. </View>
  254. <TouchableOpacity style={styles.lockBox} onPress={() => item.safeFlag !== 1 ? handleLock(item, index) : handleUnlock(item, index)}>
  255. <Text style={styles.lockText}>{item.safeFlag !== 1 ? '锁定' : '解锁'}</Text>
  256. <Image source={{ uri: item.safeFlag !== 1 ? Images.mine.lock : Images.mine.unlock }} style={styles.lockIcon} />
  257. </TouchableOpacity>
  258. </TouchableOpacity>
  259. <View style={styles.cellBody}>
  260. <ImageBackground source={{ uri: Images.mine.storeGoodsImgBg }} style={styles.goodsImgBg}>
  261. <Image source={{ uri: item.spu?.cover }} style={styles.goodsImg} contentFit="contain" />
  262. </ImageBackground>
  263. <View style={styles.goodsInfo}>
  264. <Text style={styles.goodsName} numberOfLines={2}>{item.spu?.name}</Text>
  265. {(item.spu?.marketPrice ?? 0) > 0 && (
  266. <Text style={styles.goodsPrice}>¥{item.spu?.marketPrice}</Text>
  267. )}
  268. <Text style={styles.goodsSource}>从{FROM_TYPE_MAP[item.fromRelationType] || '其他'}获得</Text>
  269. </View>
  270. <Text style={styles.arrow}>{'>'}</Text>
  271. </View>
  272. </Pressable>
  273. </ImageBackground>
  274. );
  275. };
  276. const copyToClipboard = (text: string) => {
  277. showAlert(`订单号已复制: ${text}`);
  278. };
  279. const showExpress = (item: PickupItem) => {
  280. router.push({ pathname: '/store/packages' as any, params: { tradeNo: item.tradeNo } });
  281. };
  282. const renderPickupItem = ({ item }: { item: PickupItem & { groupedList?: Array<{ total: number; data: any }> } }) => {
  283. const statusInfo = STATUS_MAP[item.status] || { text: '未知', color: '#999' };
  284. return (
  285. <ImageBackground source={{ uri: Images.mine.storeItemBg }} style={styles.pickupCell} resizeMode="stretch">
  286. {/* 顶部信息 */}
  287. <View style={styles.pickupTop}>
  288. <Text style={styles.pickupTime}>下单时间:{item.createTime}</Text>
  289. <Text style={[styles.pickupStatus, { color: statusInfo.color }]}>{statusInfo.text}</Text>
  290. </View>
  291. {item.status === 0 && item.paymentTimeoutTime && (
  292. <Text style={styles.pickupTimeout}>{item.paymentTimeoutTime} 将自动取消该订单,如有优惠券,将自动退回</Text>
  293. )}
  294. {/* 收货地址 */}
  295. <View style={styles.pickupAddress}>
  296. <Text style={styles.locationIcon}>📍</Text>
  297. <View style={styles.addressInfo}>
  298. <Text style={styles.addressName}>{item.contactName},{item.contactNo}</Text>
  299. <Text style={styles.addressDetail}>{item.province}{item.city}{item.district}{item.address}</Text>
  300. </View>
  301. </View>
  302. {/* 商品列表 */}
  303. <View style={styles.pickupGoodsBox}>
  304. <ScrollView horizontal showsHorizontalScrollIndicator={false} style={styles.pickupGoodsList}>
  305. {(item.groupedList || []).map((goods, idx) => (
  306. <View key={idx} style={styles.pickupGoodsItem}>
  307. <Image source={{ uri: goods.data.cover }} style={styles.pickupGoodsImg} contentFit="contain" />
  308. <View style={styles.pickupGoodsCount}>
  309. <Text style={styles.pickupGoodsCountText}>x{goods.total}</Text>
  310. </View>
  311. </View>
  312. ))}
  313. </ScrollView>
  314. </View>
  315. {/* 订单号 */}
  316. <View style={styles.pickupOrderRow}>
  317. <Text style={styles.pickupOrderLabel}>订单号:</Text>
  318. <Text style={styles.pickupOrderNo} numberOfLines={1}>{item.tradeNo}</Text>
  319. <TouchableOpacity style={styles.copyBtn} onPress={() => copyToClipboard(item.tradeNo)}>
  320. <Text style={styles.copyBtnText}>复制</Text>
  321. </TouchableOpacity>
  322. </View>
  323. {item.paymentTime && (
  324. <View style={styles.pickupInfoRow}>
  325. <Text style={styles.pickupInfoLabel}>付款时间:</Text>
  326. <Text style={styles.pickupInfoValue}>{item.paymentTime}</Text>
  327. </View>
  328. )}
  329. {item.status === 12 && item.cancelRemark && (
  330. <View style={styles.pickupInfoRow}>
  331. <Text style={styles.pickupInfoLabel}>备注</Text>
  332. <Text style={[styles.pickupInfoValue, { color: '#ff6b00' }]}>{item.cancelRemark}</Text>
  333. </View>
  334. )}
  335. {/* 底部操作 */}
  336. <View style={styles.pickupBottom}>
  337. <Text style={styles.pickupExpressAmount}>配送费:<Text style={styles.priceText}>¥{item.expressAmount}</Text></Text>
  338. {[1, 2, 99].includes(item.status) && (
  339. <TouchableOpacity style={styles.expressBtn} onPress={() => showExpress(item)}>
  340. <Text style={styles.expressBtnText}>物流信息</Text>
  341. </TouchableOpacity>
  342. )}
  343. </View>
  344. </ImageBackground>
  345. );
  346. };
  347. const selectedCount = Object.keys(checkMap).length;
  348. return (
  349. <View style={styles.container}>
  350. <StatusBar barStyle="light-content" />
  351. <ImageBackground source={{ uri: Images.mine.kaixinMineBg }} style={styles.background} resizeMode="cover">
  352. <Image source={{ uri: Images.mine.kaixinMineHeadBg }} style={styles.headerBg} contentFit="cover" />
  353. <View style={[styles.header, { paddingTop: insets.top }]}>
  354. <TouchableOpacity style={styles.backBtn} onPress={() => router.back()}>
  355. <Text style={styles.backIcon}>‹</Text>
  356. </TouchableOpacity>
  357. <Text style={styles.title}>仓库</Text>
  358. <View style={styles.placeholder} />
  359. </View>
  360. <View style={[styles.content, { paddingTop: insets.top + 50 }]}>
  361. <View style={styles.mainTabs}>
  362. {mainTabs.map((tab, index) => {
  363. const isActive = mainTabIndex === index;
  364. // Use Yellow L bg for active, Grey (Hui) for inactive
  365. const bg = isActive ? Images.common.butBgL : Images.common.butBgHui;
  366. return (
  367. <TouchableOpacity key={index} style={styles.mainTabItem} onPress={() => setMainTabIndex(index)}>
  368. <ImageBackground source={{ uri: bg }} style={styles.mainTabBg} resizeMode="contain">
  369. <Text style={isActive ? styles.mainTabTextActive : styles.mainTabText}>{tab}</Text>
  370. </ImageBackground>
  371. </TouchableOpacity>
  372. );
  373. })}
  374. </View>
  375. {mainTabIndex === 0 && (
  376. <View style={styles.levelTabs}>
  377. {LEVEL_TABS.map((tab, index) => {
  378. const isActive = levelTabIndex === index;
  379. return (
  380. <TouchableOpacity
  381. key={index}
  382. style={[styles.levelTabItem, isActive && styles.levelTabItemActive]}
  383. onPress={() => setLevelTabIndex(index)}
  384. >
  385. {isActive && <View style={styles.decorTL} />}
  386. <Text style={[styles.levelTabText, isActive && styles.levelTabTextActive]}>{tab.title}</Text>
  387. {isActive && <View style={styles.decorBR} />}
  388. </TouchableOpacity>
  389. );
  390. })}
  391. </View>
  392. )}
  393. <FlatList
  394. data={list as any[]}
  395. renderItem={mainTabIndex === 2 ? renderPickupItem as any : renderStoreItem as any}
  396. keyExtractor={(item: any, index) => item.id || item.tradeNo || index.toString()}
  397. contentContainerStyle={styles.listContent}
  398. refreshControl={<RefreshControl refreshing={refreshing} onRefresh={handleRefresh} tintColor="#fff" />}
  399. onEndReached={handleLoadMore}
  400. onEndReachedThreshold={0.3}
  401. ListHeaderComponent={mainTabIndex === 2 ? (
  402. <View style={styles.pickupTip}>
  403. <Text style={styles.pickupTipIcon}>⚠️</Text>
  404. <Text style={styles.pickupTipText}>您的包裹一般在5个工作日内发货,如遇特殊情况可能会有延迟,敬请谅解~</Text>
  405. </View>
  406. ) : null}
  407. ListFooterComponent={loading && list.length > 0 ? <ActivityIndicator color="#fff" style={{ marginVertical: 10 }} /> : null}
  408. ListEmptyComponent={!loading ? <View style={styles.emptyBox}><Text style={styles.emptyText}>暂无物品</Text></View> : null}
  409. />
  410. </View>
  411. {mainTabIndex !== 2 && list.length > 0 && (
  412. <View style={[styles.bottomBar, { paddingBottom: insets.bottom + 10 }]}>
  413. {mainTabIndex === 1 ? (
  414. <View style={styles.buttonRow}>
  415. <TouchableOpacity
  416. style={[styles.actionBtn, styles.selectAllBtn]}
  417. onPress={handleSelectAll}
  418. >
  419. <Text style={styles.selectAllText}>
  420. {list.length > 0 && list.every(item => checkMap[item.id]) ? '取消全选' : '全选'}
  421. </Text>
  422. </TouchableOpacity>
  423. <TouchableOpacity
  424. style={[styles.actionBtn, styles.removeBtn]}
  425. onPress={handleMoveOutAll}
  426. >
  427. <ImageBackground source={{ uri: Images.common.butBgL }} style={styles.btnBg} resizeMode="stretch">
  428. <Text style={styles.removeText}>移出保险柜</Text>
  429. </ImageBackground>
  430. </TouchableOpacity>
  431. </View>
  432. ) : (
  433. <TouchableOpacity style={styles.bottomBtn} onPress={handleTakeGoods}>
  434. <ImageBackground source={{ uri: Images.common.butBgL }} style={styles.bottomBtnBg} resizeMode="stretch">
  435. <Text style={styles.bottomBtnText}>立即提货</Text>
  436. </ImageBackground>
  437. </TouchableOpacity>
  438. )}
  439. <Text style={styles.bottomInfoText}>已选 <Text style={styles.bottomInfoCount}>{selectedCount}</Text> 件商品</Text>
  440. </View>
  441. )}
  442. {/* 转赠浮动按钮 */}
  443. {mainTabIndex === 0 && list.length > 0 && Number(shareOnState) > 0 && (
  444. <TouchableOpacity
  445. style={styles.transferFloatBtn}
  446. onPress={handleTransfer}
  447. activeOpacity={0.8}
  448. >
  449. <Image source={{ uri: Images.mine.transferBut }} style={styles.transferFloatImg} />
  450. </TouchableOpacity>
  451. )}
  452. {/* 提货弹窗 */}
  453. <CheckoutModal
  454. visible={checkoutVisible}
  455. selectedItems={Object.values(checkMap)}
  456. onClose={() => setCheckoutVisible(false)}
  457. onSuccess={handleCheckoutSuccess}
  458. />
  459. {/* 转赠弹窗 */}
  460. <TransferModal
  461. visible={transferVisible}
  462. selectedItems={Object.values(checkMap)}
  463. onClose={() => setTransferVisible(false)}
  464. onSuccess={handleTransferSuccess}
  465. />
  466. </ImageBackground>
  467. </View>
  468. );
  469. }
  470. const styles = StyleSheet.create({
  471. container: { flex: 1, backgroundColor: '#1a1a2e' },
  472. background: { flex: 1 },
  473. transferFloatBtn: {
  474. position: 'absolute',
  475. bottom: 220, // 调高一点防止跟提货按钮重叠遮挡
  476. right: 15,
  477. width: 50,
  478. height: 52,
  479. zIndex: 999, // 提高层级
  480. elevation: 10,
  481. },
  482. transferFloatImg: { width: '100%', height: '100%' },
  483. headerBg: { position: 'absolute', top: 0, left: 0, width: '100%', height: 160 },
  484. header: { position: 'absolute', top: 0, left: 0, right: 0, zIndex: 100, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 10, paddingBottom: 10 },
  485. backBtn: { width: 40, height: 40, justifyContent: 'center', alignItems: 'center' },
  486. backIcon: { fontSize: 32, color: '#fff', fontWeight: 'bold' },
  487. title: { color: '#fff', fontSize: 16, fontWeight: 'bold' },
  488. placeholder: { width: 40 },
  489. content: { flex: 1 },
  490. mainTabs: {
  491. flexDirection: 'row',
  492. justifyContent: 'space-between',
  493. paddingHorizontal: 12, // Reduced from 15 to match everything else
  494. paddingBottom: 2
  495. },
  496. mainTabItem: {
  497. width: '30%',
  498. height: 44, // Slightly taller
  499. justifyContent: 'center',
  500. alignItems: 'center'
  501. },
  502. mainTabBg: {
  503. width: '100%',
  504. height: '100%',
  505. justifyContent: 'center',
  506. alignItems: 'center'
  507. },
  508. mainTabText: { fontSize: 15, color: '#333', fontWeight: 'bold' },
  509. mainTabTextActive: { fontSize: 16, color: '#000', fontWeight: 'bold' },
  510. mainTabLine: { display: 'none' },
  511. levelTabs: {
  512. flexDirection: 'row',
  513. alignItems: 'center',
  514. paddingHorizontal: 10, // Add some padding back for the text content since container is full width
  515. paddingVertical: 12,
  516. borderBottomWidth: 1,
  517. borderBottomColor: 'rgba(255,255,255,0.15)'
  518. },
  519. levelTabItem: {
  520. marginRight: 25,
  521. alignItems: 'center',
  522. justifyContent: 'center',
  523. paddingHorizontal: 6,
  524. paddingVertical: 2,
  525. position: 'relative',
  526. minWidth: 40
  527. },
  528. levelTabItemActive: { backgroundColor: 'transparent' },
  529. levelTabText: { color: '#666', fontSize: 15, fontWeight: 'bold' },
  530. levelTabTextActive: {
  531. color: '#ff6b00',
  532. fontSize: 17,
  533. fontWeight: '900',
  534. textShadowColor: 'rgba(0, 0, 0, 0.3)',
  535. textShadowOffset: { width: 1, height: 1 },
  536. textShadowRadius: 1
  537. },
  538. // Corner Decorations - Larger and jagged simulation
  539. decorTL: {
  540. position: 'absolute',
  541. top: 0,
  542. left: -4,
  543. width: 0,
  544. height: 0,
  545. borderTopWidth: 8,
  546. borderRightWidth: 8,
  547. borderTopColor: '#ff6b00',
  548. borderRightColor: 'transparent',
  549. },
  550. decorBR: {
  551. position: 'absolute',
  552. bottom: 0,
  553. right: -4,
  554. width: 0,
  555. height: 0,
  556. borderBottomWidth: 8,
  557. borderLeftWidth: 8,
  558. borderBottomColor: '#ff6b00',
  559. borderLeftColor: 'transparent',
  560. },
  561. levelInd: { display: 'none' },
  562. listContent: {
  563. paddingHorizontal: 8,
  564. paddingVertical: 10,
  565. paddingBottom: 150,
  566. },
  567. cell: {
  568. marginBottom: 0,
  569. width: '100%',
  570. minHeight: 154, // 原项目 308rpx
  571. },
  572. cellContent: {
  573. paddingTop: 15,
  574. paddingBottom: 15,
  575. paddingLeft: 18,
  576. paddingRight: 18, // 原项目 36rpx
  577. },
  578. cellHeader: {
  579. flexDirection: 'row',
  580. justifyContent: 'space-between',
  581. alignItems: 'center',
  582. marginBottom: 10,
  583. paddingBottom: 10,
  584. borderBottomWidth: 1,
  585. borderBottomColor: 'rgba(0,0,0,0.15)',
  586. },
  587. headerLeft: { flexDirection: 'row', alignItems: 'center' },
  588. checkBox: { width: 16, height: 16, borderWidth: 2, borderColor: '#000', marginRight: 8, justifyContent: 'center', alignItems: 'center', backgroundColor: '#fff' },
  589. checkBoxChecked: { backgroundColor: '#000' },
  590. checkIcon: { color: '#fff', fontSize: 10, fontWeight: 'bold' },
  591. levelTitle: { fontSize: 16, fontWeight: 'bold', textShadowColor: '#000', textShadowOffset: { width: 1, height: 1 }, textShadowRadius: 0 },
  592. lockBox: { flexDirection: 'row', alignItems: 'center' },
  593. lockText: { fontSize: 12, color: '#666', marginRight: 4 },
  594. lockIcon: { width: 16, height: 16 },
  595. cellBody: {
  596. flexDirection: 'row',
  597. alignItems: 'center',
  598. },
  599. goodsImgBg: { width: 65, height: 65, justifyContent: 'center', alignItems: 'center', marginRight: 12, padding: 7 },
  600. goodsImg: { width: '100%', height: '100%' },
  601. goodsInfo: { flex: 1, justifyContent: 'center', paddingRight: 8 },
  602. goodsName: { fontSize: 15, color: '#333', fontWeight: 'bold', marginBottom: 4 },
  603. goodsPrice: { fontSize: 14, color: '#ff6b00', fontWeight: 'bold', marginBottom: 4 },
  604. goodsDesc: { fontSize: 12, color: '#999' },
  605. arrowIcon: { fontSize: 18, color: '#ccc', marginLeft: 8 },
  606. bottomBar: {
  607. position: 'absolute',
  608. bottom: 0,
  609. left: 0,
  610. right: 0,
  611. height: 100, // Taller for Top Button / Bottom Text layout
  612. paddingBottom: 20,
  613. alignItems: 'center',
  614. justifyContent: 'center',
  615. backgroundColor: 'transparent' // Screenshot shows transparent or gradient?
  616. },
  617. bottomBtn: { width: '80%', height: 45, marginBottom: 5 },
  618. buttonRow: { flexDirection: 'row', justifyContent: 'center', width: '100%', paddingHorizontal: 20, marginBottom: 5 },
  619. actionBtn: { height: 45, borderRadius: 22, justifyContent: 'center', alignItems: 'center' },
  620. selectAllBtn: { width: '30%', backgroundColor: '#fff', marginRight: 10, borderWidth: 1, borderColor: '#ccc' },
  621. removeBtn: { width: '65%' },
  622. btnBg: { width: '100%', height: '100%', justifyContent: 'center', alignItems: 'center' },
  623. selectAllText: { fontSize: 16, fontWeight: 'bold', color: '#333' },
  624. removeText: { fontSize: 16, fontWeight: 'bold', color: '#000' },
  625. bottomBtnSecondary: { display: 'none' }, // Removed
  626. bottomBtnSecondaryText: { display: 'none' }, // Removed
  627. bottomBtnBg: { width: '100%', height: '100%', justifyContent: 'center', alignItems: 'center' },
  628. bottomBtnText: { color: '#000', fontSize: 16, fontWeight: 'bold' },
  629. bottomInfoText: { color: '#333', fontSize: 12 }, // Text below button
  630. bottomInfoCount: { fontWeight: 'bold' },
  631. emptyBox: { marginTop: 100, alignItems: 'center' },
  632. emptyText: { color: '#999', fontSize: 14 },
  633. pickupCell: { width: '100%', marginBottom: 10, padding: 12 },
  634. pickupTop: { flexDirection: 'row', justifyContent: 'space-between', paddingBottom: 8, borderBottomWidth: 1, borderBottomColor: '#eee' },
  635. pickupTime: { fontSize: 12, color: '#999' },
  636. pickupStatus: { fontSize: 12, fontWeight: 'bold' },
  637. pickupTimeout: { fontSize: 11, color: '#ff6b00', marginTop: 4 },
  638. pickupAddress: { flexDirection: 'row', paddingVertical: 10, borderBottomWidth: 1, borderBottomColor: '#eee' },
  639. locationIcon: { fontSize: 16, marginRight: 8 },
  640. addressInfo: { flex: 1 },
  641. addressName: { fontSize: 14, fontWeight: 'bold', color: '#333' },
  642. addressDetail: { fontSize: 12, color: '#666', marginTop: 4 },
  643. pickupGoodsBox: { paddingVertical: 10 },
  644. pickupGoodsList: { flexDirection: 'row' },
  645. pickupGoodsItem: { marginRight: 10, alignItems: 'center' },
  646. pickupGoodsImg: { width: 60, height: 60, borderRadius: 4 },
  647. pickupGoodsCount: { position: 'absolute', right: 0, bottom: 0, backgroundColor: 'rgba(0,0,0,0.5)', paddingHorizontal: 4, borderRadius: 4 },
  648. pickupGoodsCountText: { color: '#fff', fontSize: 10 },
  649. pickupOrderRow: { flexDirection: 'row', alignItems: 'center', paddingVertical: 8 },
  650. pickupOrderLabel: { fontSize: 12, color: '#666' },
  651. pickupOrderNo: { flex: 1, fontSize: 12, color: '#333' },
  652. copyBtn: { paddingHorizontal: 8, paddingVertical: 4, backgroundColor: '#f5f5f5', borderRadius: 4 },
  653. copyBtnText: { fontSize: 12, color: '#666' },
  654. pickupInfoRow: { flexDirection: 'row', paddingVertical: 4 },
  655. pickupInfoLabel: { fontSize: 12, color: '#666' },
  656. pickupInfoValue: { fontSize: 12, color: '#333' },
  657. pickupBottom: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', paddingTop: 10 },
  658. pickupExpressAmount: { fontSize: 12, color: '#333' },
  659. priceText: { color: '#ff6b00', fontWeight: 'bold' },
  660. expressBtn: { paddingHorizontal: 12, paddingVertical: 6, backgroundColor: '#fec433', borderRadius: 4 },
  661. expressBtnText: { fontSize: 12, color: '#000', fontWeight: 'bold' },
  662. pickupTip: { flexDirection: 'row', alignItems: 'center', padding: 10, backgroundColor: 'rgba(255,235,200,0.8)', marginHorizontal: 8, borderRadius: 6, marginBottom: 10 },
  663. pickupTipIcon: { fontSize: 14, marginRight: 6 },
  664. pickupTipText: { flex: 1, fontSize: 11, color: '#ff6b00' },
  665. goodsSource: { fontSize: 12, color: '#666', opacity: 0.8 },
  666. arrow: { fontSize: 18, color: '#fec433', marginLeft: 8 },
  667. });