|
@@ -1,4 +1,4 @@
|
|
|
-import {usePreview} from './hooks';
|
|
|
|
|
|
|
+import {usePreview, useOrderState} from './hooks';
|
|
|
import {View, Text, Button, Picker} from '@tarojs/components';
|
|
import {View, Text, Button, Picker} from '@tarojs/components';
|
|
|
import classNames from 'classnames';
|
|
import classNames from 'classnames';
|
|
|
import {TextGroup} from '@components';
|
|
import {TextGroup} from '@components';
|
|
@@ -20,6 +20,7 @@ export default function Item({
|
|
|
onEdit,
|
|
onEdit,
|
|
|
}) {
|
|
}) {
|
|
|
const onClick = usePreview();
|
|
const onClick = usePreview();
|
|
|
|
|
+ const {className, msg} = useOrderState(states, anomaly, {time: arrivalTime});
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<View className='bg-white mx-4 rounded-lg px-3 py-4 mt-3 first:mt-0'>
|
|
<View className='bg-white mx-4 rounded-lg px-3 py-4 mt-3 first:mt-0'>
|
|
@@ -35,18 +36,10 @@ export default function Item({
|
|
|
<View
|
|
<View
|
|
|
className={classNames(
|
|
className={classNames(
|
|
|
'text-center w-20 h-7 leading-7 text-sm text-white rounded-md',
|
|
'text-center w-20 h-7 leading-7 text-sm text-white rounded-md',
|
|
|
- {
|
|
|
|
|
- 'bg-primary': states === '1' && anomaly === '0',
|
|
|
|
|
- 'bg-red-500': states === '1' && anomaly === '1',
|
|
|
|
|
- 'bg-gray-400': states === '0',
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ className,
|
|
|
)}
|
|
)}
|
|
|
>
|
|
>
|
|
|
- {states === '0'
|
|
|
|
|
- ? '正在送货'
|
|
|
|
|
- : anomaly === '1'
|
|
|
|
|
- ? '订单异常'
|
|
|
|
|
- : '已送达'}
|
|
|
|
|
|
|
+ {msg}
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
|
|
|