| | |
| | | import Taro, { useRouter, useReachBottom, useDidShow } from '@tarojs/taro'; |
| | | import { useState } from 'react'; |
| | | import { View, Image } from '@tarojs/components'; |
| | | import { View, Image, Text } from '@tarojs/components'; |
| | | import './index.less'; |
| | | import { getOrderHistoryList, OrderHistoryGroup } from '../../../robotaxi/api/order'; |
| | | import { _INVOICE_CHARGE_URL } from '../../../constants/api'; |
| | |
| | | const [activeFilter, setActiveFilter] = useState<OrderFilterKey>(filter || 'all') |
| | | const [pageNum, setPageNum] = useState(1) |
| | | const [hasMore, setHasMore] = useState(true) |
| | | const [loading, setLoading] = useState(false) |
| | | const pageSize = 10 |
| | | |
| | | const formatTime = (t?: string, fallback?: string) => { |
| | |
| | | isRefresh = false, |
| | | filterKey: OrderFilterKey = activeFilter |
| | | ) => { |
| | | if (isRefresh) { |
| | | setLoading(true); |
| | | } |
| | | try { |
| | | const res = await getOrderHistoryList({ |
| | | pageNum: page, |
| | |
| | | setHasMore(count >= pageSize); |
| | | } catch (e) { |
| | | if (isRefresh) setGroups([]); |
| | | } finally { |
| | | if (isRefresh) { |
| | | setLoading(false); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | </View>) |
| | | })} |
| | | { |
| | | !groups.length && <View className='no-data-box'> |
| | | <Image className='no-data-image' src={'https://s.xiaopeng.com/xp-fe/robot-taxi/imgs/no-data-city.png'} /> |
| | | <View>暂无订单</View> |
| | | </View> |
| | | !groups.length && ( |
| | | <View className='no-data-box'> |
| | | {loading ? ( |
| | | <View className='loading-box'> |
| | | <Text>加载中...</Text> |
| | | </View> |
| | | ) : ( |
| | | <> |
| | | <Image className='no-data-image' src={'https://s.xiaopeng.com/xp-fe/robot-taxi/imgs/no-data-city.png'} /> |
| | | <View>暂无订单</View> |
| | | </> |
| | | )} |
| | | </View> |
| | | ) |
| | | } |
| | | </View> |
| | | ) |