import React, { Component } from 'react'; import { connect } from 'dva'; import { Row, Col, Icon, Card, Tabs, Table, Radio, DatePicker, Tooltip } from 'antd'; import numeral from 'numeral'; import { ChartCard, Trend, yuan, MiniArea, MiniBar, MiniProgress, Field, Bar, Pie, NumberInfo, IconUp, IconDown, TimelineChart } from '../../components/Charts'; 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(state => ({ chart: state.chart, })) export default class Analysis extends Component { state = { salesType: 'all', currentTabKey: '', rangePickerValue: [], } 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 } = this.props; const { visitData, visitData2, salesData, searchData, offlineData, offlineChartData, salesTypeData, salesTypeDataOnline, salesTypeDataOffline, } = chart; const salesPieData = salesType === 'all' ? salesTypeData : (salesType === 'online' ? salesTypeDataOnline : salesTypeDataOffline); 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}% { record.status === 1 ? : } ), className: styles.alignRight, }, ]; const activeKey = currentTabKey || (offlineData[0] && offlineData[0].name); const CustomTab = ({ data, currentTabKey: currentKey }) => ( {data.cvr * 100}%} theme={(currentKey !== data.name) && 'light'} /> ); 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.3% 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')}
  • )) }
搜索用户数 } total={numeral(12321).format('0,0')} status="up" subTotal={17.1} /> record.index} size="small" columns={columns} dataSource={searchData} pagination={{ style: { marginBottom: 0 }, showSizeChanger: true, showQuickJumper: true, pageSize: 5, }} /> {iconGroup}
全部渠道 线上 门店
)} style={{ marginTop: 24 }} >
now.y + pre, 0))} data={salesPieData} valueFormat={val => yuan(val)} height={268} lineWidth={4} />
{ offlineData.map(shop => ( } key={shop.name} >
) ) }
); } }