|
|
@@ -1,3 +1,4 @@
|
|
|
+/* eslint-disable no-underscore-dangle */
|
|
|
import * as WebBrowser from 'expo-web-browser';
|
|
|
import * as React from 'react';
|
|
|
import {
|
|
|
@@ -11,6 +12,7 @@ import {
|
|
|
UIManager,
|
|
|
} from 'react-native';
|
|
|
import { Div, Button, Image, Text } from 'react-native-magnus';
|
|
|
+import { Appbar, Menu } from 'react-native-paper';
|
|
|
import Constants from 'expo-constants';
|
|
|
|
|
|
import { Flex } from '@ant-design/react-native';
|
|
|
@@ -31,6 +33,7 @@ import {
|
|
|
orderStatusMap,
|
|
|
RiderStatusMap,
|
|
|
payMap,
|
|
|
+ reasonMap,
|
|
|
} from '../../Utils/OrderUtils';
|
|
|
import Time from '../../Utils/TimeUtils';
|
|
|
|
|
|
@@ -82,7 +85,18 @@ export default function OrderScreen({ navigation }) {
|
|
|
}, [orderInfo]);
|
|
|
|
|
|
const finish = useCreation(() => {
|
|
|
- if (orderInfo.riderStatus === 'CARRY_OUT') {
|
|
|
+ if (
|
|
|
+ orderInfo.riderStatus === 'CARRY_OUT' ||
|
|
|
+ orderInfo.status === 'CANCELLED'
|
|
|
+ ) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }, [orderInfo]);
|
|
|
+
|
|
|
+ const cancelOrder = useCreation(() => {
|
|
|
+ if (orderInfo.status === 'CANCELLED') {
|
|
|
return true;
|
|
|
} else {
|
|
|
return false;
|
|
|
@@ -132,7 +146,7 @@ export default function OrderScreen({ navigation }) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (maxMove._value != 0) {
|
|
|
+ if (maxMove._value !== 0) {
|
|
|
if (maxMove._value - y < 200) {
|
|
|
setbackgorundColor(
|
|
|
`rgba(255, 194, 28,${Math.ceil(
|
|
|
@@ -141,7 +155,7 @@ export default function OrderScreen({ navigation }) {
|
|
|
);
|
|
|
setshowDetail(false);
|
|
|
} else {
|
|
|
- setbackgorundColor('rgba(255, 194, 28,1)');
|
|
|
+ setbackgorundColor('#FFC21C');
|
|
|
setshowDetail(true);
|
|
|
}
|
|
|
}
|
|
|
@@ -159,7 +173,7 @@ export default function OrderScreen({ navigation }) {
|
|
|
y: 0,
|
|
|
});
|
|
|
setshowDetail(true);
|
|
|
- setbackgorundColor('rgba(255, 194, 28,1)');
|
|
|
+ setbackgorundColor('#FFC21C');
|
|
|
} else {
|
|
|
maxMove.setValue(Dimensions.get('window').height * 0.6);
|
|
|
pan.setValue({
|
|
|
@@ -185,7 +199,12 @@ export default function OrderScreen({ navigation }) {
|
|
|
|
|
|
return (
|
|
|
<Div bg="gray200" w="100%" flex={1}>
|
|
|
- <Header title={showDetail ? statusInfo.name : ' '} bg={backgorundColor} />
|
|
|
+ <Header
|
|
|
+ title={showDetail ? statusInfo.name : ' '}
|
|
|
+ bg={backgorundColor}
|
|
|
+ orderId={orderId}
|
|
|
+ hasRight={!finish && !Allfinish && !cancelOrder}
|
|
|
+ />
|
|
|
|
|
|
{/* <RefreshControl
|
|
|
refreshing={orderRequest.loading}
|
|
|
@@ -223,29 +242,52 @@ export default function OrderScreen({ navigation }) {
|
|
|
>
|
|
|
<Div pt={10} pb={10} px={15}>
|
|
|
<View style={[styles.card]}>
|
|
|
- {finish ? (
|
|
|
- <Text fontSize="xl">
|
|
|
- <Text fontSize="xl" color="brand500" mr={10} fontWeight="bold">
|
|
|
- {statusInfo.name}
|
|
|
+ {!cancelOrder &&
|
|
|
+ (finish ? (
|
|
|
+ <Text fontSize="xl">
|
|
|
+ <Text
|
|
|
+ fontSize="xl"
|
|
|
+ color="brand500"
|
|
|
+ mr={10}
|
|
|
+ fontWeight="bold"
|
|
|
+ >
|
|
|
+ {statusInfo.name}
|
|
|
+ </Text>
|
|
|
+ {new Time(
|
|
|
+ orderInfo.userReceivedTime,
|
|
|
+ 'yyyy-MM-DD HH:mm:ss'
|
|
|
+ ).getFormat('HH:mm')}
|
|
|
+ 送达
|
|
|
</Text>
|
|
|
- {new Time(
|
|
|
- orderInfo.userReceivedTime,
|
|
|
- 'yyyy-MM-DD HH:mm:ss'
|
|
|
- ).getFormat('HH:mm')}
|
|
|
- 送达
|
|
|
- </Text>
|
|
|
- ) : (
|
|
|
- <Text fontSize="xl">
|
|
|
+ ) : (
|
|
|
+ <Text fontSize="xl">
|
|
|
+ <Text
|
|
|
+ fontSize="xl"
|
|
|
+ color="brand500"
|
|
|
+ mr={10}
|
|
|
+ fontWeight="bold"
|
|
|
+ >
|
|
|
+ {statusInfo.name}
|
|
|
+ </Text>
|
|
|
+ 预计
|
|
|
+ {new Time(
|
|
|
+ orderInfo.timeOfArrival,
|
|
|
+ 'yyyy-MM-DD HH:mm:ss'
|
|
|
+ ).getFormat('HH:mm')}
|
|
|
+ 送达
|
|
|
+ </Text>
|
|
|
+ ))}
|
|
|
+ {cancelOrder && (
|
|
|
+ <Div row>
|
|
|
<Text fontSize="xl" color="brand500" mr={10} fontWeight="bold">
|
|
|
{statusInfo.name}
|
|
|
</Text>
|
|
|
- 预计
|
|
|
- {new Time(
|
|
|
- orderInfo.timeOfArrival,
|
|
|
- 'yyyy-MM-DD HH:mm:ss'
|
|
|
- ).getFormat('HH:mm')}
|
|
|
- 送达
|
|
|
- </Text>
|
|
|
+ {!!orderInfo.reason && (
|
|
|
+ <Text fontSize="xl" color="red500">
|
|
|
+ ({reasonMap.get(orderInfo.reason).name})
|
|
|
+ </Text>
|
|
|
+ )}
|
|
|
+ </Div>
|
|
|
)}
|
|
|
<Div row mt={10}>
|
|
|
<Button
|
|
|
@@ -295,7 +337,7 @@ export default function OrderScreen({ navigation }) {
|
|
|
催单
|
|
|
</Button>
|
|
|
)}
|
|
|
- {finish && !Allfinish && (
|
|
|
+ {finish && !cancelOrder && (
|
|
|
<Button
|
|
|
fontSize="xs"
|
|
|
flex={1}
|
|
|
@@ -306,15 +348,15 @@ export default function OrderScreen({ navigation }) {
|
|
|
borderWidth={1}
|
|
|
rounded={3}
|
|
|
onPress={() => {
|
|
|
- navigation.navigate('Evaluate', {
|
|
|
+ navigation.navigate('RewardRider', {
|
|
|
orderId,
|
|
|
});
|
|
|
}}
|
|
|
>
|
|
|
- 立即评价
|
|
|
+ 打赏骑手
|
|
|
</Button>
|
|
|
)}
|
|
|
- {finish && (
|
|
|
+ {finish && !Allfinish && !cancelOrder && (
|
|
|
<Button
|
|
|
fontSize="xs"
|
|
|
flex={1}
|
|
|
@@ -325,12 +367,12 @@ export default function OrderScreen({ navigation }) {
|
|
|
borderWidth={1}
|
|
|
rounded={3}
|
|
|
onPress={() => {
|
|
|
- navigation.navigate('MerchantDetail', {
|
|
|
- merchantId: orderInfo.merchantId,
|
|
|
+ navigation.navigate('Evaluate', {
|
|
|
+ orderId,
|
|
|
});
|
|
|
}}
|
|
|
>
|
|
|
- 再来一单
|
|
|
+ 立即评价
|
|
|
</Button>
|
|
|
)}
|
|
|
</Div>
|