|
|
@@ -1,19 +1,19 @@
|
|
|
import * as WebBrowser from 'expo-web-browser';
|
|
|
import * as React from 'react';
|
|
|
-import { StyleSheet, View, Image } from 'react-native';
|
|
|
+import { StyleSheet, View } from 'react-native';
|
|
|
+import { Div, Text, Image } from 'react-native-magnus';
|
|
|
import { Flex } from '@ant-design/react-native';
|
|
|
import { TouchableRipple } from 'react-native-paper';
|
|
|
import { useCreation } from '@umijs/hooks';
|
|
|
import { useNavigation } from '@react-navigation/native';
|
|
|
-import Text from '../../../components/Text';
|
|
|
import Chip from '../../../components/Chip';
|
|
|
import Icon from '../../../components/SvgIcon';
|
|
|
|
|
|
// 首页商家组件
|
|
|
|
|
|
export default function MerchantCom(props) {
|
|
|
- const { info } = props;
|
|
|
-
|
|
|
+ const { info, isCollection, id } = props;
|
|
|
+ console.log(isCollection);
|
|
|
const navigation = useNavigation();
|
|
|
|
|
|
const {
|
|
|
@@ -29,7 +29,7 @@ export default function MerchantCom(props) {
|
|
|
badNum,
|
|
|
preparationTime,
|
|
|
mid,
|
|
|
- } = info;
|
|
|
+ } = info || { showName: '' };
|
|
|
|
|
|
const tags = useCreation(() => {
|
|
|
let list = [];
|
|
|
@@ -51,89 +51,107 @@ export default function MerchantCom(props) {
|
|
|
const long = useCreation(() => {
|
|
|
if (distance < 1000) {
|
|
|
return `${distance}米`;
|
|
|
- } else {
|
|
|
+ } else if (distance) {
|
|
|
return `${(distance / 1000).toFixed(1)}km`;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
}
|
|
|
}, [distance]);
|
|
|
|
|
|
return (
|
|
|
- <TouchableRipple
|
|
|
- onPress={() => {
|
|
|
- navigation.navigate('MerchantDetail', {
|
|
|
- merchantId: mid,
|
|
|
- });
|
|
|
- }}
|
|
|
- >
|
|
|
- <Flex align="start" style={styles.merchant}>
|
|
|
- <Image style={styles.image} resizeMode="cover" source={{ uri: logo }} />
|
|
|
- <Flex.Item style={styles.main}>
|
|
|
- <Text size="s1" bold>
|
|
|
- {showName}
|
|
|
- </Text>
|
|
|
- {tags.length > 0 && (
|
|
|
+ <Div my={isCollection ? 5 : 0}>
|
|
|
+ <TouchableRipple
|
|
|
+ onPress={() => {
|
|
|
+ navigation.navigate('MerchantDetail', {
|
|
|
+ merchantId: isCollection ? info.id : mid,
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <Div row px={10} pt={10} bg="white">
|
|
|
+ <Image
|
|
|
+ w={67}
|
|
|
+ h={67}
|
|
|
+ bg="gray200"
|
|
|
+ rounded="sm"
|
|
|
+ source={{ uri: logo }}
|
|
|
+ />
|
|
|
+ <Div
|
|
|
+ flex={1}
|
|
|
+ ml={10}
|
|
|
+ pb={4}
|
|
|
+ borderColor="gray300"
|
|
|
+ borderBottomWidth={1}
|
|
|
+ >
|
|
|
+ <Text size="xl" bold>
|
|
|
+ {showName}
|
|
|
+ </Text>
|
|
|
+ {tags.length > 0 && (
|
|
|
+ <Flex>
|
|
|
+ {tags.map((item, index) => {
|
|
|
+ return <Chip key={index}>{item.name}</Chip>;
|
|
|
+ })}
|
|
|
+ </Flex>
|
|
|
+ )}
|
|
|
+
|
|
|
<Flex>
|
|
|
- {tags.map((item, index) => {
|
|
|
- return <Chip key={index}>{item.name}</Chip>;
|
|
|
- })}
|
|
|
+ <Flex>
|
|
|
+ <Icon name="zan" type="primary" width={18} height={18} />
|
|
|
+ <Text fontSize="sm" color="brand500">
|
|
|
+ {goodNum || 0}
|
|
|
+ </Text>
|
|
|
+ </Flex>
|
|
|
+ <Flex style={styles.text}>
|
|
|
+ <Icon name="zan" Flip color="#000" width={18} height={18} />
|
|
|
+ <Text fontSize="sm" color="gray300">
|
|
|
+ {badNum || 0}
|
|
|
+ </Text>
|
|
|
+ </Flex>
|
|
|
+ <Flex style={styles.text}>
|
|
|
+ <Text size="c1" color="gray300">
|
|
|
+ 月售
|
|
|
+ {monthSales}
|
|
|
+ </Text>
|
|
|
+ </Flex>
|
|
|
</Flex>
|
|
|
- )}
|
|
|
-
|
|
|
- <Flex>
|
|
|
<Flex>
|
|
|
- <Icon name="zan" type="primary" width={18} height={18} />
|
|
|
- <Text size="c1" type="primary">
|
|
|
- {goodNum || 0}
|
|
|
+ <Text fontSize="sm" color="gray300">
|
|
|
+ 起送$
|
|
|
+ {startingAmount || 0}
|
|
|
</Text>
|
|
|
- </Flex>
|
|
|
- <Flex style={styles.text}>
|
|
|
- <Icon name="zan" Flip color="#000" width={18} height={18} />
|
|
|
- <Text size="c1" type="info">
|
|
|
- {badNum || 0}
|
|
|
+ <Flex.Item style={styles.text}>
|
|
|
+ <Text fontSize="sm" color="gray300">
|
|
|
+ 配送$ 10
|
|
|
+ </Text>
|
|
|
+ </Flex.Item>
|
|
|
+ <Text fontSize="sm" color="gray300">
|
|
|
+ {preparationTime || 60}
|
|
|
+ 分钟
|
|
|
</Text>
|
|
|
+ {!!long && (
|
|
|
+ <View style={styles.text}>
|
|
|
+ <Text fontSize="sm" color="gray300">
|
|
|
+ {long}
|
|
|
+ </Text>
|
|
|
+ </View>
|
|
|
+ )}
|
|
|
</Flex>
|
|
|
- <Flex style={styles.text}>
|
|
|
- <Text size="c1" type="info">
|
|
|
- 月售
|
|
|
- {monthSales}
|
|
|
- </Text>
|
|
|
+ <Flex style={styles.label2}>
|
|
|
+ <Chip size="mini" color="#FFE3B9" fontColor="#FF0000">
|
|
|
+ “喜欢您来金拱门喜欢您来金拱门”
|
|
|
+ </Chip>
|
|
|
+ <Chip size="mini" color="#FFE3B9" fontColor="#FF0000">
|
|
|
+ “喜欢您来金拱门喜欢您来金拱门”
|
|
|
+ </Chip>
|
|
|
</Flex>
|
|
|
- </Flex>
|
|
|
- <Flex>
|
|
|
- <Text size="c1" type="info">
|
|
|
- 起送$
|
|
|
- {startingAmount || 0}
|
|
|
- </Text>
|
|
|
- <Flex.Item style={styles.text}>
|
|
|
- <Text size="c1" type="info">
|
|
|
- 配送$ 10
|
|
|
- </Text>
|
|
|
- </Flex.Item>
|
|
|
- <Text size="c1" type="info">
|
|
|
- {preparationTime || 60}
|
|
|
- 分钟
|
|
|
- </Text>
|
|
|
- <View style={styles.text}>
|
|
|
- <Text size="c1" type="info">
|
|
|
- {long}
|
|
|
- </Text>
|
|
|
- </View>
|
|
|
- </Flex>
|
|
|
- <Flex style={styles.label2}>
|
|
|
- <Chip size="mini" color="#FFE3B9" fontColor="#FF0000">
|
|
|
- “喜欢您来金拱门喜欢您来金拱门”
|
|
|
- </Chip>
|
|
|
- <Chip size="mini" color="#FFE3B9" fontColor="#FF0000">
|
|
|
- “喜欢您来金拱门喜欢您来金拱门”
|
|
|
- </Chip>
|
|
|
- </Flex>
|
|
|
- <Flex style={styles.label2} wrap="wrap">
|
|
|
- <Chip size="mini" outline color="#FF0000">
|
|
|
- 12减5
|
|
|
- </Chip>
|
|
|
- </Flex>
|
|
|
- </Flex.Item>
|
|
|
- </Flex>
|
|
|
- </TouchableRipple>
|
|
|
+ <Flex style={styles.label2} wrap="wrap">
|
|
|
+ <Chip size="mini" outline color="#FF0000">
|
|
|
+ 12减5
|
|
|
+ </Chip>
|
|
|
+ </Flex>
|
|
|
+ </Div>
|
|
|
+ </Div>
|
|
|
+ </TouchableRipple>
|
|
|
+ </Div>
|
|
|
);
|
|
|
}
|
|
|
|