panhui 5 лет назад
Родитель
Сommit
c8d868d0dc

+ 1 - 1
App.js

@@ -39,7 +39,7 @@ export default function App() {
       initName = 'Login';
 		} 
 		// else if (__DEV__) {
-    //   initName = 'HomeCategory';
+    //   initName = 'OrderDetail';
 		// } 
 		else if (id !== null) {
       // 已登录

+ 8 - 3
Utils/OrderUtils.js

@@ -75,24 +75,27 @@ const orderStatusMap = new Map([
     'REFUNDED_PENDING',
     {
       name: i18n.t('shen-qing-tui-kuan-zhong'),
-      sort: -1,
+      sort: 2,
       type: 'order',
+      isRefund: true,
     },
   ],
   [
     'REFUNDING',
     {
       name: i18n.t('tui-kuan-zhong'),
-      sort: -1,
+      sort: 2,
       type: 'order',
+      isRefund: true,
     },
   ],
   [
     'REFUNDED',
     {
       name: i18n.t('yi-tui-kuan'),
-      sort: -1,
+      sort: 2,
       type: 'order',
+      isRefund: true,
     },
   ],
   [
@@ -191,6 +194,8 @@ function getStatusInfo(orderInfo) {
     statusList.push(RiderStatusMap.get(orderInfo.riderStatus));
   }
 
+  console.log(statusList);
+
   if (statusList.length > 0) {
     return statusList.sort((a, b) => {
       return b.sort - a.sort;

+ 2 - 6
navigation/BaseNavigator.jsx

@@ -98,7 +98,7 @@ export default function BasicScreens(Screen) {
       {/* 订单详情 */}
       <Screen
         name="OrderDetail"
-        initialParams={{ orderId: 2307 }}
+        initialParams={{ orderId: 1359 }}
         component={OrderDetail}
       />
       {/* 订单详情 */}
@@ -107,11 +107,7 @@ export default function BasicScreens(Screen) {
         initialParams={{ orderId: 2307 }}
         component={PayOrderScreen}
       />
-      <Screen
-        name="OrderDetailList"
-        initialParams={{ orderId: 2307 }}
-        component={OrderDetailListScreen}
-      />
+      <Screen name="OrderDetailList" component={OrderDetailListScreen} />
       {/* 投诉 */}
       <Screen name="Complaint" component={Complaint} />
       {/* 投诉 2 */}

+ 1 - 1
screens/Main/Home/HomeHeader.jsx

@@ -99,7 +99,7 @@ export default function Header() {
             }}
             title={t('qie-huan-yu-yan')}
           />
-          <Menu.Item onPress={() => {}} title="版本0817 聊天订单" />
+          <Menu.Item onPress={() => {}} title="版本0914 已取消订单" />
         </Menu>
       </Appbar.Header>
     </>

+ 269 - 114
screens/Order/OrderDetailScreen.jsx

@@ -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>

+ 38 - 34
screens/Order/OrderScreen.jsx

@@ -111,7 +111,7 @@ function Item({
               <Text fontSize="xl" flex={1} fontWeight="bold">
                 {info.merShowName}
               </Text>
-              {finish || Allfinish ? (
+              {finish || Allfinish || statusInfo.isRefund ? (
                 <Text fontSize="xs">{t('yi-song-da')}</Text>
               ) : (
                 <Text fontSize="xs">
@@ -142,11 +142,14 @@ function Item({
             </Div>
           </Div>
         </Div>
-        <MapMarkImg
-          imgType={statusInfo.nowImgType}
-          label={statusInfo.name}
-          info={info}
-        />
+        {!statusInfo.isRefund && (
+          <MapMarkImg
+            imgType={statusInfo.nowImgType}
+            label={statusInfo.name}
+            info={info}
+          />
+        )}
+
         <Flex justify="end" style={styles.btns}>
           {info.status === 'UNPAID' && (
             <Button
@@ -162,35 +165,36 @@ function Item({
               去支付
             </Button>
           )}
-          {finish && !Allfinish ? (
-            <Button
-              w={100}
-              fontSize="xs"
-              bg="white"
-              color="gray600"
-              borderColor="brand500"
-              borderWidth={1}
-              rounded={3}
-              onPress={() => goNext('Evaluate')}
-            >
-              {t('li-ji-ping-jia')}
-            </Button>
-          ) : (
-            <Button
-              w={100}
-              fontSize="xs"
-              bg="white"
-              color="gray600"
-              borderColor="brand500"
-              borderWidth={1}
-              rounded={3}
-              onPress={() => connect('merchant')}
-            >
-              {t('lian-xi-shang-jia')}
-            </Button>
-          )}
+          {!statusInfo.isRefund &&
+            (finish && !Allfinish ? (
+              <Button
+                w={100}
+                fontSize="xs"
+                bg="white"
+                color="gray600"
+                borderColor="brand500"
+                borderWidth={1}
+                rounded={3}
+                onPress={() => goNext('Evaluate')}
+              >
+                {t('li-ji-ping-jia')}
+              </Button>
+            ) : (
+              <Button
+                w={100}
+                fontSize="xs"
+                bg="white"
+                color="gray600"
+                borderColor="brand500"
+                borderWidth={1}
+                rounded={3}
+                onPress={() => connect('merchant')}
+              >
+                {t('lian-xi-shang-jia')}
+              </Button>
+            ))}
 
-          {finish && (
+          {finish && !statusInfo.isRefund && (
             <Button
               w={100}
               fontSize="xs"