ApplayRefundModalScreen.tsx 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. import { StackScreenProps } from '@react-navigation/stack';
  2. import * as React from 'react';
  3. import * as Animatable from 'react-native-animatable';
  4. import {
  5. Div,
  6. Button,
  7. RadioGroup,
  8. Radio,
  9. Image,
  10. Text,
  11. Avatar,
  12. Input,
  13. } from 'react-native-magnus';
  14. import { ScrollView } from 'react-native-gesture-handler';
  15. import { useTranslation } from 'react-i18next';
  16. import Request from '../utils/RequestUtils';
  17. import { toastInfo, toastSuccess } from '../utils/SystemUtils';
  18. const ReasonMap = new Map([
  19. [
  20. 'RIDER_CANNOT_REACH_USER',
  21. {
  22. name: 'wu-fa-lian-xi-shang-yong-hu',
  23. },
  24. ],
  25. [
  26. 'DO_NOT_WANT_SOMETHING_TEMPORARILY',
  27. {
  28. name: 'yong-hu-ju-qian',
  29. },
  30. ],
  31. [
  32. 'OTHER',
  33. {
  34. name: 'qi-ta',
  35. hasInput: true,
  36. },
  37. ],
  38. ]);
  39. export default function ApplayRefundModalScreen({
  40. navigation,
  41. route,
  42. }: StackScreenProps) {
  43. const { params } = route;
  44. const { orderId } = params || {};
  45. const { t } = useTranslation();
  46. const [reason, setReason] = React.useState<string>('RIDER_CANNOT_REACH_USER');
  47. const [extra, setExtra] = React.useState<string>('');
  48. const inRef = React.useRef();
  49. return (
  50. <Div flex={1} bg="black600" alignItems="center" justifyContent="center">
  51. <Animatable.View animation="slideInUp" duration={300}>
  52. <Div bg="white" p={10} rounded="sm" minW={287}>
  53. <Text fontSize="xl" fontWeight="bold" textAlign="center">
  54. 取消订单申请
  55. </Text>
  56. <Div px={10} py={10}>
  57. <RadioGroup
  58. value={reason}
  59. onChange={(value: any) => {
  60. if (value !== 'OTHER') {
  61. setExtra('');
  62. }
  63. setReason(value);
  64. }}
  65. >
  66. {[...ReasonMap.keys()].map((item, index) => {
  67. let info = ReasonMap.get(item);
  68. return (
  69. <Radio
  70. value={item}
  71. key={index}
  72. activeColor="yellow500"
  73. inactiveColor="gray300"
  74. pr={20}
  75. my={5}
  76. >
  77. <Text ml={6} fontSize="sm" color="black">
  78. {t(info.name)}
  79. </Text>
  80. {info.hasInput && (
  81. <Input
  82. w={96}
  83. h={25}
  84. opacity={1}
  85. loaderColor="gray400"
  86. color="gray900"
  87. fontSize="sm"
  88. value={extra}
  89. onChangeText={setExtra}
  90. ml={5}
  91. bg="gray100"
  92. />
  93. )}
  94. </Radio>
  95. );
  96. })}
  97. </RadioGroup>
  98. </Div>
  99. <Text color="gray500" textAlign="right" fontSize="xs">
  100. (作为责任评判的依据之一,请如实填写)
  101. </Text>
  102. <Div row py={10} mt={10}>
  103. <Button
  104. flex={1}
  105. mx={3}
  106. rounded="xs"
  107. bg="white"
  108. color="black"
  109. borderWidth={1}
  110. borderColor="yellow500"
  111. fontSize="sm"
  112. onPress={() => navigation.goBack()}
  113. >
  114. {t('qu-xiao')}
  115. </Button>
  116. <Button
  117. flex={1}
  118. mx={3}
  119. rounded="xs"
  120. bg="yellow500"
  121. fontSize="sm"
  122. onPress={() => {
  123. Request.get('/orderRefundApply/apply', {
  124. params: {
  125. orderId,
  126. reason,
  127. remark: extra,
  128. img: '',
  129. },
  130. })
  131. .then((res) => {
  132. toastSuccess('申请提交成功');
  133. })
  134. .catch((e) => {
  135. toastInfo(e.error);
  136. })
  137. .finally(() => {
  138. navigation.goBack();
  139. });
  140. }}
  141. >
  142. {t('que-ren')}
  143. </Button>
  144. </Div>
  145. </Div>
  146. </Animatable.View>
  147. </Div>
  148. );
  149. }