ComplaintScreen.jsx 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. import * as WebBrowser from 'expo-web-browser';
  2. import * as React from 'react';
  3. import { StyleSheet, View } from 'react-native';
  4. import { Flex } from '@ant-design/react-native';
  5. import { TouchableRipple, Divider } from 'react-native-paper';
  6. import { ScrollView } from 'react-native-gesture-handler';
  7. import { Div } from 'react-native-magnus';
  8. import Icon from 'react-native-vector-icons/FontAwesome';
  9. import { useTranslation } from 'react-i18next';
  10. import { useRoute } from '@react-navigation/native';
  11. import { useRequest } from '@umijs/hooks';
  12. import Header from './Header'; // 头部
  13. import Text from '../../components/Text';
  14. import Button from '../../components/Button';
  15. const Types = new Map([
  16. ['MERCHANT', ['商家少送/漏送商品', '食品品质/安全问题']],
  17. [
  18. 'RIDER',
  19. [
  20. '等待时间过长,超市配送',
  21. '提前点击确认送达',
  22. '错送商品',
  23. '商品破损',
  24. '错送商品',
  25. '威胁/辱骂/殴打',
  26. '骚扰顾客',
  27. ],
  28. ],
  29. ]);
  30. export default function ComplaintScreen({ navigation }) {
  31. const { t } = useTranslation();
  32. const route = useRoute();
  33. const { params } = route;
  34. const { orderId } = params || 0;
  35. const [orderInfo, setorderInfo] = React.useState({ merchant: {} });
  36. const { merchant } = orderInfo;
  37. useRequest(() => `/orderInfo/get/${orderId}`, {
  38. refreshDeps: [orderId],
  39. onSuccess: (result) => {
  40. setorderInfo(result);
  41. },
  42. });
  43. return (
  44. <>
  45. <Header title={t('ding-dan-tou-su')} />
  46. <ScrollView contentContainerStyle={styles.scroll}>
  47. <View style={styles.card}>
  48. <Text size="c2" type="info">
  49. {t('tou-su-shang-jia')}
  50. </Text>
  51. <Text size="s1">{orderInfo.merShowName || ' '}</Text>
  52. <Divider />
  53. <View style={styles.main}>
  54. {Types.get('MERCHANT').map((item, index) => {
  55. return (
  56. <TouchableRipple
  57. key={index}
  58. onPress={() => {
  59. navigation.navigate('ComplaintNext', {
  60. orderId,
  61. type: item,
  62. target: 'MERCHANT',
  63. });
  64. }}
  65. >
  66. <Flex style={styles.item}>
  67. <Flex.Item>
  68. <Text size="c2" type="info">
  69. {item}
  70. </Text>
  71. </Flex.Item>
  72. <Icon name="angle-right" color="#B4B4B4" />
  73. </Flex>
  74. </TouchableRipple>
  75. );
  76. })}
  77. </View>
  78. </View>
  79. <View style={styles.card}>
  80. {orderInfo.riderStatus !== 'NOT_RECEIVED' && (
  81. <>
  82. <Text size="c2" type="info">
  83. {t('tou-su-qi-shou')}
  84. </Text>
  85. <Text size="s1">{orderInfo.riderName}</Text>
  86. <Divider />
  87. <View style={styles.main}>
  88. {Types.get('RIDER').map((item, index) => {
  89. return (
  90. <TouchableRipple
  91. key={index}
  92. onPress={() => {
  93. navigation.navigate('ComplaintNext', {
  94. orderId,
  95. type: item,
  96. target: 'RIDER',
  97. });
  98. }}
  99. >
  100. <Flex style={styles.item}>
  101. <Flex.Item>
  102. <Text size="c2" type="info">
  103. {item}
  104. </Text>
  105. </Flex.Item>
  106. <Icon name="angle-right" color="#B4B4B4" />
  107. </Flex>
  108. </TouchableRipple>
  109. );
  110. })}
  111. </View>
  112. <Divider />
  113. </>
  114. )}
  115. <Flex style={styles.bottom}>
  116. <Flex.Item>
  117. <Text size="c2" type="info">
  118. {t('wei-zhao-dao-tou-su-xiang')}
  119. </Text>
  120. </Flex.Item>
  121. <Button size="small" outline>
  122. {t('lian-xi-ke-fu')}
  123. </Button>
  124. </Flex>
  125. </View>
  126. </ScrollView>
  127. </>
  128. );
  129. }
  130. const styles = StyleSheet.create({
  131. scroll: {
  132. paddingVertical: 10,
  133. },
  134. card: {
  135. paddingHorizontal: 15,
  136. paddingVertical: 20,
  137. backgroundColor: '#fff',
  138. marginBottom: 10,
  139. },
  140. item: {
  141. paddingVertical: 5,
  142. },
  143. main: {
  144. paddingVertical: 5,
  145. },
  146. bottom: {
  147. paddingVertical: 10,
  148. },
  149. });