浏览代码

版本07.08.1

panhui 5 年之前
父节点
当前提交
5f49b15b2f

+ 1 - 1
App.js

@@ -53,7 +53,7 @@ export default function App() {
           routes: [
             {
               name: initName,
-              // name: 'MerchantDetail',
+              // name: 'ReportBusiness',
             },
           ],
         })

+ 3 - 0
Utils/MerchantUtils.js

@@ -72,4 +72,7 @@ const tagMap = new Map([
   ],
 ]);
 
+
+
+
 export { popularTagMap, tagMap };

+ 3 - 1
navigation/BaseNavigator.jsx

@@ -9,6 +9,7 @@ import MerchantDetailMerchant from '../screens/Detail/Merchant';
 import SubmitScreen from '../screens/Detail/SubmitScreen';
 import OrderCoupon from '../screens/userCoupon/OrderCouponScreen';
 import OrderMessage from '../screens/Order/OrderMessageScreen';
+import ReportBusinessScreen from '../screens/Detail/ReportBusinessScreen';
 
 // 订单
 import OrderDetail from '../screens/Order/OrderDetailScreen';
@@ -67,6 +68,8 @@ export default function BasicScreens(Screen) {
         name="MerchantDetailMerchant"
         component={MerchantDetailMerchant}
       />
+      {/* 举报商家 */}
+      <Screen name="ReportBusiness" component={ReportBusinessScreen} />
       {/* 提交订单 */}
       <Screen name="Submit" component={SubmitScreen} />
       {/* 订单优惠券 */}
@@ -115,7 +118,6 @@ export default function BasicScreens(Screen) {
       <Screen name="HomeAddress" component={HomeAddress} />
       {/* 新店推荐 */}
       <Screen name="MerchantsList" component={MerchantsList} />
-
       <Screen name="SearchMap" component={SearchMap} />
       <Screen name="MapScreen" component={MapScreen} />
       <Screen name="MapMarkScreen" component={MapMarkScreen} />

+ 11 - 2
screens/Detail/Merchant.jsx

@@ -6,8 +6,7 @@ import { ScrollView } from 'react-native-gesture-handler';
 import { useCreation, useRequest } from '@umijs/hooks';
 import useModel from 'flooks';
 import Detail from './model';
-
-import DetailHeader from './DetailHeader';
+import { navigate } from '../../navigation/RootNavigation';
 
 export default function Merchant() {
   const { merchantInfo } = useModel(Detail, ['merchantInfo']);
@@ -89,6 +88,16 @@ export default function Merchant() {
           </Text>
         </Div>
       </Div>
+      <Button
+        bg="brand500"
+        block
+        mx={15}
+        mt={10}
+        mb={20}
+        onPress={() => navigate('ReportBusiness')}
+      >
+        举报商家
+      </Button>
     </>
   );
 }

+ 3 - 1
screens/Detail/MerchantDetailScreen.jsx

@@ -51,7 +51,7 @@ export default function MerchantDetail({ navigation }) {
       y: tabTop,
       animated: true,
     });
-  }, 1500);
+  }, 1200);
 
   React.useEffect(() => {
     if (params.merchantId) {
@@ -59,6 +59,8 @@ export default function MerchantDetail({ navigation }) {
     }
     if (params.screen) {
       setscreenName(params.screen);
+    } else {
+      setscreenName('Order');
     }
   }, [params]);
 

+ 181 - 0
screens/Detail/ReportBusinessScreen.jsx

@@ -0,0 +1,181 @@
+import * as WebBrowser from 'expo-web-browser';
+import * as React from 'react';
+import {
+  Div,
+  Button,
+  Image,
+  Text,
+  Avatar,
+  Radio,
+  RadioGroup,
+} from 'react-native-magnus';
+import { TextareaItem } from '@ant-design/react-native';
+
+import { ScrollView } from 'react-native-gesture-handler';
+import { useCreation } from '@umijs/hooks';
+import useModel from 'flooks';
+import User from '../../flooks/User'; // detail模块通用方法
+import DetailModel from './model'; // detail模块通用方法
+import Order from '../Order/model';
+
+import Header from '../../components/Header';
+import ImagePicker from '../../components/ImagePicker';
+
+const reasomsMap = new Map([
+  [
+    '商家资质问题(缺少相关从业资质)',
+    { name: '商家资质问题(缺少相关从业资质)' },
+  ],
+  [
+    '商家价格问题(价格虚高恶意设置高满减)',
+    { name: '商家价格问题(价格虚高恶意设置高满减)' },
+  ],
+  ['商家品类问题(品类设置不符)', { name: '商家品类问题(品类设置不符)' }],
+  ['商家logo问题(涉及侵权)', { name: '商家logo问题(涉及侵权)' }],
+  [
+    '商家配送问题(起送价、餐盒费设置过高)',
+    { name: '商家配送问题(起送价、餐盒费设置过高)' },
+  ],
+  ['其它问题', { name: '其它问题' }],
+]);
+
+export default function ReportBusinessScreen({ navigation }) {
+  const { merchantInfo } = useModel(DetailModel, ['merchantInfo']);
+  const { complaintSave } = useModel(Order, []);
+  const { logo, showName, mid } = merchantInfo;
+
+  const [type, settype] = React.useState('商家资质问题(缺少相关从业资质)');
+
+  const [imgList, setimgList] = React.useState(['']);
+  const [content, setcontent] = React.useState('');
+
+  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 canSubmit = useCreation(() => {
+    if (type && content) {
+      return true;
+    } else {
+      return false;
+    }
+  }, [type, content, imgList]);
+
+  function submit() {
+    const img = [...imgList].filter((item) => {
+      return item;
+    });
+    complaintSave('', 'MERCHANT', type, content, img.join(',')).then(() => {
+      navigation.goBack();
+    });
+  }
+
+  return (
+    <>
+      <Header title="举报商家" />
+      <ScrollView
+        contentContainerStyle={{
+          flexGrow: 1,
+          backgroundColor: '#fff',
+        }}
+      >
+        <Div bg="white" px={15} py={5}>
+          <Div
+            row
+            alignItems="center"
+            py={15}
+            borderBottomWidth={1}
+            borderColor="gray200"
+          >
+            <Image w={33} h={33} rounded="sm" source={{ uri: logo }} />
+            <Text fontSize="xl" fontWeight="bold" ml={10}>
+              {showName}
+            </Text>
+          </Div>
+
+          <Div py={5} borderBottomWidth={1} borderColor="gray200">
+            <Text py={5} fontSize="xs">
+              举报商家存在如下问题:
+            </Text>
+            <RadioGroup value={type} onChange={(value: any) => settype(value)}>
+              {[...reasomsMap.keys()].map((item, index) => {
+                return (
+                  <Radio
+                    key={index}
+                    value={item}
+                    activeColor="brand500"
+                    inactiveColor="gray300"
+                    py={5}
+                  >
+                    <Text
+                      color={item === type ? 'brand500' : 'gray300'}
+                      fontSize="xs"
+                      ml={10}
+                    >
+                      {reasomsMap.get(item).name}
+                    </Text>
+                  </Radio>
+                );
+              })}
+            </RadioGroup>
+          </Div>
+          <Div row py={10}>
+            {imgList.map((item, index) => {
+              return (
+                <ImagePicker
+                  key={index}
+                  img={item}
+                  setImg={(img) => changeImg(img, index)}
+                  cancelEvent={deleteImg(index)}
+                />
+              );
+            })}
+          </Div>
+          <Div mb={10}>
+            <TextareaItem
+              rows={4}
+              placeholder="可补充具体投诉内容,您的投诉真实性对我们的处理至关重要"
+              count={50}
+              style={{
+                backgroundColor: '#eeeeee',
+                paddingVertical: 10,
+                fontSize: 10,
+                borderBottomWidth: 0,
+              }}
+              onChange={setcontent}
+            />
+          </Div>
+          <Button
+            block
+            bg="brand500"
+            color="white"
+            my={10}
+            mx={20}
+            onPress={submit}
+            disabled={!canSubmit}
+          >
+            提交
+          </Button>
+        </Div>
+      </ScrollView>
+    </>
+  );
+}

+ 1 - 1
screens/Detail/model.js

@@ -213,7 +213,7 @@ const DetailModel = (now) => ({
     const { cartRequest } = now();
     if (cartRequest) {
       cartRequest.refresh();
-      now({  remark: '', tablewareNum: 1 });
+      now({ remark: '', tablewareNum: 1 });
     }
   },
 });

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

@@ -93,7 +93,7 @@ export default function Header() {
             }}
             title={local ? TchangeToChinese : TchangeToth}
           />
-          <Menu.Item onPress={() => {}} title="版本06.28.1" />
+          <Menu.Item onPress={() => {}} title="版本07.08.1" />
         </Menu>
       </Appbar.Header>
     </>

+ 11 - 9
screens/Main/Home/RecommendStore.jsx

@@ -10,15 +10,17 @@ import HomeModel from './model';
 
 function CardCom({ info, onPress }) {
   return (
-    <Div px={5} flex={1} alignItems="center">
-      <Image w={46} h={46} rounded="xs" source={{ uri: info.logo }} />
-      <Text fontSize="xs" textAlign="center" color="gray300">
-        {info.showName}
-      </Text>
-      <Text fontSize="xs" textAlign="center" color="red500">
-        1.1km
-      </Text>
-    </Div>
+    <Button bg="hide" block flex={1} onPress={onPress}>
+      <Div px={5} flex={1} alignItems="center">
+        <Image w={46} h={46} rounded="xs" source={{ uri: info.logo }} />
+        <Text fontSize="xs" textAlign="center" color="gray300">
+          {info.showName}
+        </Text>
+        <Text fontSize="xs" textAlign="center" color="red500">
+          1.1km
+        </Text>
+      </Div>
+    </Button>
   );
 }
 

+ 5 - 48
screens/Map/SearchMapScreen.jsx

@@ -22,50 +22,10 @@ import Header from '../../components/Header';
 import { alert } from '../../Utils/TotastUtils';
 
 export default function MapScreen({ navigation }) {
-  const { changeChooseInfo } = useModel(MapModel, []);
-  const html = `
-<head lang="zh-CN">
-	<meta charset="UTF-8">
-	<meta name="viewport"
-		content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
-	<meta name="mobile-web-app-capable" content="yes">
-	<meta name="apple-mobile-web-app-capable" content="yes">
-	<meta name="apple-mobile-web-app-status-bar-style" content="black">
-	<meta name="format-detection" content="address=no">
-	<script type="text/javascript"
-		src="https://3gimg.qq.com/lightmap/components/locationPicker2/js/main-62c2e3b971.js"></script>
-	<title>locationPicker Components Demo - iframe</title>
-	<style>
-		* {
-			margin: 0;
-			padding: 0;
-		}
-
-		body,
-		html {
-			overflow: hidden;
-		}
-	</style>
-
-</head>
-
-<body>
-	<!-- 通过 iframe 嵌入地图选点组件 -->
-	<iframe id="iframe" style="width:100vw;height:100vh" frameborder=0 scrolling="no"
-		src="https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=GLFBZ-ZR2W6-76XSA-MF7CQ-GDJ6Z-6FB5K&referer=Dingdong">
-	</iframe>
-
-	<script>
-
-		window.addEventListener('message', function (event) {
-			var loc = event.data;
-			window.ReactNativeWebView.postMessage(JSON.stringify(loc))
-		}, false);
-
-
-	</script>
-</body>
-	`;
+  const { locationInfo, changeChooseInfo } = useModel(MapModel, [
+    'locationInfo',
+  ]);
+  const { location } = locationInfo;
   return (
     <>
       <StatusBar backgroundColor="#fff" style="dark" translucent />
@@ -91,7 +51,7 @@ export default function MapScreen({ navigation }) {
       </Appbar.Header>
       <WebView
         source={{
-          html,
+          uri: `http://dingdong.izouma.com/map/chooseLocation?location=${location.lat},${location.lng}`,
         }}
         style={{ flexGrow: 1, width: '100%' }}
         onMessage={({ nativeEvent }) => {
@@ -101,9 +61,6 @@ export default function MapScreen({ navigation }) {
             location: info.latlng,
           });
           navigation.navigate('Home');
-          // alert('', `您当前选择的是:${info.poiaddress}`, () => {
-          //   navigation.goBack();
-          // });
         }}
       />
     </>

+ 1 - 1
screens/Order/OrderDetailScreen.jsx

@@ -199,7 +199,7 @@ export default function OrderScreen({ navigation }) {
                 rounded={3}
                 onPress={() => {
                   navigation.navigate('MerchantDetail', {
-                    merchantId: order.merchantId,
+                    merchantId: orderInfo.merchantId,
                   });
                 }}
               >