|
|
@@ -37,6 +37,7 @@ import {
|
|
|
RiderStatusMap,
|
|
|
payMap,
|
|
|
reasonMap,
|
|
|
+ getStatusInfo,
|
|
|
} from '../../Utils/OrderUtils';
|
|
|
import Time from '../../Utils/TimeUtils';
|
|
|
|
|
|
@@ -65,27 +66,7 @@ export default function OrderScreen({ navigation }) {
|
|
|
const { merchant, orderGoodsSpecs } = orderInfo;
|
|
|
|
|
|
const statusInfo = useCreation(() => {
|
|
|
- const statusList = [];
|
|
|
-
|
|
|
- if (orderInfo.status) {
|
|
|
- statusList.push(orderStatusMap.get(orderInfo.status));
|
|
|
- }
|
|
|
- if (orderInfo.merchantStatus) {
|
|
|
- statusList.push(merchantStatusMap.get(orderInfo.merchantStatus));
|
|
|
- }
|
|
|
- if (orderInfo.riderStatus) {
|
|
|
- statusList.push(RiderStatusMap.get(orderInfo.riderStatus));
|
|
|
- }
|
|
|
-
|
|
|
- if (statusList.length > 0) {
|
|
|
- return statusList.sort((a, b) => {
|
|
|
- return b.sort - a.sort;
|
|
|
- })[0];
|
|
|
- } else {
|
|
|
- return {
|
|
|
- name: t('ding-dan-xiang-qing'),
|
|
|
- };
|
|
|
- }
|
|
|
+ return getStatusInfo(orderInfo);
|
|
|
}, [orderInfo]);
|
|
|
|
|
|
const finish = useCreation(() => {
|
|
|
@@ -105,7 +86,7 @@ export default function OrderScreen({ navigation }) {
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
- }, [orderInfo]);
|
|
|
+ }, [orderInfo, statusInfo]);
|
|
|
|
|
|
const Allfinish = useCreation(() => {
|
|
|
if (orderInfo.status === 'COMPLETED') {
|
|
|
@@ -196,7 +177,7 @@ export default function OrderScreen({ navigation }) {
|
|
|
).current;
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
- if (finish) {
|
|
|
+ if (finish || statusInfo.isRefund) {
|
|
|
maxMove.setValue(0);
|
|
|
pan.setValue({
|
|
|
y: 0,
|
|
|
@@ -210,7 +191,7 @@ export default function OrderScreen({ navigation }) {
|
|
|
});
|
|
|
setshowDetail(false);
|
|
|
}
|
|
|
- }, [finish]);
|
|
|
+ }, [finish, statusInfo]);
|
|
|
|
|
|
const [backgorundColor, setbackgorundColor] = React.useState(
|
|
|
'rgba(255, 194, 28,0)'
|
|
|
@@ -232,14 +213,14 @@ export default function OrderScreen({ navigation }) {
|
|
|
title={showDetail ? statusInfo.name : ' '}
|
|
|
bg={backgorundColor}
|
|
|
orderId={orderId}
|
|
|
- hasRight={!finish && !Allfinish && !cancelOrder}
|
|
|
+ hasRight={!finish && !Allfinish && !cancelOrder && !statusInfo.isRefund}
|
|
|
/>
|
|
|
|
|
|
{/* <RefreshControl
|
|
|
refreshing={orderRequest.loading}
|
|
|
onRefresh={orderRequest.run}
|
|
|
> */}
|
|
|
- {!finish && (
|
|
|
+ {!finish && !statusInfo.isRefund && (
|
|
|
<Div
|
|
|
w={Dimensions.get('window').width}
|
|
|
h={Dimensions.get('window').height + Constants.statusBarHeight}
|
|
|
@@ -270,6 +251,7 @@ export default function OrderScreen({ navigation }) {
|
|
|
>
|
|
|
<View {...panResponder.panHandlers}>
|
|
|
<Div pt={10} pb={10} px={15}>
|
|
|
+ {/* <Text>{statusInfo.name}</Text> */}
|
|
|
<Button
|
|
|
block
|
|
|
bg="hide"
|
|
|
@@ -281,111 +263,284 @@ export default function OrderScreen({ navigation }) {
|
|
|
}
|
|
|
>
|
|
|
<Div flex={1}>
|
|
|
- <View style={styles.card}>
|
|
|
- <Div row pb={10}>
|
|
|
- <Text fontSize="xl" fontWeight="bold">
|
|
|
- {orderInfo.merShowName}
|
|
|
- </Text>
|
|
|
+ <View style={[styles.card]}>
|
|
|
+ {!cancelOrder &&
|
|
|
+ !statusInfo.isRefund &&
|
|
|
+ (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')}
|
|
|
+ {t('song-da')}
|
|
|
+ </Text>
|
|
|
+ ) : (
|
|
|
+ <Text fontSize="xl">
|
|
|
+ <Text
|
|
|
+ fontSize="xl"
|
|
|
+ color="brand500"
|
|
|
+ mr={10}
|
|
|
+ fontWeight="bold"
|
|
|
+ >
|
|
|
+ {statusInfo.name}
|
|
|
+ </Text>
|
|
|
+ {t('yu-ji')}
|
|
|
+ {new Time(
|
|
|
+ orderInfo.timeOfArrival,
|
|
|
+ 'yyyy-MM-DD HH:mm:ss'
|
|
|
+ ).getFormat('HH:mm')}
|
|
|
+ {t('song-da')}
|
|
|
+ </Text>
|
|
|
+ ))}
|
|
|
+ {cancelOrder && (
|
|
|
+ <Div row>
|
|
|
+ <Text
|
|
|
+ fontSize="xl"
|
|
|
+ color="brand500"
|
|
|
+ mr={10}
|
|
|
+ fontWeight="bold"
|
|
|
+ >
|
|
|
+ {statusInfo.name}
|
|
|
+ </Text>
|
|
|
+ {!!orderInfo.reason && (
|
|
|
+ <Text fontSize="xl" color="red500">
|
|
|
+ ({reasonMap.get(orderInfo.reason).name})
|
|
|
+ </Text>
|
|
|
+ )}
|
|
|
+ </Div>
|
|
|
+ )}
|
|
|
+ <Div row mt={10}>
|
|
|
<Button
|
|
|
fontSize="xs"
|
|
|
- w={100}
|
|
|
+ flex={1}
|
|
|
+ mx={5}
|
|
|
bg="white"
|
|
|
color="gray600"
|
|
|
borderColor="brand500"
|
|
|
borderWidth={1}
|
|
|
rounded={3}
|
|
|
- ml={14}
|
|
|
- onPress={() => {
|
|
|
- if (!orderInfo.muserId) {
|
|
|
- warnning('商家信息有误请联系客服帮你催单');
|
|
|
- } else {
|
|
|
- navigation.navigate('Chat', {
|
|
|
- toUserId: orderInfo.muserId,
|
|
|
- toUserName: orderInfo.merShowName,
|
|
|
- });
|
|
|
- }
|
|
|
- }}
|
|
|
+ onPress={() => connectKefu(orderId)}
|
|
|
>
|
|
|
- {t('lian-xi-shang-jia')}
|
|
|
+ {t('lian-xi-ke-fu')}
|
|
|
</Button>
|
|
|
+
|
|
|
+ {/* <Button
|
|
|
+ fontSize="xs"
|
|
|
+ flex={1}
|
|
|
+ mx={5}
|
|
|
+ bg="white"
|
|
|
+ color="gray600"
|
|
|
+ borderColor="brand500"
|
|
|
+ borderWidth={1}
|
|
|
+ rounded={3}
|
|
|
+ onPress={() => connectKefu(orderId)}
|
|
|
+ >
|
|
|
+ 立即支付
|
|
|
+ </Button> */}
|
|
|
+
|
|
|
+ {!finish && hasRider && (
|
|
|
+ <Button
|
|
|
+ fontSize="xs"
|
|
|
+ flex={1}
|
|
|
+ mx={5}
|
|
|
+ bg="white"
|
|
|
+ color="gray600"
|
|
|
+ borderColor="brand500"
|
|
|
+ borderWidth={1}
|
|
|
+ rounded={3}
|
|
|
+ onPress={(e) => {
|
|
|
+ if (!orderInfo.ruserId) {
|
|
|
+ warnning('骑手信息有误请联系客服');
|
|
|
+ } else {
|
|
|
+ navigation.navigate('Chat', {
|
|
|
+ toUserId: orderInfo.ruserId,
|
|
|
+ toUserName: orderInfo.riderName,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ console.log(e);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {t('lian-xi-qi-shou')}
|
|
|
+ </Button>
|
|
|
+ )}
|
|
|
+ {!finish && isPay && !statusInfo.isRefund && !cancelOrder && (
|
|
|
+ <Button
|
|
|
+ fontSize="xs"
|
|
|
+ flex={1}
|
|
|
+ mx={5}
|
|
|
+ bg="white"
|
|
|
+ color="gray600"
|
|
|
+ borderColor="brand500"
|
|
|
+ borderWidth={1}
|
|
|
+ rounded={3}
|
|
|
+ onPress={() => {
|
|
|
+ if (!orderInfo.muserId) {
|
|
|
+ warnning('商家信息有误请联系客服帮你催单');
|
|
|
+ } else {
|
|
|
+ navigation.navigate('Chat', {
|
|
|
+ toUserId: orderInfo.muserId,
|
|
|
+ toUserName: orderInfo.merShowName,
|
|
|
+ type: 'Reminder',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {t('cui-dan')}
|
|
|
+ </Button>
|
|
|
+ )}
|
|
|
+ {finish && !cancelOrder && !statusInfo.isRefund && (
|
|
|
+ <Button
|
|
|
+ fontSize="xs"
|
|
|
+ flex={1}
|
|
|
+ mx={5}
|
|
|
+ bg="white"
|
|
|
+ color="gray600"
|
|
|
+ borderColor="brand500"
|
|
|
+ borderWidth={1}
|
|
|
+ rounded={3}
|
|
|
+ onPress={() => {
|
|
|
+ navigation.navigate('RewardRider', {
|
|
|
+ orderId,
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {t('da-shang-qi-shou')}
|
|
|
+ </Button>
|
|
|
+ )}
|
|
|
+ {finish &&
|
|
|
+ !Allfinish &&
|
|
|
+ !cancelOrder &&
|
|
|
+ !statusInfo.isRefund && (
|
|
|
+ <Button
|
|
|
+ fontSize="xs"
|
|
|
+ flex={1}
|
|
|
+ mx={5}
|
|
|
+ bg="white"
|
|
|
+ color="gray600"
|
|
|
+ borderColor="brand500"
|
|
|
+ borderWidth={1}
|
|
|
+ rounded={3}
|
|
|
+ onPress={() => {
|
|
|
+ navigation.navigate('Evaluate', {
|
|
|
+ orderId,
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {t('li-ji-ping-jia')}
|
|
|
+ </Button>
|
|
|
+ )}
|
|
|
</Div>
|
|
|
- <Div>
|
|
|
- {orderGoodsSpecs.map((item) => {
|
|
|
- return (
|
|
|
- <GoodsItem
|
|
|
- info={item}
|
|
|
- goods={item.goods}
|
|
|
- key={item.id}
|
|
|
- />
|
|
|
- );
|
|
|
- })}
|
|
|
- </Div>
|
|
|
- <Flex style={styles.info}>
|
|
|
- <Flex.Item>
|
|
|
- <Flex>
|
|
|
- <Text fontSize="xs" color="gray300" textAlign="left">
|
|
|
- {t('bao-zhuang-fei')}
|
|
|
- </Text>
|
|
|
- <Text fontSize="xs" color="gray300" textAlign="left">
|
|
|
- {t('can-he')}
|
|
|
- </Text>
|
|
|
- </Flex>
|
|
|
- </Flex.Item>
|
|
|
+ </View>
|
|
|
+ </Div>
|
|
|
+ </Button>
|
|
|
+
|
|
|
+ <View style={styles.card}>
|
|
|
+ <Div row pb={10}>
|
|
|
+ <Text fontSize="xl" fontWeight="bold">
|
|
|
+ {orderInfo.merShowName}
|
|
|
+ </Text>
|
|
|
+ <Button
|
|
|
+ fontSize="xs"
|
|
|
+ w={100}
|
|
|
+ bg="white"
|
|
|
+ color="gray600"
|
|
|
+ borderColor="brand500"
|
|
|
+ borderWidth={1}
|
|
|
+ rounded={3}
|
|
|
+ ml={14}
|
|
|
+ onPress={() => {
|
|
|
+ if (!orderInfo.muserId) {
|
|
|
+ warnning('商家信息有误请联系客服帮你催单');
|
|
|
+ } else {
|
|
|
+ navigation.navigate('Chat', {
|
|
|
+ toUserId: orderInfo.muserId,
|
|
|
+ toUserName: orderInfo.merShowName,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {t('lian-xi-shang-jia')}
|
|
|
+ </Button>
|
|
|
+ </Div>
|
|
|
+ <Div>
|
|
|
+ {orderGoodsSpecs.map((item) => {
|
|
|
+ return (
|
|
|
+ <GoodsItem info={item} goods={item.goods} key={item.id} />
|
|
|
+ );
|
|
|
+ })}
|
|
|
+ </Div>
|
|
|
+ <Flex style={styles.info}>
|
|
|
+ <Flex.Item>
|
|
|
+ <Flex>
|
|
|
<Text fontSize="xs" color="gray300" textAlign="left">
|
|
|
- ¥{orderInfo.packingPrice}
|
|
|
+ {t('bao-zhuang-fei')}
|
|
|
</Text>
|
|
|
- </Flex>
|
|
|
- <Flex style={styles.info}>
|
|
|
- <Flex.Item>
|
|
|
- <Text fontSize="xs" color="gray300" textAlign="left">
|
|
|
- {t('pei-song-fei-ding-dong-zhuan-song')}
|
|
|
- </Text>
|
|
|
- </Flex.Item>
|
|
|
<Text fontSize="xs" color="gray300" textAlign="left">
|
|
|
- ¥{orderInfo.deliveryAmount}
|
|
|
+ {t('can-he')}
|
|
|
</Text>
|
|
|
</Flex>
|
|
|
- <Flex style={styles.info}>
|
|
|
- <Flex.Item>
|
|
|
- <Text fontSize="xs" color="gray300" textAlign="left">
|
|
|
- {t('man-jian')}
|
|
|
- </Text>
|
|
|
- </Flex.Item>
|
|
|
- <Text fontSize="xs" color="red500" textAlign="left">
|
|
|
- -¥{orderInfo.fullReduction}
|
|
|
+ </Flex.Item>
|
|
|
+ <Text fontSize="xs" color="gray300" textAlign="left">
|
|
|
+ ¥{orderInfo.packingPrice}
|
|
|
+ </Text>
|
|
|
+ </Flex>
|
|
|
+ <Flex style={styles.info}>
|
|
|
+ <Flex.Item>
|
|
|
+ <Text fontSize="xs" color="gray300" textAlign="left">
|
|
|
+ {t('pei-song-fei-ding-dong-zhuan-song')}
|
|
|
+ </Text>
|
|
|
+ </Flex.Item>
|
|
|
+ <Text fontSize="xs" color="gray300" textAlign="left">
|
|
|
+ ¥{orderInfo.deliveryAmount}
|
|
|
+ </Text>
|
|
|
+ </Flex>
|
|
|
+ <Flex style={styles.info}>
|
|
|
+ <Flex.Item>
|
|
|
+ <Text fontSize="xs" color="gray300" textAlign="left">
|
|
|
+ {t('man-jian')}
|
|
|
+ </Text>
|
|
|
+ </Flex.Item>
|
|
|
+ <Text fontSize="xs" color="red500" textAlign="left">
|
|
|
+ -¥{orderInfo.fullReduction}
|
|
|
+ </Text>
|
|
|
+ </Flex>
|
|
|
+ {!!orderInfo.firstBuy && (
|
|
|
+ <Flex style={styles.info}>
|
|
|
+ <Flex.Item>
|
|
|
+ <Text fontSize="xs" color="gray300" textAlign="left">
|
|
|
+ {t('shou-dan')}
|
|
|
</Text>
|
|
|
- </Flex>
|
|
|
- {!!orderInfo.firstBuy && (
|
|
|
- <Flex style={styles.info}>
|
|
|
- <Flex.Item>
|
|
|
- <Text fontSize="xs" color="gray300" textAlign="left">
|
|
|
- {t('shou-dan')}
|
|
|
- </Text>
|
|
|
- </Flex.Item>
|
|
|
- <Text fontSize="xs" color="red500" textAlign="left">
|
|
|
- ¥{orderInfo.firstBuy}
|
|
|
- </Text>
|
|
|
- </Flex>
|
|
|
- )}
|
|
|
+ </Flex.Item>
|
|
|
+ <Text fontSize="xs" color="red500" textAlign="left">
|
|
|
+ ¥{orderInfo.firstBuy}
|
|
|
+ </Text>
|
|
|
+ </Flex>
|
|
|
+ )}
|
|
|
|
|
|
- <Flex style={styles.info}>
|
|
|
- <Flex.Item>
|
|
|
- <Text fontSize="xs" color="gray300" textAlign="left">
|
|
|
- {t('hong-bao')}
|
|
|
- </Text>
|
|
|
- </Flex.Item>
|
|
|
- <Text fontSize="xs" color="red500" textAlign="left">
|
|
|
- -¥{orderInfo.redBag || 0}
|
|
|
- </Text>
|
|
|
- </Flex>
|
|
|
- <Flex style={styles.total} justify="end">
|
|
|
- <Text size="s1">
|
|
|
- {t('xiao-ji')} ¥{orderInfo.realAmount}
|
|
|
- </Text>
|
|
|
- </Flex>
|
|
|
- </View>
|
|
|
- </Div>
|
|
|
- </Button>
|
|
|
+ <Flex style={styles.info}>
|
|
|
+ <Flex.Item>
|
|
|
+ <Text fontSize="xs" color="gray300" textAlign="left">
|
|
|
+ {t('hong-bao')}
|
|
|
+ </Text>
|
|
|
+ </Flex.Item>
|
|
|
+ <Text fontSize="xs" color="red500" textAlign="left">
|
|
|
+ -¥{orderInfo.redBag || 0}
|
|
|
+ </Text>
|
|
|
+ </Flex>
|
|
|
+ <Flex style={styles.total} justify="end">
|
|
|
+ <Text size="s1">
|
|
|
+ {t('xiao-ji')} ¥{orderInfo.realAmount}
|
|
|
+ </Text>
|
|
|
+ </Flex>
|
|
|
+ </View>
|
|
|
|
|
|
<View style={[styles.card]}>
|
|
|
<Text size="c1">{t('ding-dan-xin-xi')}</Text>
|