|
|
@@ -3,116 +3,81 @@ import * as React from 'react';
|
|
|
import { StyleSheet } from 'react-native';
|
|
|
import { Flex, WingBlank } from '@ant-design/react-native';
|
|
|
import { Card } from 'react-native-paper';
|
|
|
+import useModel from 'flooks';
|
|
|
+import HomeModel from './model';
|
|
|
import Text from '../../../components/Text';
|
|
|
+import CountDown from '../../../components/CountDown ';
|
|
|
|
|
|
// 优惠专区
|
|
|
export default function SpecialArea() {
|
|
|
+ const { promote1, promote2, timeTag } = useModel(HomeModel);
|
|
|
+ const promote1Card = (list) => {
|
|
|
+ return list.map((item) => {
|
|
|
+ const merchant = item.merchant || {};
|
|
|
+ return (
|
|
|
+ <Flex.Item key={item.id} style={{ paddingHorizontal: 1.5 }}>
|
|
|
+ <Card>
|
|
|
+ <Card.Cover
|
|
|
+ style={styles.image}
|
|
|
+ resizeMode="cover"
|
|
|
+ source={{ uri: merchant.logo }}
|
|
|
+ />
|
|
|
+ <Card.Content>
|
|
|
+ <Text size="s1">{merchant.name}</Text>
|
|
|
+ <Text size="c2">
|
|
|
+ 倒计时
|
|
|
+ <CountDown
|
|
|
+ endTime={item.endDateTime}
|
|
|
+ format="yyyy-MM-DD HH:mm:ss"
|
|
|
+ valueFormat="D天 HH时mm分ss秒"
|
|
|
+ size="c2"
|
|
|
+ type="error"
|
|
|
+ />
|
|
|
+ </Text>
|
|
|
+ </Card.Content>
|
|
|
+ </Card>
|
|
|
+ </Flex.Item>
|
|
|
+ );
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ const promote2Card = (list) => {
|
|
|
+ return list.map((item) => {
|
|
|
+ const merchant = item.merchant || {};
|
|
|
+ return (
|
|
|
+ <Flex.Item key={item.id} style={{ paddingHorizontal: 1.5 }}>
|
|
|
+ <Card>
|
|
|
+ <Card.Cover
|
|
|
+ style={styles.image2}
|
|
|
+ resizeMode="cover"
|
|
|
+ source={{ uri: merchant.logo }}
|
|
|
+ />
|
|
|
+ <Card.Content style={styles.main2}>
|
|
|
+ <Text size="c2">{merchant.name}</Text>
|
|
|
+ </Card.Content>
|
|
|
+ </Card>
|
|
|
+ </Flex.Item>
|
|
|
+ );
|
|
|
+ });
|
|
|
+ };
|
|
|
return (
|
|
|
<>
|
|
|
<WingBlank style={{ marginTop: 10, marginBottom: 5 }}>
|
|
|
<Text size="s1" bold>
|
|
|
优惠专区
|
|
|
</Text>
|
|
|
- <Flex style={styles.content}>
|
|
|
- <Flex.Item style={{ paddingHorizontal: 1.5 }}>
|
|
|
- <Card>
|
|
|
- <Card.Cover
|
|
|
- style={styles.image}
|
|
|
- resizeMode="cover"
|
|
|
- source={{ uri: 'https://picsum.photos/700' }}
|
|
|
- />
|
|
|
- <Card.Content>
|
|
|
- <Text size="s1">麦当劳(奥体大街)</Text>
|
|
|
- <Text size="c2">
|
|
|
- 倒计时
|
|
|
- <Text size="c2" type="error">
|
|
|
- {' '}
|
|
|
- 15小时20分43秒
|
|
|
- </Text>
|
|
|
- </Text>
|
|
|
- </Card.Content>
|
|
|
- </Card>
|
|
|
- </Flex.Item>
|
|
|
- <Flex.Item style={{ paddingHorizontal: 1.5 }}>
|
|
|
- <Card>
|
|
|
- <Card.Cover
|
|
|
- style={styles.image}
|
|
|
- resizeMode="cover"
|
|
|
- source={{ uri: 'https://picsum.photos/700' }}
|
|
|
- />
|
|
|
- <Card.Content>
|
|
|
- <Text size="s1">麦当劳(奥体大街)</Text>
|
|
|
- <Text size="c2">
|
|
|
- 倒计时
|
|
|
- <Text size="c2" type="error">
|
|
|
- {' '}
|
|
|
- 15小时20分43秒
|
|
|
- </Text>
|
|
|
- </Text>
|
|
|
- </Card.Content>
|
|
|
- </Card>
|
|
|
- </Flex.Item>
|
|
|
- </Flex>
|
|
|
- <Flex style={styles.content2}>
|
|
|
- <Flex.Item style={{ paddingHorizontal: 1.5 }}>
|
|
|
- <Card>
|
|
|
- <Card.Cover
|
|
|
- style={styles.image2}
|
|
|
- resizeMode="cover"
|
|
|
- source={{ uri: 'https://picsum.photos/700' }}
|
|
|
- />
|
|
|
- <Card.Content style={styles.main2}>
|
|
|
- <Text size="c2">麦当劳(奥体大街)</Text>
|
|
|
- </Card.Content>
|
|
|
- </Card>
|
|
|
- </Flex.Item>
|
|
|
- <Flex.Item style={{ paddingHorizontal: 1.5 }}>
|
|
|
- <Card>
|
|
|
- <Card.Cover
|
|
|
- style={styles.image2}
|
|
|
- resizeMode="cover"
|
|
|
- source={{ uri: 'https://picsum.photos/700' }}
|
|
|
- />
|
|
|
- <Card.Content style={styles.main2}>
|
|
|
- <Text size="c2">麦当劳(奥体大街)</Text>
|
|
|
- </Card.Content>
|
|
|
- </Card>
|
|
|
- </Flex.Item>
|
|
|
- <Flex.Item style={{ paddingHorizontal: 1.5 }}>
|
|
|
- <Card>
|
|
|
- <Card.Cover
|
|
|
- style={styles.image2}
|
|
|
- resizeMode="cover"
|
|
|
- source={{ uri: 'https://picsum.photos/700' }}
|
|
|
- />
|
|
|
- <Card.Content style={styles.main2}>
|
|
|
- <Text size="c2">麦当劳(奥体大街)</Text>
|
|
|
- </Card.Content>
|
|
|
- </Card>
|
|
|
- </Flex.Item>
|
|
|
- <Flex.Item style={{ paddingHorizontal: 1.5 }}>
|
|
|
- <Card>
|
|
|
- <Card.Cover
|
|
|
- style={styles.image2}
|
|
|
- resizeMode="cover"
|
|
|
- source={{ uri: 'https://picsum.photos/700' }}
|
|
|
- />
|
|
|
- <Card.Content style={styles.main2}>
|
|
|
- <Text size="c2">麦当劳(奥体大街)</Text>
|
|
|
- </Card.Content>
|
|
|
- </Card>
|
|
|
- </Flex.Item>
|
|
|
- </Flex>
|
|
|
+ <Flex style={styles.content}>{promote1Card(promote1)}</Flex>
|
|
|
+ <Flex style={styles.content2}>{promote2Card(promote2)}</Flex>
|
|
|
</WingBlank>
|
|
|
<WingBlank style={{ marginTop: 15, marginBottom: 5 }}>
|
|
|
<Text size="s1" bold>
|
|
|
- 优惠专区2
|
|
|
+ 优惠专区
|
|
|
</Text>
|
|
|
|
|
|
<Card.Cover
|
|
|
style={styles.imageMain}
|
|
|
resizeMode="cover"
|
|
|
- source={{ uri: 'https://picsum.photos/700' }}
|
|
|
+ source={{ uri: timeTag.icon }}
|
|
|
/>
|
|
|
</WingBlank>
|
|
|
</>
|