import * as WebBrowser from 'expo-web-browser'; import * as React from 'react'; import { Platform } from 'react-native'; import { Div, Button, Text, Icon } from 'react-native-magnus'; import { ScrollView } from 'react-native-gesture-handler'; import { TextareaItem } from '@ant-design/react-native'; import { useTranslation } from 'react-i18next'; import { PullPicker } from 'teaset'; import { useRoute } from '@react-navigation/native'; import { useCreation } from '@umijs/hooks'; import useModel from 'flooks'; import Order from './model'; // Order模块通用方法 import Header from '../../components/Header'; import ImagePicker from '../../components/ImagePicker'; import { reasonMap } from '../../Utils/OrderUtils'; export default function ApplayCancelScreen({ navigation }) { const { t } = useTranslation(); const { cancelOrder } = useModel(Order, []); const [imgList, setimgList] = React.useState(['']); const [content, setcontent] = React.useState(''); const [chooseReason, setchooseReason] = React.useState(''); const route = useRoute(); const { params } = route; const { orderId } = params || {}; const canSubmit = useCreation(() => { if (orderId && chooseReason && content) { return true; } else { return false; } }, [orderId, chooseReason, content, imgList]); function changeImg(img, index) { const list = [...imgList]; if (!img) { list.splice(index, 1); } else { list.splice(index, 1, img); } if (index === list.length - 1 && list.length < 4) { list.push(''); } setimgList(list); } function deleteImg(index) { const list = [...imgList]; if (!list[index]) { return null; } else { return () => changeImg('', index); } } const onSubmit = () => { cancelOrder(orderId, chooseReason, content, imgList.join(',')).then(() => { navigation.goBack(); }); }; return ( <>
{t('tips1')}
{t('nin-ru-guo-que-ding-qu-xiao')}, {t('qing-wu-bi-tian-xie-zhen-shi-yuan-yin')} ,{t('yi-shi-wo-men-ke-yi-geng-hao-di-bang-nin-jie-jue-wen-ti')}。
{imgList.map((item, index) => { return ( changeImg(img, index)} cancelEvent={deleteImg(index)} /> ); })}
); }