import React, { Component } from 'react'; import { connect } from 'dva'; import { Row, Col, Icon, Card, Tabs, Table, Radio, DatePicker, Tooltip, Menu, Dropdown, } from 'antd'; import { ChartCard, yuan, MiniArea, MiniBar, MiniProgress, Field, Bar, Pie, TimelineChart, } from 'components/Charts'; import Trend from 'components/Trend'; import NumberInfo from 'components/NumberInfo'; import numeral from 'numeral'; import GridContent from '../../layouts/GridContent'; import { getTimeDistance } from '../../utils/utils'; import styles from './Analysis.less'; const { TabPane } = Tabs; const { RangePicker } = DatePicker; const rankingListData = []; for (let i = 0; i < 7; i += 1) { rankingListData.push({ title: `工专路 ${i} 号店`, total: 323234, }); } @connect(({ chart, loading }) => ({ chart, loading: loading.effects['chart/fetch'], })) export default class Analysis extends Component { state = { salesType: 'all', currentTabKey: '', rangePickerValue: getTimeDistance('year'), }; componentDidMount() { this.props.dispatch({ type: 'chart/fetch', }); } componentWillUnmount() { const { dispatch } = this.props; dispatch({ type: 'chart/clear', }); } handleChangeSalesType = (e) => { this.setState({ salesType: e.target.value, }); }; handleTabChange = (key) => { this.setState({ currentTabKey: key, }); }; handleRangePickerChange = (rangePickerValue) => { this.setState({ rangePickerValue, }); this.props.dispatch({ type: 'chart/fetchSalesData', }); }; selectDate = (type) => { this.setState({ rangePickerValue: getTimeDistance(type), }); this.props.dispatch({ type: 'chart/fetchSalesData', }); }; isActive(type) { const { rangePickerValue } = this.state; const value = getTimeDistance(type); if (!rangePickerValue[0] || !rangePickerValue[1]) { return; } if ( rangePickerValue[0].isSame(value[0], 'day') && rangePickerValue[1].isSame(value[1], 'day') ) { return styles.currentDate; } } render() { const { rangePickerValue, salesType, currentTabKey } = this.state; const { chart, loading } = this.props; const { visitData, visitData2, salesData, searchData, offlineData, offlineChartData, salesTypeData, salesTypeDataOnline, salesTypeDataOffline, } = chart; const salesPieData = salesType === 'all' ? salesTypeData : salesType === 'online' ? salesTypeDataOnline : salesTypeDataOffline; const menu = ( 操作一 操作二 ); const iconGroup = ( ); const salesExtra = (
this.selectDate('today')}> 今日 this.selectDate('week')}> 本周 this.selectDate('month')}> 本月 this.selectDate('year')}> 全年
); const columns = [ { title: '排名', dataIndex: 'index', key: 'index', }, { title: '搜索关键词', dataIndex: 'keyword', key: 'keyword', render: text => {text}, }, { title: '用户数', dataIndex: 'count', key: 'count', sorter: (a, b) => a.count - b.count, className: styles.alignRight, }, { title: '周涨幅', dataIndex: 'range', key: 'range', sorter: (a, b) => a.range - b.range, render: (text, record) => ( {text}% ), align: 'right', }, ]; const activeKey = currentTabKey || (offlineData[0] && offlineData[0].name); const CustomTab = ({ data, currentTabKey: currentKey }) => ( ); const topColResponsiveProps = { xs: 24, sm: 12, md: 12, lg: 12, xl: 6, style: { marginBottom: 24 }, }; return ( } total={yuan(126560)} footer={} contentHeight={46} > 周同比12% 日环比11% } total={numeral(8846).format('0,0')} footer={} contentHeight={46} > } total={numeral(6560).format('0,0')} footer={} contentHeight={46} > } total="78%" footer={
周同比12% 日环比11%
} contentHeight={46} >

门店销售额排名

    {rankingListData.map((item, i) => (
  • {i + 1} {item.title} {numeral(item.total).format('0,0')}
  • ))}

门店访问量排名

    {rankingListData.map((item, i) => (
  • {i + 1} {item.title} {numeral(item.total).format('0,0')}
  • ))}
搜索用户数 } gap={8} total={numeral(12321).format('0,0')} status="up" subTotal={17.1} /> record.index} size="small" columns={columns} dataSource={searchData} pagination={{ style: { marginBottom: 0 }, pageSize: 5, }} /> {iconGroup}
全部渠道 线上 门店
} style={{ marginTop: 24, minHeight: 509 }} >

销售额

now.y + pre, 0))} data={salesPieData} valueFormat={val => yuan(val)} height={248} lineWidth={4} />
{offlineData.map(shop => ( } key={shop.name}>
))}
); } }