Analysis.js 20.7 KB
Newer Older
jim's avatar
jim committed
1
import React, { Component } from 'react';
2
import { connect } from 'dva';
陈帅's avatar
陈帅 committed
3
import { formatMessage, FormattedMessage } from 'umi/locale';
niko's avatar
niko committed
4 5 6 7 8 9 10 11 12 13 14 15 16
import {
  Row,
  Col,
  Icon,
  Card,
  Tabs,
  Table,
  Radio,
  DatePicker,
  Tooltip,
  Menu,
  Dropdown,
} from 'antd';
偏右's avatar
偏右 committed
17
import {
niko's avatar
niko committed
18 19 20 21 22 23 24 25
  ChartCard,
  MiniArea,
  MiniBar,
  MiniProgress,
  Field,
  Bar,
  Pie,
  TimelineChart,
niko's avatar
niko committed
26 27 28
} from 'components/Charts';
import Trend from 'components/Trend';
import NumberInfo from 'components/NumberInfo';
jim's avatar
jim committed
29
import numeral from 'numeral';
愚道's avatar
愚道 committed
30
import GridContent from '../layouts/GridContent';
jim's avatar
jim committed
31
import Yuan from '../../utils/Yuan';
32 33 34 35
import { getTimeDistance } from '../../utils/utils';

import styles from './Analysis.less';

afc163's avatar
afc163 committed
36
const { TabPane } = Tabs;
37 38 39 40 41 42 43 44 45 46
const { RangePicker } = DatePicker;

const rankingListData = [];
for (let i = 0; i < 7; i += 1) {
  rankingListData.push({
    title: `工专路 ${i} 号店`,
    total: 323234,
  });
}

Andreas Cederström's avatar
Andreas Cederström committed
47 48 49
@connect(({ chart, loading }) => ({
  chart,
  loading: loading.effects['chart/fetch'],
50
}))
ddcat1115's avatar
ddcat1115 committed
51 52 53 54 55 56
class Analysis extends Component {
  constructor(props) {
    super(props);
    this.rankingListData = [];
    for (let i = 0; i < 7; i += 1) {
      this.rankingListData.push({
陈帅's avatar
陈帅 committed
57
        title: formatMessage({ id: 'app.analysis.test' }, { no: i }),
ddcat1115's avatar
ddcat1115 committed
58 59 60 61 62 63 64 65 66
        total: 323234,
      });
    }
    this.state = {
      salesType: 'all',
      currentTabKey: '',
      rangePickerValue: getTimeDistance('year'),
    };
  }
陈帅's avatar
陈帅 committed
67

68 69 70
  state = {
    salesType: 'all',
    currentTabKey: '',
afc163's avatar
afc163 committed
71
    rangePickerValue: getTimeDistance('year'),
niko's avatar
niko committed
72
  };
73 74

  componentDidMount() {
75 76
    const { dispatch } = this.props;
    dispatch({
77
      type: 'chart/fetch',
78
    });
79 80 81 82 83 84 85 86 87
  }

  componentWillUnmount() {
    const { dispatch } = this.props;
    dispatch({
      type: 'chart/clear',
    });
  }

jim's avatar
jim committed
88
  handleChangeSalesType = e => {
89 90 91
    this.setState({
      salesType: e.target.value,
    });
niko's avatar
niko committed
92
  };
93

jim's avatar
jim committed
94
  handleTabChange = key => {
95 96 97
    this.setState({
      currentTabKey: key,
    });
niko's avatar
niko committed
98
  };
99

jim's avatar
jim committed
100
  handleRangePickerChange = rangePickerValue => {
101
    const { dispatch } = this.props;
102 103 104
    this.setState({
      rangePickerValue,
    });
nikogu's avatar
nikogu committed
105

106
    dispatch({
nikogu's avatar
nikogu committed
107 108
      type: 'chart/fetchSalesData',
    });
niko's avatar
niko committed
109
  };
110

jim's avatar
jim committed
111
  selectDate = type => {
112
    const { dispatch } = this.props;
113 114 115 116
    this.setState({
      rangePickerValue: getTimeDistance(type),
    });

117
    dispatch({
118 119
      type: 'chart/fetchSalesData',
    });
niko's avatar
niko committed
120
  };
121

afc163's avatar
afc163 committed
122 123 124 125 126 127
  isActive(type) {
    const { rangePickerValue } = this.state;
    const value = getTimeDistance(type);
    if (!rangePickerValue[0] || !rangePickerValue[1]) {
      return;
    }
niko's avatar
niko committed
128 129 130 131
    if (
      rangePickerValue[0].isSame(value[0], 'day') &&
      rangePickerValue[1].isSame(value[1], 'day')
    ) {
afc163's avatar
afc163 committed
132 133 134 135
      return styles.currentDate;
    }
  }

136
  render() {
137
    const { rangePickerValue, salesType, currentTabKey } = this.state;
Andreas Cederström's avatar
Andreas Cederström committed
138
    const { chart, loading } = this.props;
139 140
    const {
      visitData,
afc163's avatar
afc163 committed
141
      visitData2,
142 143 144 145 146 147 148
      salesData,
      searchData,
      offlineData,
      offlineChartData,
      salesTypeData,
      salesTypeDataOnline,
      salesTypeDataOffline,
afc163's avatar
afc163 committed
149
    } = chart;
150

niko's avatar
niko committed
151 152 153
    const salesPieData =
      salesType === 'all'
        ? salesTypeData
jim's avatar
jim committed
154 155 156
        : salesType === 'online'
          ? salesTypeDataOnline
          : salesTypeDataOffline;
157

afc163's avatar
afc163 committed
158 159 160 161 162 163 164
    const menu = (
      <Menu>
        <Menu.Item>操作一</Menu.Item>
        <Menu.Item>操作二</Menu.Item>
      </Menu>
    );

165 166
    const iconGroup = (
      <span className={styles.iconGroup}>
afc163's avatar
afc163 committed
167 168 169
        <Dropdown overlay={menu} placement="bottomRight">
          <Icon type="ellipsis" />
        </Dropdown>
170 171 172
      </span>
    );

afc163's avatar
afc163 committed
173 174 175
    const salesExtra = (
      <div className={styles.salesExtraWrap}>
        <div className={styles.salesExtra}>
afc163's avatar
afc163 committed
176
          <a className={this.isActive('today')} onClick={() => this.selectDate('today')}>
陈帅's avatar
陈帅 committed
177
            <FormattedMessage id="app.analysis.all-day" defaultMessage="All Day" />
afc163's avatar
afc163 committed
178 179
          </a>
          <a className={this.isActive('week')} onClick={() => this.selectDate('week')}>
陈帅's avatar
陈帅 committed
180
            <FormattedMessage id="app.analysis.all-week" defaultMessage="All Week" />
afc163's avatar
afc163 committed
181 182
          </a>
          <a className={this.isActive('month')} onClick={() => this.selectDate('month')}>
陈帅's avatar
陈帅 committed
183
            <FormattedMessage id="app.analysis.all-month" defaultMessage="All Month" />
afc163's avatar
afc163 committed
184 185
          </a>
          <a className={this.isActive('year')} onClick={() => this.selectDate('year')}>
陈帅's avatar
陈帅 committed
186
            <FormattedMessage id="app.analysis.all-year" defaultMessage="All Year" />
afc163's avatar
afc163 committed
187
          </a>
afc163's avatar
afc163 committed
188 189 190 191 192 193
        </div>
        <RangePicker
          value={rangePickerValue}
          onChange={this.handleRangePickerChange}
          style={{ width: 256 }}
        />
194
      </div>
afc163's avatar
afc163 committed
195
    );
196 197 198

    const columns = [
      {
陈帅's avatar
陈帅 committed
199
        title: <FormattedMessage id="app.analysis.table.rank" defaultMessage="Rank" />,
200 201 202 203
        dataIndex: 'index',
        key: 'index',
      },
      {
陈帅's avatar
陈帅 committed
204 205 206 207 208 209
        title: (
          <FormattedMessage
            id="app.analysis.table.search-keyword"
            defaultMessage="Search keyword"
          />
        ),
210 211 212 213 214
        dataIndex: 'keyword',
        key: 'keyword',
        render: text => <a href="/">{text}</a>,
      },
      {
陈帅's avatar
陈帅 committed
215
        title: <FormattedMessage id="app.analysis.table.users" defaultMessage="Users" />,
216 217 218
        dataIndex: 'count',
        key: 'count',
        sorter: (a, b) => a.count - b.count,
afc163's avatar
afc163 committed
219
        className: styles.alignRight,
220 221
      },
      {
陈帅's avatar
陈帅 committed
222 223 224
        title: (
          <FormattedMessage id="app.analysis.table.weekly-range" defaultMessage="Weekly Range" />
        ),
225 226 227 228
        dataIndex: 'range',
        key: 'range',
        sorter: (a, b) => a.range - b.range,
        render: (text, record) => (
偏右's avatar
偏右 committed
229
          <Trend flag={record.status === 1 ? 'down' : 'up'}>
230 231 232 233
            <span style={{ marginRight: 4 }}>
              {text}
              %
            </span>
偏右's avatar
偏右 committed
234
          </Trend>
235
        ),
afc163's avatar
afc163 committed
236
        align: 'right',
237 238 239
      },
    ];

nikogu's avatar
nikogu committed
240 241
    const activeKey = currentTabKey || (offlineData[0] && offlineData[0].name);

242
    const CustomTab = ({ data, currentTabKey: currentKey }) => (
niko's avatar
niko committed
243
      <Row gutter={8} style={{ width: 138, margin: '8px 0' }}>
244 245 246
        <Col span={12}>
          <NumberInfo
            title={data.name}
陈帅's avatar
陈帅 committed
247 248 249 250 251 252
            subTitle={
              <FormattedMessage
                id="app.analysis.conversion-rate"
                defaultMessage="Conversion Rate"
              />
            }
偏右's avatar
偏右 committed
253 254
            gap={2}
            total={`${data.cvr * 100}%`}
niko's avatar
niko committed
255
            theme={currentKey !== data.name && 'light'}
256 257 258 259
          />
        </Col>
        <Col span={12} style={{ paddingTop: 36 }}>
          <Pie
nikogu's avatar
nikogu committed
260
            animate={false}
niko's avatar
niko committed
261
            color={currentKey !== data.name && '#BDE4FF'}
262 263 264 265 266 267 268 269 270 271 272 273 274
            inner={0.55}
            tooltip={false}
            margin={[0, 0, 0, 0]}
            percent={data.cvr * 100}
            height={64}
          />
        </Col>
      </Row>
    );

    const topColResponsiveProps = {
      xs: 24,
      sm: 12,
niko's avatar
niko committed
275 276 277
      md: 12,
      lg: 12,
      xl: 6,
278 279 280 281
      style: { marginBottom: 24 },
    };

    return (
jim's avatar
jim committed
282
      <GridContent>
283 284 285 286
        <Row gutter={24}>
          <Col {...topColResponsiveProps}>
            <ChartCard
              bordered={false}
陈帅's avatar
陈帅 committed
287 288 289
              title={
                <FormattedMessage id="app.analysis.total-sales" defaultMessage="Total Sales" />
              }
niko's avatar
niko committed
290
              action={
陈帅's avatar
陈帅 committed
291 292 293 294 295
                <Tooltip
                  title={
                    <FormattedMessage id="app.analysis.introduce" defaultMessage="introduce" />
                  }
                >
niko's avatar
niko committed
296 297 298
                  <Icon type="info-circle-o" />
                </Tooltip>
              }
299
              loading={loading}
jim's avatar
jim committed
300
              total={() => <Yuan>126560</Yuan>}
陈帅's avatar
陈帅 committed
301 302 303 304 305 306 307 308
              footer={
                <Field
                  label={
                    <FormattedMessage id="app.analysis.day-sales" defaultMessage="Day Sales" />
                  }
                  value={`¥${numeral(12423).format('0,0')}`}
                />
              }
309 310
              contentHeight={46}
            >
afc163's avatar
afc163 committed
311
              <Trend flag="up" style={{ marginRight: 16 }}>
陈帅's avatar
陈帅 committed
312
                <FormattedMessage id="app.analysis.week" defaultMessage="Weekly Changes" />
313
                <span className={styles.trendText}>12%</span>
afc163's avatar
afc163 committed
314 315
              </Trend>
              <Trend flag="down">
陈帅's avatar
陈帅 committed
316
                <FormattedMessage id="app.analysis.day" defaultMessage="Daily Changes" />
317
                <span className={styles.trendText}>11%</span>
afc163's avatar
afc163 committed
318
              </Trend>
319 320 321 322 323
            </ChartCard>
          </Col>
          <Col {...topColResponsiveProps}>
            <ChartCard
              bordered={false}
陈帅's avatar
陈帅 committed
324
              loading={loading}
陈帅's avatar
陈帅 committed
325
              title={<FormattedMessage id="app.analysis.visits" defaultMessage="visits" />}
niko's avatar
niko committed
326
              action={
陈帅's avatar
陈帅 committed
327 328 329 330 331
                <Tooltip
                  title={
                    <FormattedMessage id="app.analysis.introduce" defaultMessage="introduce" />
                  }
                >
niko's avatar
niko committed
332 333 334
                  <Icon type="info-circle-o" />
                </Tooltip>
              }
335
              total={numeral(8846).format('0,0')}
陈帅's avatar
陈帅 committed
336 337 338 339 340 341 342 343
              footer={
                <Field
                  label={
                    <FormattedMessage id="app.analysis.day-visits" defaultMessage="Day Visits" />
                  }
                  value={numeral(1234).format('0,0')}
                />
              }
344 345
              contentHeight={46}
            >
niko's avatar
niko committed
346
              <MiniArea color="#975FE4" data={visitData} />
347 348 349 350 351
            </ChartCard>
          </Col>
          <Col {...topColResponsiveProps}>
            <ChartCard
              bordered={false}
陈帅's avatar
陈帅 committed
352
              loading={loading}
陈帅's avatar
陈帅 committed
353
              title={<FormattedMessage id="app.analysis.payments" defaultMessage="Payments" />}
niko's avatar
niko committed
354
              action={
陈帅's avatar
陈帅 committed
355 356 357 358 359
                <Tooltip
                  title={
                    <FormattedMessage id="app.analysis.introduce" defaultMessage="Introduce" />
                  }
                >
niko's avatar
niko committed
360 361 362
                  <Icon type="info-circle-o" />
                </Tooltip>
              }
363
              total={numeral(6560).format('0,0')}
陈帅's avatar
陈帅 committed
364 365 366 367 368 369 370 371 372 373 374
              footer={
                <Field
                  label={
                    <FormattedMessage
                      id="app.analysis.conversion-rate"
                      defaultMessage="Conversion Rate"
                    />
                  }
                  value="60%"
                />
              }
375 376
              contentHeight={46}
            >
niko's avatar
niko committed
377
              <MiniBar data={visitData} />
378 379 380 381
            </ChartCard>
          </Col>
          <Col {...topColResponsiveProps}>
            <ChartCard
382
              loading={loading}
383
              bordered={false}
陈帅's avatar
陈帅 committed
384 385 386 387 388 389
              title={
                <FormattedMessage
                  id="app.analysis.operational-effect"
                  defaultMessage="Operational Effect"
                />
              }
niko's avatar
niko committed
390
              action={
陈帅's avatar
陈帅 committed
391 392 393 394 395
                <Tooltip
                  title={
                    <FormattedMessage id="app.analysis.introduce" defaultMessage="introduce" />
                  }
                >
niko's avatar
niko committed
396 397 398
                  <Icon type="info-circle-o" />
                </Tooltip>
              }
399
              total="78%"
afc163's avatar
afc163 committed
400
              footer={
afc163's avatar
afc163 committed
401
                <div style={{ whiteSpace: 'nowrap', overflow: 'hidden' }}>
afc163's avatar
afc163 committed
402
                  <Trend flag="up" style={{ marginRight: 16 }}>
陈帅's avatar
陈帅 committed
403
                    <FormattedMessage id="app.analysis.week" defaultMessage="Weekly changes" />
404
                    <span className={styles.trendText}>12%</span>
afc163's avatar
afc163 committed
405 406
                  </Trend>
                  <Trend flag="down">
陈帅's avatar
陈帅 committed
407
                    <FormattedMessage id="app.analysis.day" defaultMessage="Weekly changes" />
408
                    <span className={styles.trendText}>11%</span>
afc163's avatar
afc163 committed
409
                  </Trend>
偏右's avatar
偏右 committed
410
                </div>
afc163's avatar
afc163 committed
411
              }
412 413
              contentHeight={46}
            >
niko's avatar
niko committed
414
              <MiniProgress percent={78} strokeWidth={8} target={80} color="#13C2C2" />
415 416 417 418
            </ChartCard>
          </Col>
        </Row>

niko's avatar
niko committed
419
        <Card loading={loading} bordered={false} bodyStyle={{ padding: 0 }}>
420
          <div className={styles.salesCard}>
afc163's avatar
afc163 committed
421
            <Tabs tabBarExtraContent={salesExtra} size="large" tabBarStyle={{ marginBottom: 24 }}>
陈帅's avatar
陈帅 committed
422 423 424 425
              <TabPane
                tab={<FormattedMessage id="app.analysis.sales" defaultMessage="Sales" />}
                key="sales"
              >
niko's avatar
niko committed
426
                <Row>
nikogu's avatar
nikogu committed
427
                  <Col xl={16} lg={12} md={12} sm={24} xs={24}>
428
                    <div className={styles.salesBar}>
陈帅's avatar
陈帅 committed
429 430 431 432 433 434 435 436 437 438
                      <Bar
                        height={295}
                        title={
                          <FormattedMessage
                            id="app.analysis.sales-trend"
                            defaultMessage="Sales Trend"
                          />
                        }
                        data={salesData}
                      />
439
                    </div>
440
                  </Col>
nikogu's avatar
nikogu committed
441
                  <Col xl={8} lg={12} md={12} sm={24} xs={24}>
442
                    <div className={styles.salesRank}>
陈帅's avatar
陈帅 committed
443 444 445 446 447 448
                      <h4 className={styles.rankingTitle}>
                        <FormattedMessage
                          id="app.analysis.sales-ranking"
                          defaultMessage="Sales Ranking"
                        />
                      </h4>
449
                      <ul className={styles.rankingList}>
ddcat1115's avatar
ddcat1115 committed
450
                        {this.rankingListData.map((item, i) => (
niko's avatar
niko committed
451 452 453 454 455 456
                          <li key={item.title}>
                            <span className={i < 3 ? styles.active : ''}>{i + 1}</span>
                            <span>{item.title}</span>
                            <span>{numeral(item.total).format('0,0')}</span>
                          </li>
                        ))}
457 458
                      </ul>
                    </div>
459 460 461
                  </Col>
                </Row>
              </TabPane>
陈帅's avatar
陈帅 committed
462 463 464 465
              <TabPane
                tab={<FormattedMessage id="app.analysis.visits" defaultMessage="Visits" />}
                key="views"
              >
陈帅's avatar
陈帅 committed
466
                <Row>
467 468
                  <Col xl={16} lg={12} md={12} sm={24} xs={24}>
                    <div className={styles.salesBar}>
陈帅's avatar
陈帅 committed
469 470 471 472 473 474 475 476 477 478
                      <Bar
                        height={292}
                        title={
                          <FormattedMessage
                            id="app.analysis.visits-trend"
                            defaultMessage="Visits Trend"
                          />
                        }
                        data={salesData}
                      />
479 480 481 482
                    </div>
                  </Col>
                  <Col xl={8} lg={12} md={12} sm={24} xs={24}>
                    <div className={styles.salesRank}>
陈帅's avatar
陈帅 committed
483 484 485 486 487 488
                      <h4 className={styles.rankingTitle}>
                        <FormattedMessage
                          id="app.analysis.visits-ranking"
                          defaultMessage="Visits Ranking"
                        />
                      </h4>
489
                      <ul className={styles.rankingList}>
ddcat1115's avatar
ddcat1115 committed
490
                        {this.rankingListData.map((item, i) => (
niko's avatar
niko committed
491
                          <li key={item.title}>
492
                            <span className={i < 3 ? styles.active : ''}>{i + 1}</span>
niko's avatar
niko committed
493 494 495 496
                            <span>{item.title}</span>
                            <span>{numeral(item.total).format('0,0')}</span>
                          </li>
                        ))}
497 498 499 500
                      </ul>
                    </div>
                  </Col>
                </Row>
501 502 503 504 505 506
              </TabPane>
            </Tabs>
          </div>
        </Card>

        <Row gutter={24}>
507
          <Col xl={12} lg={24} md={24} sm={24} xs={24}>
508
            <Card
509
              loading={loading}
510
              bordered={false}
陈帅's avatar
陈帅 committed
511 512 513 514 515 516
              title={
                <FormattedMessage
                  id="app.analysis.online-top-search"
                  defaultMessage="Online Top Search"
                />
              }
517 518 519 520 521 522
              extra={iconGroup}
              style={{ marginTop: 24 }}
            >
              <Row gutter={68}>
                <Col sm={12} xs={24} style={{ marginBottom: 24 }}>
                  <NumberInfo
afc163's avatar
afc163 committed
523 524
                    subTitle={
                      <span>
陈帅's avatar
陈帅 committed
525 526 527 528 529 530 531 532 533 534 535 536
                        <FormattedMessage
                          id="app.analysis.search-users"
                          defaultMessage="search users"
                        />
                        <Tooltip
                          title={
                            <FormattedMessage
                              id="app.analysis.introduce"
                              defaultMessage="introduce"
                            />
                          }
                        >
afc163's avatar
afc163 committed
537 538 539 540
                          <Icon style={{ marginLeft: 8 }} type="info-circle-o" />
                        </Tooltip>
                      </span>
                    }
偏右's avatar
偏右 committed
541
                    gap={8}
542 543 544 545
                    total={numeral(12321).format('0,0')}
                    status="up"
                    subTotal={17.1}
                  />
niko's avatar
niko committed
546
                  <MiniArea line height={45} data={visitData2} />
547 548 549
                </Col>
                <Col sm={12} xs={24} style={{ marginBottom: 24 }}>
                  <NumberInfo
陈帅's avatar
陈帅 committed
550 551 552 553 554 555
                    subTitle={
                      <FormattedMessage
                        id="app.analysis.per-capita-search"
                        defaultMessage="Per Capita Search"
                      />
                    }
556 557 558
                    total={2.7}
                    status="down"
                    subTotal={26.2}
偏右's avatar
偏右 committed
559
                    gap={8}
560
                  />
niko's avatar
niko committed
561
                  <MiniArea line height={45} data={visitData2} />
562 563 564 565
                </Col>
              </Row>
              <Table
                rowKey={record => record.index}
afc163's avatar
afc163 committed
566
                size="small"
567 568 569 570 571 572 573 574 575
                columns={columns}
                dataSource={searchData}
                pagination={{
                  style: { marginBottom: 0 },
                  pageSize: 5,
                }}
              />
            </Card>
          </Col>
576
          <Col xl={12} lg={24} md={24} sm={24} xs={24}>
577
            <Card
578
              loading={loading}
niko's avatar
niko committed
579
              className={styles.salesCard}
580
              bordered={false}
陈帅's avatar
陈帅 committed
581 582 583 584 585 586
              title={
                <FormattedMessage
                  id="app.analysis.the-proportion-of-sales"
                  defaultMessage="The Proportion of Sales"
                />
              }
587
              bodyStyle={{ padding: 24 }}
niko's avatar
niko committed
588
              extra={
niko's avatar
niko committed
589 590 591 592
                <div className={styles.salesCardExtra}>
                  {iconGroup}
                  <div className={styles.salesTypeRadio}>
                    <Radio.Group value={salesType} onChange={this.handleChangeSalesType}>
陈帅's avatar
陈帅 committed
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607
                      <Radio.Button value="all">
                        <FormattedMessage id="app.analysis.channel.all" defaultMessage="ALL" />
                      </Radio.Button>
                      <Radio.Button value="online">
                        <FormattedMessage
                          id="app.analysis.channel.online"
                          defaultMessage="Online"
                        />
                      </Radio.Button>
                      <Radio.Button value="stores">
                        <FormattedMessage
                          id="app.analysis.channel.stores"
                          defaultMessage="Stores"
                        />
                      </Radio.Button>
niko's avatar
niko committed
608 609 610
                    </Radio.Group>
                  </div>
                </div>
niko's avatar
niko committed
611
              }
afc163's avatar
afc163 committed
612
              style={{ marginTop: 24, minHeight: 509 }}
613
            >
陈帅's avatar
陈帅 committed
614 615 616
              <h4 style={{ marginTop: 8, marginBottom: 32 }}>
                <FormattedMessage id="app.analysis.sales" defaultMessage="Sales" />
              </h4>
afc163's avatar
afc163 committed
617 618
              <Pie
                hasLegend
陈帅's avatar
陈帅 committed
619
                subTitle={<FormattedMessage id="app.analysis.sales" defaultMessage="Sales" />}
jim's avatar
jim committed
620
                total={() => <Yuan>{salesPieData.reduce((pre, now) => now.y + pre, 0)}</Yuan>}
afc163's avatar
afc163 committed
621
                data={salesPieData}
jim's avatar
jim committed
622
                valueFormat={value => <Yuan>{value}</Yuan>}
afc163's avatar
afc163 committed
623 624 625
                height={248}
                lineWidth={4}
              />
626 627 628 629 630
            </Card>
          </Col>
        </Row>

        <Card
631
          loading={loading}
niko's avatar
niko committed
632
          className={styles.offlineCard}
633
          bordered={false}
niko's avatar
niko committed
634 635
          bodyStyle={{ padding: '0 0 32px 0' }}
          style={{ marginTop: 32 }}
636
        >
niko's avatar
niko committed
637 638 639 640 641 642 643
          <Tabs activeKey={activeKey} onChange={this.handleTabChange}>
            {offlineData.map(shop => (
              <TabPane tab={<CustomTab data={shop} currentTabKey={activeKey} />} key={shop.name}>
                <div style={{ padding: '0 24px' }}>
                  <TimelineChart
                    height={400}
                    data={offlineChartData}
陈帅's avatar
陈帅 committed
644
                    titleMap={{
陈帅's avatar
陈帅 committed
645 646
                      y1: formatMessage({ id: 'app.analysis.traffic' }),
                      y2: formatMessage({ id: 'app.analysis.payments' }),
陈帅's avatar
陈帅 committed
647
                    }}
niko's avatar
niko committed
648 649 650 651
                  />
                </div>
              </TabPane>
            ))}
652 653
          </Tabs>
        </Card>
jim's avatar
jim committed
654
      </GridContent>
655 656
    );
  }
afc163's avatar
afc163 committed
657
}
ddcat1115's avatar
ddcat1115 committed
658

陈帅's avatar
陈帅 committed
659
export default Analysis;