|
|
@@ -1,89 +1,53 @@
|
|
|
-import {TextGroup} from '@components';
|
|
|
-import {Image, Text, View} from '@tarojs/components';
|
|
|
+import {Image, View} from '@tarojs/components';
|
|
|
import classNames from 'classnames';
|
|
|
-import {Button} from '@antmjs/vantui';
|
|
|
-import {usePreview} from './hooks';
|
|
|
import filterIcon from '@assets/filter.svg';
|
|
|
import Filter from './filter';
|
|
|
import {useBoolean} from 'ahooks';
|
|
|
+import Item from './item';
|
|
|
+import {Refresh} from '@components';
|
|
|
+import {useField} from './hooks';
|
|
|
+import {useInfiniteFetch} from '@hooks';
|
|
|
+import {getList} from '@apis';
|
|
|
|
|
|
export default function List() {
|
|
|
- const onClick = usePreview();
|
|
|
const [visible, {setFalse: onClose, setTrue: onShow}] = useBoolean();
|
|
|
+ const [fields, {onChange, reset}] = useField();
|
|
|
+ const [
|
|
|
+ {data, isFetching, isFetchingNextPage, hasNextPage, isEmpty},
|
|
|
+ {fetchNextPage, refresh},
|
|
|
+ ] = useInfiniteFetch({
|
|
|
+ key: [getList.name],
|
|
|
+ fn: getList,
|
|
|
+ limit: 5,
|
|
|
+ params: {
|
|
|
+ arrivalTime: fields.startTime,
|
|
|
+ arrivalTimes: fields.endTime,
|
|
|
+ finalTime: fields.startTime2,
|
|
|
+ finalTimes: fields.endTime2,
|
|
|
+ customer: fields.custom,
|
|
|
+ truckNo: fields.track,
|
|
|
+ anomaly: fields.anomaly ? '1' : '',
|
|
|
+ },
|
|
|
+ });
|
|
|
|
|
|
return (
|
|
|
<>
|
|
|
- <View className='h-screen overflow-auto bg-gray-200 py-4'>
|
|
|
- <View className='bg-white mx-4 rounded-lg px-3 py-4'>
|
|
|
- <View
|
|
|
- className={classNames(
|
|
|
- 'flex items-center overflow-hidden border-0 border-b border-gray-200 border-solid',
|
|
|
- 'pb-3',
|
|
|
- )}
|
|
|
- >
|
|
|
- <Text className='flex-1 text-over text-[#333] mr-2 text-sm'>
|
|
|
- TSDFSDFTSDF
|
|
|
- </Text>
|
|
|
- <View className='text-center w-16 h-7 leading-7 text-sm text-white bg-primary rounded-md'>
|
|
|
- 已送达
|
|
|
- </View>
|
|
|
- </View>
|
|
|
-
|
|
|
- <View className='mt-4 overflow-hidden border-0 border-b border-dashed border-gray-200 pb-4'>
|
|
|
- <View className='flex overflow-hidden text-sm text-gray-500'>
|
|
|
- <Text className='flex-1 block text-over mr-2'>品号</Text>
|
|
|
- <Text className='w-[7em]'>数量</Text>
|
|
|
- </View>
|
|
|
- <View className='flex overflow-hidden text-sm mt-2'>
|
|
|
- <Text className='flex-1 block text-over mr-2'>12312</Text>
|
|
|
- <Text className='w-[7em]'>9871876</Text>
|
|
|
- </View>
|
|
|
- <View className='flex overflow-hidden text-sm mt-2'>
|
|
|
- <Text className='flex-1 block text-over mr-2'>12312</Text>
|
|
|
- <Text className='w-[7em]'>9871876</Text>
|
|
|
- </View>
|
|
|
- <View className='flex overflow-hidden text-sm mt-2'>
|
|
|
- <Text className='flex-1 block text-over mr-2'>12312</Text>
|
|
|
- <Text className='w-[7em]'>9871876</Text>
|
|
|
- </View>
|
|
|
- </View>
|
|
|
-
|
|
|
- <View className='mt-4'>
|
|
|
- <TextGroup title='卡车号' content='123' className='!py-0' />
|
|
|
- <TextGroup
|
|
|
- title='客户编号'
|
|
|
- content='123555'
|
|
|
- className='!py-0 mt-2'
|
|
|
- />
|
|
|
- <TextGroup
|
|
|
- title='发货时间'
|
|
|
- content='2020-12-22'
|
|
|
- className='!py-0 mt-2'
|
|
|
- />
|
|
|
- <TextGroup
|
|
|
- title='送达时间'
|
|
|
- content='2020-12-23'
|
|
|
- className='!py-0 mt-2'
|
|
|
- />
|
|
|
- </View>
|
|
|
-
|
|
|
- <View className='flex justify-end mt-2'>
|
|
|
- <Button
|
|
|
- round
|
|
|
- className='!m-0 border border-solid border-gray-200'
|
|
|
- onClick={onClick([
|
|
|
- 'https://picsum.photos/id/1/800/600',
|
|
|
- 'https://picsum.photos/id/2/800/600',
|
|
|
- 'https://picsum.photos/id/3/800/600',
|
|
|
- 'https://picsum.photos/id/4/800/600',
|
|
|
- 'https://picsum.photos/id/5/800/600',
|
|
|
- ])}
|
|
|
- >
|
|
|
- 查看图片
|
|
|
- </Button>
|
|
|
- </View>
|
|
|
- </View>
|
|
|
- </View>
|
|
|
+ <Refresh
|
|
|
+ className='h-screen bg-[#eee]'
|
|
|
+ background='#eee'
|
|
|
+ isRefreshing={isFetching && !isFetchingNextPage}
|
|
|
+ onRefresh={refresh}
|
|
|
+ isLoading={isFetchingNextPage}
|
|
|
+ onLoading={fetchNextPage}
|
|
|
+ noMore={!hasNextPage}
|
|
|
+ empty={isEmpty}
|
|
|
+ >
|
|
|
+ <View className='h-3' />
|
|
|
+ {(data?.pages ?? []).map(function (val) {
|
|
|
+ return <Item key={val.id} {...val} />;
|
|
|
+ })}
|
|
|
+ <View className='h-3' />
|
|
|
+ </Refresh>
|
|
|
|
|
|
<View
|
|
|
onClick={onShow}
|
|
|
@@ -95,7 +59,14 @@ export default function List() {
|
|
|
<Image src={filterIcon} mode='widthFix' className='w-5' />
|
|
|
</View>
|
|
|
|
|
|
- <Filter visible={visible} onClose={onClose} />
|
|
|
+ <Filter
|
|
|
+ visible={visible}
|
|
|
+ onClose={onClose}
|
|
|
+ {...fields}
|
|
|
+ onChange={onChange}
|
|
|
+ onReset={reset}
|
|
|
+ onConfirm={refresh}
|
|
|
+ />
|
|
|
</>
|
|
|
);
|
|
|
}
|