IntroduceRow.js 4.71 KB
Newer Older
陈帅's avatar
陈帅 committed
1 2
import React, { memo } from 'react';
import { Row, Col, Icon, Tooltip } from 'antd';
陈帅's avatar
陈帅 committed
3
import { FormattedMessage } from 'umi-plugin-react/locale';
4
import { Charts, Trend } from 'ant-design-pro';
陈帅's avatar
陈帅 committed
5
import numeral from 'numeral';
6 7 8 9
import styles from '../style.less';
import Yuan from '../utils/Yuan';

const { ChartCard, MiniArea, MiniBar, MiniProgress, Field } = Charts;
陈帅's avatar
陈帅 committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

const topColResponsiveProps = {
  xs: 24,
  sm: 12,
  md: 12,
  lg: 12,
  xl: 6,
  style: { marginBottom: 24 },
};

const IntroduceRow = memo(({ loading, visitData }) => (
  <Row gutter={24}>
    <Col {...topColResponsiveProps}>
      <ChartCard
        bordered={false}
xiaohuoni's avatar
xiaohuoni committed
25 26 27
        title={
          <FormattedMessage id="BLOCK_NAME.analysis.total-sales" defaultMessage="Total Sales" />
        }
陈帅's avatar
陈帅 committed
28 29
        action={
          <Tooltip
xiaohuoni's avatar
xiaohuoni committed
30 31 32
            title={
              <FormattedMessage id="BLOCK_NAME.analysis.introduce" defaultMessage="Introduce" />
            }
陈帅's avatar
陈帅 committed
33 34 35 36 37 38 39 40
          >
            <Icon type="info-circle-o" />
          </Tooltip>
        }
        loading={loading}
        total={() => <Yuan>126560</Yuan>}
        footer={
          <Field
xiaohuoni's avatar
xiaohuoni committed
41 42 43
            label={
              <FormattedMessage id="BLOCK_NAME.analysis.day-sales" defaultMessage="Daily Sales" />
            }
陈帅's avatar
陈帅 committed
44 45 46 47 48 49
            value={`¥${numeral(12423).format('0,0')}`}
          />
        }
        contentHeight={46}
      >
        <Trend flag="up" style={{ marginRight: 16 }}>
50
          <FormattedMessage id="BLOCK_NAME.analysis.week" defaultMessage="Weekly Changes" />
陈帅's avatar
陈帅 committed
51 52 53
          <span className={styles.trendText}>12%</span>
        </Trend>
        <Trend flag="down">
54
          <FormattedMessage id="BLOCK_NAME.analysis.day" defaultMessage="Daily Changes" />
陈帅's avatar
陈帅 committed
55 56 57 58 59 60 61 62 63
          <span className={styles.trendText}>11%</span>
        </Trend>
      </ChartCard>
    </Col>

    <Col {...topColResponsiveProps}>
      <ChartCard
        bordered={false}
        loading={loading}
64
        title={<FormattedMessage id="BLOCK_NAME.analysis.visits" defaultMessage="Visits" />}
陈帅's avatar
陈帅 committed
65 66
        action={
          <Tooltip
xiaohuoni's avatar
xiaohuoni committed
67 68 69
            title={
              <FormattedMessage id="BLOCK_NAME.analysis.introduce" defaultMessage="Introduce" />
            }
陈帅's avatar
陈帅 committed
70 71 72 73 74 75 76
          >
            <Icon type="info-circle-o" />
          </Tooltip>
        }
        total={numeral(8846).format('0,0')}
        footer={
          <Field
xiaohuoni's avatar
xiaohuoni committed
77 78 79
            label={
              <FormattedMessage id="BLOCK_NAME.analysis.day-visits" defaultMessage="Daily Visits" />
            }
陈帅's avatar
陈帅 committed
80 81 82 83 84 85 86 87 88 89 90 91
            value={numeral(1234).format('0,0')}
          />
        }
        contentHeight={46}
      >
        <MiniArea color="#975FE4" data={visitData} />
      </ChartCard>
    </Col>
    <Col {...topColResponsiveProps}>
      <ChartCard
        bordered={false}
        loading={loading}
92
        title={<FormattedMessage id="BLOCK_NAME.analysis.payments" defaultMessage="Payments" />}
陈帅's avatar
陈帅 committed
93 94
        action={
          <Tooltip
xiaohuoni's avatar
xiaohuoni committed
95 96 97
            title={
              <FormattedMessage id="BLOCK_NAME.analysis.introduce" defaultMessage="Introduce" />
            }
陈帅's avatar
陈帅 committed
98 99 100 101 102 103 104 105 106
          >
            <Icon type="info-circle-o" />
          </Tooltip>
        }
        total={numeral(6560).format('0,0')}
        footer={
          <Field
            label={
              <FormattedMessage
107
                id="BLOCK_NAME.analysis.conversion-rate"
陈帅's avatar
陈帅 committed
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
                defaultMessage="Conversion Rate"
              />
            }
            value="60%"
          />
        }
        contentHeight={46}
      >
        <MiniBar data={visitData} />
      </ChartCard>
    </Col>
    <Col {...topColResponsiveProps}>
      <ChartCard
        loading={loading}
        bordered={false}
        title={
          <FormattedMessage
125
            id="BLOCK_NAME.analysis.operational-effect"
陈帅's avatar
陈帅 committed
126 127 128 129 130
            defaultMessage="Operational Effect"
          />
        }
        action={
          <Tooltip
xiaohuoni's avatar
xiaohuoni committed
131 132 133
            title={
              <FormattedMessage id="BLOCK_NAME.analysis.introduce" defaultMessage="Introduce" />
            }
陈帅's avatar
陈帅 committed
134 135 136 137 138 139 140 141
          >
            <Icon type="info-circle-o" />
          </Tooltip>
        }
        total="78%"
        footer={
          <div style={{ whiteSpace: 'nowrap', overflow: 'hidden' }}>
            <Trend flag="up" style={{ marginRight: 16 }}>
142
              <FormattedMessage id="BLOCK_NAME.analysis.week" defaultMessage="Weekly Changes" />
陈帅's avatar
陈帅 committed
143 144 145
              <span className={styles.trendText}>12%</span>
            </Trend>
            <Trend flag="down">
146
              <FormattedMessage id="BLOCK_NAME.analysis.day" defaultMessage="Weekly Changes" />
陈帅's avatar
陈帅 committed
147 148 149 150
              <span className={styles.trendText}>11%</span>
            </Trend>
          </div>
        }
Anderson's avatar
Anderson committed
151
        contentHeight={46}
陈帅's avatar
陈帅 committed
152 153 154 155 156 157 158 159
      >
        <MiniProgress percent={78} strokeWidth={8} target={80} color="#13C2C2" />
      </ChartCard>
    </Col>
  </Row>
));

export default IntroduceRow;