panhui há 5 anos atrás
pai
commit
87f958f311

+ 1 - 1
App.tsx

@@ -48,7 +48,7 @@ export default function App() {
               <Button
                 fontSize="xl"
                 position="absolute"
-                zIndex="999"
+                zIndex={999}
                 bg="transparent"
                 color="black"
               >

+ 78 - 0
components/SmsInput.tsx

@@ -0,0 +1,78 @@
+import * as WebBrowser from 'expo-web-browser';
+import * as React from 'react';
+import { Div, Image, Text, Avatar, Input, Button } from 'react-native-magnus';
+
+import { TextInputMask } from 'react-native-masked-text';
+import { useTranslation } from 'react-i18next';
+import { useInterval } from 'ahooks';
+import { sendSms } from '../Utils/SmsUtil';
+import { toastInfo } from '../utils/SystemUtils';
+
+export default function SmsInput({ phone, onCodeChange, type }) {
+  const [code, setCode] = React.useState();
+  const [interval, setInterval] = React.useState(null);
+  const [count, setCount] = React.useState(60);
+  const { t } = useTranslation();
+
+  useInterval(
+    () => {
+      setCount(count - 1);
+      if (count === 0) {
+        setInterval(null);
+      }
+    },
+    interval,
+    { immediate: true }
+  );
+
+  return (
+    <Div row alignItems="center" py={10}>
+      <Text textAlign="right" w={labelWidth || 80}>
+        {label}
+      </Text>
+      <Div
+        flex={1}
+        bg="gray100"
+        rounded="sm"
+        px={15}
+        ml={5}
+        h={30}
+        alignItems="stretch"
+      >
+        <TextInputMask
+          type={'custom'}
+          value={code}
+          keyboardType="numeric"
+          options={{
+            mask: '9999',
+          }}
+          onChangeText={(text) => {
+            setCode(value);
+            onCodeChange(value);
+          }}
+          placeholderTextColor="#a6a6a6"
+          style={{ flex: 1, fontSize: 14 }}
+          placeholder={t('shu-ru-yan-zheng-ma')}
+        />
+      </Div>
+      <Button
+        onPress={() => {
+          sendSms(phone, type || 'register')
+            .then(() => {
+              setCount(60);
+              setInterval(1000);
+            })
+            .catch((e) => {
+              console.log(e);
+              toastInfo(e.response.data.error);
+            });
+        }}
+        bg="transparent"
+        color={interval ? 'gray500' : 'yellow500'}
+        disabled={interval || !phone}
+      >
+        {interval ? `已发送(${count})S` : '发送验证码'}
+      </Button>
+    </Div>
+  );
+}

+ 1 - 1
i18n.ts

@@ -1,7 +1,7 @@
 import i18n from 'i18next';
 import * as Localization from 'expo-localization';
 import { initReactI18next } from 'react-i18next';
-import en from './locales/en.json';
+import en from './locales/enc';
 import zh from './locales/zh-CN.json';
 import th from './locales/th.json';
 

+ 46 - 1
locales/zh-CN.json

@@ -123,5 +123,50 @@
   "qi-shou-fu-wu-he-zuo-xie-yi": "骑手服务合作协议",
   "wei-jie-dan": "未接单",
   "dai-qu-can": "待取餐",
-  "dai-song-da": "待送达"
+  "dai-song-da": "待送达",
+  "tui-chu-dang-qian-zhang-hu": "退出当前账户",
+  "tou-su-lei-xing": "投诉类型",
+  "tou-su-shi-jian": "投诉时间",
+  "ni-cheng": "昵称",
+  "gong-hao": "工号",
+  "di-zhi": "地址",
+  "dian-hua": "电话",
+  "gong-zuo-fan-wei": "工作范围",
+  "dan-liang-re-li-tu": "单量热力图",
+  "pei-xun-zhong-xin": "培训中心",
+  "que-ren-yao-tui-chu-dang-qian-zhang-hao-ma": "确认要退出当前账号吗?",
+  "she-zhi-cheng-gong": "设置成功",
+  "xin-xiao-xi-tong-zhi": "新消息通知",
+  "xin-dan-ti-shi-yin": "新单提示音",
+  "cui-dan-ti-shi-yin": "催单提示音",
+  "liao-tian-xiao-xi-ti-xing": "聊天消息提醒",
+  "liao-tian": "聊天",
+  "xi-tong-ti-xing": "系统提醒",
+  "ding-dan-xiang-qing": "订单详情",
+  "di-tu": "地图",
+  "qing-shu-ru-liao-tian-nei-rong": "请输入聊天内容",
+  "xiao-xi-zhong-xin": "消息中心",
+  "xi-tong-xiao-xi": "系统消息",
+  "yong-hu-xiao-xi": " '用户消息",
+  "zan-wu-shu-ju": "暂无数据",
+  "song-da": "送达",
+  "jie-dan": "接单",
+  "cha-kan-dao-hang": "查看导航",
+  "wo-yi-dao-dian": "我已到店",
+  "pai-zhao-qu-huo": "拍照取货",
+  "que-ren-song-da": "确认送达",
+  "jie-dan-cheng-gong": "接单成功",
+  "shang-pin-xin-xi": "商品信息",
+  "fen": "份",
+  "lian-xi-shang-jia": "联系商家",
+  "shang-jia-xin-xi": "商家信息",
+  "lian-xi-ke-hu": "联系客户",
+  "yong-hu-xin-xi": "用户信息",
+  "ordertips": "为避免货物纠纷,请在取货时 检查并拍照存证",
+  "wo-yi-qu-huo": "我已取货",
+  "liu-shui-hao": "流水号",
+  "yu-ji-song-da-shi-jian": "预计送达时间",
+  "yong-hu-shou-dao-shi-jian": "用户收到时间",
+  "ben-dan-pai-song-shou-ru": "本单派送收入",
+  "shu-ru-zhen-shi-xing-ming": "输入真实姓名"
 }

+ 3 - 30
login/LoginScreen.tsx

@@ -14,6 +14,8 @@ import Navigation from '../navigation';
 
 import Login from './model';
 
+import SmsInput from '../components/SmsInput';
+
 const LoginTab = createMaterialTopTabNavigator<LoginTabParamList>();
 
 export default function LoginScreen({
@@ -231,36 +233,7 @@ function LoginByCode() {
           />
         </Div>
       </Div>
-      <Div row alignItems="center" py={10}>
-        <Text w={96} textAlign="right">
-          {t('yan-zheng-ma')}:
-        </Text>
-        <Div
-          flex={1}
-          bg="gray100"
-          rounded="sm"
-          px={15}
-          ml={5}
-          h={30}
-          alignItems="stretch"
-        >
-          <TextInputMask
-            type={'custom'}
-            value={code}
-            keyboardType="numeric"
-            options={{
-              mask: '9999',
-            }}
-            onChangeText={(text) => {
-              console.log(text);
-              setCode(text);
-            }}
-            placeholderTextColor="#a6a6a6"
-            style={{ flex: 1, fontSize: 14 }}
-            placeholder={t('shu-ru-yan-zheng-ma')}
-          />
-        </Div>
-      </Div>
+      <SmsInput phone={phone} onCodeChange={setCode} type="login" />
 
       <Div row justifyContent="space-between" pl={90}>
         <Button color="gray400" fontSize="sm" bg="white">

+ 6 - 3
login/RegisterScreen.tsx

@@ -22,6 +22,7 @@ import Login from './model';
 import { MainStackParamList } from '../types';
 import { connect } from '../utils/SystemUtils';
 import Navigation from '../navigation/LoginStackNavigator';
+import SmsInput from '../components/SmsInput';
 export default function RegisterScreen({
   navigation,
 }: StackScreenProps<MainStackParamList, 'Login'>) {
@@ -122,7 +123,7 @@ export default function RegisterScreen({
               )}
             </Div>
           </Div>
-          <Div row alignItems="center" py={10}>
+          {/* <Div row alignItems="center" py={10}>
             <Text w={96} textAlign="right">
               {t('yan-zheng-ma')}:
             </Text>
@@ -150,7 +151,9 @@ export default function RegisterScreen({
                 placeholder={t('shu-ru-yan-zheng-ma')}
               />
             </Div>
-          </Div>
+          </Div> */}
+          <SmsInput phone={phone} onCodeChange={setCode} />
+
           <Div row alignItems="center" py={10}>
             <Text w={96} textAlign="right">
               {t('mi-ma')}:
@@ -237,7 +240,7 @@ export default function RegisterScreen({
             fontSize="sm"
             my={20}
             disabled={!canSubmit}
-            onPress={() => loginByRegister(phone, password)}
+            onPress={() => loginByRegister(phone, password, code)}
           >
             {t('xia-yi-bu')}
           </Button>

+ 26 - 30
map/SearchMapScreen.tsx

@@ -21,44 +21,40 @@ import {
 
 export default function SearchMapScreen({ navigation }) {
   const { t } = useTranslation();
-  const { locationInfo, changeChooseInfo, getNowLocation } = useModel(
-    MapModel,
-    ['locationInfo']
-  );
+  const { getNowLocation } = useModel(MapModel, []);
+  const webRef = React.useRef();
   const { setLocation } = useModel(Login, []);
-  const { location } = locationInfo;
   const [show, setshow] = React.useState<boolean>(false);
   useMount(() => {
     toastShow();
-    getNowLocation().then(() => {
-      setTimeout(() => {
-        setshow(true);
-        setTimeout(() => {
-          toastHide();
-        }, 1000);
-      }, 300);
+    getNowLocation().then((res) => {
+      let location = '';
+      if (res.addressName !== '定位失败') {
+        location = `${res.location.lat},${res.location.lng}`;
+      }
+      webRef.current.injectJavaScript(`window.setLocation('${location}')`);
+      toastHide();
     });
   });
   return (
     <>
-      {show && (
-        <WebView
-          source={{
-            uri: `http://dingdong.izouma.com/map/chooseLocation?location=${location.lat},${location.lng}`,
-          }}
-          style={{ flexGrow: 1, width: '100%' }}
-          onMessage={({ nativeEvent }) => {
-            const info = JSON.parse(nativeEvent.data);
-            console.log(info);
-            setLocation(
-              info.poiaddress + info.poiname,
-              info.latlng.lat,
-              info.latlng.lng
-            );
-            navigation.goBack();
-          }}
-        />
-      )}
+      <WebView
+        ref={webRef}
+        source={{
+          uri: `http://dingdong.izouma.com/map/chooseLocation`,
+        }}
+        style={{ flexGrow: 1, width: '100%' }}
+        onMessage={({ nativeEvent }) => {
+          const info = JSON.parse(nativeEvent.data);
+          console.log(info);
+          setLocation(
+            info.poiaddress + info.poiname,
+            info.latlng.lat,
+            info.latlng.lng
+          );
+          navigation.goBack();
+        }}
+      />
     </>
   );
 }

+ 7 - 2
mine/MineComplaint.tsx

@@ -22,6 +22,7 @@ import { MonthDate, getSearchDate } from '../utils/TimeUtils';
 import request from '../utils/RequestUtils';
 
 const AppraisalCom = ({ info }) => {
+  const { t } = useTranslation();
   const {
     content,
     enabled,
@@ -37,8 +38,12 @@ const AppraisalCom = ({ info }) => {
   const imgs = img ? img.split(',') : [];
   return (
     <Div mb={10} bg="white" p={15}>
-      <Text fontSize="sm">投诉类型:{type}</Text>
-      <Text fontSize="sm">投诉时间:{time}</Text>
+      <Text fontSize="sm">
+        {t('tou-su-lei-xing')}:{type}
+      </Text>
+      <Text fontSize="sm">
+        {t('tou-su-shi-jian')}:{time}
+      </Text>
       <Text
         fontSize="sm"
         color="gray500"

+ 7 - 7
mine/MineInfoScreen.tsx

@@ -49,7 +49,7 @@ export default function MineInfoScreen({ navigation }: StackScreenProps) {
           block
           onPress={() => {
             promot(navigation, {
-              title: '昵称',
+              title: t('ni-cheng'),
               defaultVal: nickname,
               hasCancel: true,
               submitEvent: (val) => {
@@ -60,7 +60,7 @@ export default function MineInfoScreen({ navigation }: StackScreenProps) {
         >
           <Div flex={1} row bg="white" row h={55} alignItems="center" px={15}>
             <Text flex={1} fontSize="sm">
-              昵称:
+              {t('ni-cheng')}:
             </Text>
 
             <Text color="gray500" fontSize="sm">
@@ -71,7 +71,7 @@ export default function MineInfoScreen({ navigation }: StackScreenProps) {
         </Button>
         <Div mb={10} row bg="white" row h={55} alignItems="center" px={15}>
           <Text flex={1} fontSize="sm">
-            更改密码:
+            {t('geng-gai-mi-ma')}:
           </Text>
 
           <Icon ml={5} name="right" fontSize="sm" />
@@ -85,7 +85,7 @@ export default function MineInfoScreen({ navigation }: StackScreenProps) {
             borderColor="gray100"
           >
             <Text flex={1} fontSize="sm">
-              工号:
+              {t('gong-hao')}:
             </Text>
             <Text fontSize="sm" color="gray500">
               {jobNumber}
@@ -99,7 +99,7 @@ export default function MineInfoScreen({ navigation }: StackScreenProps) {
             borderColor="gray100"
           >
             <Text fontSize="sm" minW={75}>
-              地 址:
+              {t('di-zhi')}:
             </Text>
             <Text fontSize="sm" color="gray500">
               {area}
@@ -113,7 +113,7 @@ export default function MineInfoScreen({ navigation }: StackScreenProps) {
             borderColor="gray100"
           >
             <Text flex={1} fontSize="sm">
-              电 话:
+              {t('dian-hua')}:
             </Text>
             <Text fontSize="sm" color="gray500">
               {phone}
@@ -122,7 +122,7 @@ export default function MineInfoScreen({ navigation }: StackScreenProps) {
 
           <Div row py={12} alignItems="center">
             <Text fontSize="sm" minW={75}>
-              工作范围:
+              {t('gong-zuo-fan-wei')}:
             </Text>
             <Text fontSize="sm" color="gray500">
               {area}

+ 10 - 10
mine/MineScreen.tsx

@@ -44,7 +44,7 @@ export default function RegisterScreen({ navigation }: StackScreenProps) {
                   <Icon color="black" name="right" ml={10} fontSize="xl" />
                 </Div>
                 <Text fontSize="sm" mt={5}>
-                  工号:{jobNumber}
+                  {t('gong-hao')}:{jobNumber}
                 </Text>
               </Div>
             </Div>
@@ -62,19 +62,19 @@ export default function RegisterScreen({ navigation }: StackScreenProps) {
           >
             <Div flex={1} row>
               <Div flex={1}>
-                <Text>我的叮咚币</Text>
+                <Text>{t('wo-de-ding-dong-bi')}</Text>
                 <Div row alignItems="center" mt={5}>
                   <Text fontSize="xl" color="yellow400">
                     578.63
                   </Text>
                   <Text fontSize="sm" color="gray700" ml={6}>
-                    今日收入
+                    {t('jin-ri-shou-ru')}
                   </Text>
                   <Text fontSize="xl" color="yellow400" ml={35}>
                     578.63
                   </Text>
                   <Text fontSize="sm" color="gray700" ml={6}>
-                    今日收入
+                    {t('jin-ri-shou-ru')}
                   </Text>
                 </Div>
               </Div>
@@ -95,7 +95,7 @@ export default function RegisterScreen({ navigation }: StackScreenProps) {
           }
         >
           <Div flex={1} row>
-            <Text flex={1}>单量热力图</Text>
+            <Text flex={1}>{t('dan-liang-re-li-tu')}</Text>
             <Icon name="right" />
           </Div>
         </Button>
@@ -112,7 +112,7 @@ export default function RegisterScreen({ navigation }: StackScreenProps) {
           }
         >
           <Div flex={1} row>
-            <Text flex={1}>我的评价</Text>
+            <Text flex={1}>{t('wo-de-ping-jia')}</Text>
             <Icon name="right" />
           </Div>
         </Button>
@@ -129,13 +129,13 @@ export default function RegisterScreen({ navigation }: StackScreenProps) {
           }
         >
           <Div flex={1} row>
-            <Text flex={1}>我的投诉</Text>
+            <Text flex={1}>{t('wo-de-tou-su')}</Text>
             <Icon name="right" />
           </Div>
         </Button>
         <Button block bg="white" p={20} rounded="sm" mb={10}>
           <Div flex={1} row>
-            <Text flex={1}>培训中心</Text>
+            <Text flex={1}>{t('pei-xun-zhong-xin')}</Text>
             <Icon name="right" />
           </Div>
         </Button>
@@ -150,7 +150,7 @@ export default function RegisterScreen({ navigation }: StackScreenProps) {
           }}
         >
           <Div flex={1} row>
-            <Text flex={1}>联系客服</Text>
+            <Text flex={1}>{t('lian-xi-ke-fu')}</Text>
             <Icon name="right" />
           </Div>
         </Button>
@@ -167,7 +167,7 @@ export default function RegisterScreen({ navigation }: StackScreenProps) {
           }}
         >
           <Div flex={1} row>
-            <Text flex={1}>设置</Text>
+            <Text flex={1}>{t('she-zhi')}</Text>
             <Icon name="right" />
           </Div>
         </Button>

+ 2 - 2
mine/SettingScreen.tsx

@@ -72,13 +72,13 @@ export default function SettingScreen({ navigation }: StackScreenProps) {
           my={30}
           onPress={() => {
             alert(navigation, {
-              msg: '确认要退出当前账号吗?',
+              msg: t('que-ren-yao-tui-chu-dang-qian-zhang-hao-ma'),
               hasCancel: true,
               submitEvent: () => logout(),
             });
           }}
         >
-          退出当前账户
+          {t('tui-chu-dang-qian-zhang-hu')}
         </Button>
       </ScrollView>
     </Div>

+ 5 - 5
mine/SettingSysScreen.tsx

@@ -27,7 +27,7 @@ export default function SettingSysScreen({ navigation }: StackScreenProps) {
         },
       })
       .then((res) => {
-        toastSuccess('设置成功');
+        toastSuccess(t('she-zhi-cheng-gong'));
         setRider(res);
       })
       .catch((e) => {
@@ -52,7 +52,7 @@ export default function SettingSysScreen({ navigation }: StackScreenProps) {
           row
           px={14}
         >
-          <Text fontSize="sm">新消息通知</Text>
+          <Text fontSize="sm">t('xin-xiao-xi-tong-zhi')</Text>
           <Toggle
             on={newNews}
             onPress={() => {
@@ -67,7 +67,7 @@ export default function SettingSysScreen({ navigation }: StackScreenProps) {
         </Div>
         <Div bg="white" px={14} py={10} my={10}>
           <Div row alignItems="center" justifyContent="space-between" py={10}>
-            <Text fontSize="sm">新单提示音</Text>
+            <Text fontSize="sm">t('xin-dan-ti-shi-yin')</Text>
             <Toggle
               on={newOrderTone}
               onPress={() => {
@@ -81,7 +81,7 @@ export default function SettingSysScreen({ navigation }: StackScreenProps) {
             />
           </Div>
           <Div row alignItems="center" justifyContent="space-between" py={10}>
-            <Text fontSize="sm">催单提示音</Text>
+            <Text fontSize="sm">t('cui-dan-ti-shi-yin')</Text>
             <Toggle
               on={reminderTone}
               onPress={() => {
@@ -95,7 +95,7 @@ export default function SettingSysScreen({ navigation }: StackScreenProps) {
             />
           </Div>
           <Div row alignItems="center" justifyContent="space-between" py={10}>
-            <Text fontSize="sm">聊天消息提醒</Text>
+            <Text fontSize="sm">t('liao-tian-xiao-xi-ti-xing')</Text>
             <Toggle
               on={chatMessageReminder}
               onPress={() => {

+ 1 - 1
navigation/MineStackNavigator.tsx

@@ -142,7 +142,7 @@ export default function Navigation({
         name="Heat3D"
         component={Heat3DScreen}
         options={{
-          title: '单量热力图',
+          title: t('dan-liang-re-li-tu'),
         }}
       />
     </MineStack.Navigator>

+ 2 - 2
navigation/NoticeStackNavigator.tsx

@@ -55,12 +55,12 @@ export default function Navigation({
       <NoticeStack.Screen
         name="Chat"
         component={ChatScreen}
-        options={{ title: '聊天' }}
+        options={{ title: t('liao-tian') }}
       />
       <NoticeStack.Screen
         name="EmailDetail"
         component={EmailDetailScreen}
-        options={{ title: '系统提醒' }}
+        options={{ title: t('xi-tong-ti-xing') }}
         initialParams={{ emailId: 2160 }}
       />
     </NoticeStack.Navigator>

+ 2 - 2
navigation/OrderStackNavigator.tsx

@@ -47,13 +47,13 @@ export default function Navigation({
       <OrderStack.Screen
         name="OrderDetail"
         component={OrderDetailScreen}
-        options={{ title: '订单详情' }}
+        options={{ title: t('ding-dan-xiang-qing') }}
         initialParams={{ orderId: 2077 }}
       />
       <OrderStack.Screen
         name="OrderMap"
         component={OrderMapScreen}
-        options={{ title: '地图' }}
+        options={{ title: t('di-tu') }}
       />
     </OrderStack.Navigator>
   );

+ 1 - 1
notice/ChatScreen.tsx

@@ -71,7 +71,7 @@ export default function ChatScreen({ navigation, route }: StackScreenProps) {
   return (
     <Div flex={1}>
       <GiftedChat
-        placeholder="请输入聊天内容"
+        placeholder={t('qing-shu-ru-liao-tian-nei-rong')}
         messages={messages}
         onSend={(messages) => onSend(messages)}
         showUserAvatar={true}

+ 5 - 5
notice/NoticeScreen.tsx

@@ -36,7 +36,7 @@ export default function NoticeScreen({
     <Div bg="gray100" flex={1}>
       <Div bg="yellow500" pt={Constants.statusBarHeight + 11} pb={11}>
         <Text color="white" textAlign="center" fontSize="xl" fontWeight="bold">
-          消息中心
+          {t('xiao-xi-zhong-xin')}
         </Text>
       </Div>
       <NoticeTab.Navigator
@@ -63,14 +63,14 @@ export default function NoticeScreen({
           name="Sys"
           component={SysNoticeScreen}
           options={{
-            title: '系统消息',
+            title: t('xi-tong-xiao-xi'),
           }}
         />
         <NoticeTab.Screen
           name="Chat"
           component={UserChatScreen}
           options={{
-            title: '用户消息',
+            title:t('yong-hu-xiao-xi'),
           }}
         />
       </NoticeTab.Navigator>
@@ -103,7 +103,7 @@ function SysNoticeScreen({ navigation }) {
       ListEmptyComponent={() => {
         return (
           <Text color="gary200" fontSize="sm" textAlign="center" py={20}>
-            暂无数据
+            t('zan-wu-shu-ju')
           </Text>
         );
       }}
@@ -145,7 +145,7 @@ function UserChatScreen({ navigation }) {
       ListEmptyComponent={() => {
         return (
           <Text color="gary200" fontSize="sm" textAlign="center" py={20}>
-            暂无数据
+            {t('zan-wu-shu-ju')}
           </Text>
         );
       }}

+ 6 - 6
order/OrderCom.tsx

@@ -28,7 +28,7 @@ export default function OrderCom({
             <Text fontSize="xl" color="red500" fontWeight="bold">
               43分钟内
             </Text>
-            <Text fontSize="xl">送达</Text>
+            <Text fontSize="xl">{t('song-da')}</Text>
             <Text
               fontSize="xl"
               color="red500"
@@ -67,7 +67,7 @@ export default function OrderCom({
         </Div>
         {riderStatus === 'NOT_RECEIVED' && (
           <Button block mx={15} mb={20} bg="yellow500" onPress={receiverOrder}>
-            接单
+            {t('jie-dan')}
           </Button>
         )}
 
@@ -81,23 +81,23 @@ export default function OrderCom({
               borderWidth={1}
               onPress={goMap}
             >
-              查看导航
+              {t('cha-kan-dao-hang')}
             </Button>
             {riderStatus === 'RECEIVED' && (
               <Button ml={20} flex={1} bg="yellow500" onPress={changeStatus}>
-                我已到店
+                {t('wo-yi-dao-dian')}
               </Button>
             )}
 
             {riderStatus === 'ARRIVE' && (
               <Button ml={20} flex={1} bg="yellow500" onPress={goDetail}>
-                拍照取货
+                {t('pai-zhao-qu-huo')}
               </Button>
             )}
 
             {riderStatus === 'TAKE_MEAL' && (
               <Button ml={20} flex={1} bg="yellow500" onPress={changeStatus}>
-                确认送达
+                {t('que-ren-song-da')}
               </Button>
             )}
           </Div>

+ 21 - 20
order/OrderDetailScreen.tsx

@@ -93,7 +93,7 @@ export default function OrderDetailScreen({
               {data.deliveryAmount}
             </Text>
             <Text fontSize="sm" color="gray600">
-              本单派送收入
+              {t('ben-dan-pai-song-shou-ru')}
             </Text>
           </Div>
           <Div w={1} bg="gray100" />
@@ -103,7 +103,7 @@ export default function OrderDetailScreen({
                 {data.userReceivedTime}
               </Text>
               <Text fontSize="sm" color="gray600">
-                用户收到时间
+                {t('yong-hu-shou-dao-shi-jian')}
               </Text>
             </Div>
           ) : (
@@ -112,7 +112,7 @@ export default function OrderDetailScreen({
                 {data.timeOfArrival}
               </Text>
               <Text fontSize="sm" color="gray600">
-                预计送达时间
+                {t('yu-ji-song-da-shi-jian')}
               </Text>
             </Div>
           )}
@@ -140,11 +140,11 @@ export default function OrderDetailScreen({
                       {statusInfo.name}
                     </Text>
                     <Text fontSize="sm" color="gray600" mt={2}>
-                      流水号:{data.id}
+                      {t('liu-shui-hao')}:{data.id}
                     </Text>
                   </Div>
                   <Button bg="yellow500" w={112} onPress={orderChange}>
-                    确认送达
+                    {t('que-ren-song-da')}
                   </Button>
                 </Div>
               )}
@@ -152,9 +152,9 @@ export default function OrderDetailScreen({
                 <>
                   <Div row py={10}>
                     <Div flex={1}>
-                      <Text>我已到店</Text>
+                      <Text>{t('wo-yi-dao-dian')}</Text>
                       <Text fontSize="sm" color="gray600" mt={2}>
-                        流水号:{data.id}
+                        {t('liu-shui-hao')}:{data.id}
                       </Text>
                     </Div>
                     <Button
@@ -163,7 +163,7 @@ export default function OrderDetailScreen({
                       disabled={statusInfo.status != 0}
                       onPress={orderChange}
                     >
-                      我已到店
+                      {t('wo-yi-dao-dian')}
                     </Button>
                   </Div>
 
@@ -171,13 +171,13 @@ export default function OrderDetailScreen({
                     <>
                       <Div row py={10}>
                         <Div flex={1}>
-                          <Text>我已取货</Text>
+                          <Text>{t('wo-yi-qu-huo')}</Text>
                           <Text fontSize="sm" color="gray600" mt={2} pr={48}>
-                            为避免货物纠纷,请在取货时 检查并拍照存证
+                            {t('ordertips')}
                           </Text>
                         </Div>
                         <Button bg="yellow500" w={112} onPress={orderChange}>
-                          拍照取货
+                          {t('pai-zhao-qu-huo')}
                         </Button>
                       </Div>
                       <ImagePicker
@@ -190,7 +190,7 @@ export default function OrderDetailScreen({
               )}
               {(statusInfo.type === 'user' || statusInfo.type === 'finish') && (
                 <Div py={10}>
-                  <Text fontSize="sm">用户信息</Text>
+                  <Text fontSize="sm">{t('yong-hu-xin-xi')}</Text>
                   <Div px={10} mt={10}>
                     <Text fontSize="xl" fontWeight="bold">
                       {data.nickname}
@@ -217,7 +217,7 @@ export default function OrderDetailScreen({
                       });
                     }}
                   >
-                    联系客户
+                    {t('lian-xi-ke-hu')}
                   </Button>
                 </Div>
               )}
@@ -225,7 +225,7 @@ export default function OrderDetailScreen({
               {(statusInfo.type === 'merchant' ||
                 statusInfo.type === 'finish') && (
                 <Div borderTopColor="gray100" borderTopWidth={1} py={10}>
-                  <Text fontSize="sm">商家信息</Text>
+                  <Text fontSize="sm">{t('shang-jia-xin-xi')}</Text>
                   <Div px={10} mt={10}>
                     <Text fontSize="xl" fontWeight="bold">
                       {data.merShowName}
@@ -252,7 +252,7 @@ export default function OrderDetailScreen({
                       });
                     }}
                   >
-                    联系商家
+                    {t('lian-xi-shang-jia')}
                   </Button>
                 </Div>
               )}
@@ -288,10 +288,11 @@ export default function OrderDetailScreen({
               <Div borderTopColor="gray100" borderTopWidth={1} py={10}>
                 <Div row>
                   <Text fontSize="sm" flex={2}>
-                    商品信息
+                    {t('shang-pin-xin-xi')}
                   </Text>
                   <Text fontSize="sm" flex={1} textAlign="right">
-                    {totalNum}份
+                    {totalNum}
+                    {t('fen')}
                   </Text>
                   <Text fontSize="sm" flex={1} color="red500" textAlign="right">
                     ¥{data.totalAmount || 0}
@@ -324,17 +325,17 @@ export default function OrderDetailScreen({
                   my={10}
                   onPress={() => {
                     receiverOrder(data.id, (res) => {
-                      toastSuccess('接单成功');
+                      toastSuccess(t('jie-dan-cheng-gong'));
                     });
                   }}
                 >
-                  接单
+                  {t('jie-dan')}
                 </Button>
               )}
             </Div>
             {(statusInfo.type === 'merchant' || statusInfo.type === 'user') && (
               <Button block mx={15} my={10} bg="yellow500">
-                查看导航
+                {t('cha-kan-dao-hang')}
               </Button>
             )}
           </>

+ 2 - 2
order/OrderScreen.tsx

@@ -128,7 +128,7 @@ export default function OrderScreen({ navigation }: StackScreenProps) {
               }
               receiverOrder={() => {
                 receiverOrder(item.id, (res) => {
-                  toastSuccess('接单成功');
+                  toastSuccess(t('jie-dan-cheng-gong'));
                 });
               }}
               goMap={() =>
@@ -190,7 +190,7 @@ export default function OrderScreen({ navigation }: StackScreenProps) {
           if (!loading) {
             return (
               <Text color="gary200" fontSize="sm" textAlign="center" py={20}>
-                暂无数据
+                {t('zan-wu-shu-ju')}
               </Text>
             );
           } else {

+ 17 - 7
utils/MapUtils.ts

@@ -57,13 +57,23 @@ async function getLocation() {
       }
     })
     .catch((e) => {
-      return Promise.resolve({
-        addressName: '定位失败',
-        location: {
-          lat,
-          lng,
-        },
-      });
+      return request
+        .get(`https://apis.map.qq.com/ws/location/v1/ip?key=${tengxunKey}`)
+        .then((res) => {
+          return Promise.resolve({
+            addressName: '定位失败',
+            location: res.result.location,
+          });
+        })
+        .catch((e) => {
+          return Promise.resolve({
+            addressName: '定位失败',
+            location: {
+              lat,
+              lng,
+            },
+          });
+        });
     });
 }
 

+ 45 - 0
utils/SmsUtil.js

@@ -0,0 +1,45 @@
+import request from './RequestUtils';
+import submitPhone from './FormUtils';
+
+const templateMap = new Map([
+  [
+    'changePhone',
+    {
+      name: '修改手机号',
+      key: 676939,
+    },
+  ],
+  [
+    'register',
+    {
+      name: '注册',
+      key: 674906,
+    },
+  ],
+  [
+    'forgetPsd',
+    {
+      name: '忘记密码',
+      key: '674832',
+    },
+  ],
+  [
+    'login',
+    {
+      name: '通用',
+      key: '674851',
+    },
+  ],
+]);
+
+function sendSms(phone, type) {
+  return request.get('/sms/tencentSend', {
+    params: {
+      phone: `+86${submitPhone(phone)}`,
+      templateId: templateMap.get(type).key,
+    },
+  });
+}
+
+// eslint-disable-next-line import/prefer-default-export
+export { sendSms };

+ 1 - 1
wallet/AddBankCardScreen.tsx

@@ -127,7 +127,7 @@ export default function AddBankCardScreen({ navigation }: StackScreenProps) {
               loaderColor="gray400"
               color="gray900"
               opacity={1}
-              placeholder="输入真实姓名"
+              placeholder={t('shu-ru-zhen-shi-xing-ming')}
               onChangeText={(val) => setrealName(val)}
             />
           </Div>

+ 3 - 3
wallet/MineRecordScreen.tsx

@@ -73,7 +73,7 @@ export default function MineRecordScreen({ navigation }: StackScreenProps) {
 
   navigation.setOptions({
     headerTitle: () => {
-      let name = '我的对账单';
+      let name = t('wo-de-dui-zhang-dan');
       if (type !== 'all') {
         name += '(' + t(FinancialType.get(type).name) + ')';
       }
@@ -171,7 +171,7 @@ export default function MineRecordScreen({ navigation }: StackScreenProps) {
             <>
               {!data.empty && (
                 <Text p={15} textAlign="center">
-                  {data.last ? '到底了' : '加载中...'}
+                  {data.last ? t('dao-di-le') : t('jia-zai-zhong')}
                 </Text>
               )}
             </>
@@ -183,7 +183,7 @@ export default function MineRecordScreen({ navigation }: StackScreenProps) {
             <>
               {data.empty && (
                 <Text textAlign="center" p={15}>
-                  无数据
+                  {t('wu-shu-ju')}
                 </Text>
               )}
             </>