import React from "react";
import { Spin } from "antd";
import { connect } from "dva";
import PanelNav from "./PanelNav";
import EnquirePieChart from "./EnquirePieChart";
import styles from "../styles/common.less";

const DistributorEnquire = ({ data, loading, dispatch }) => {
  const parsedata = (pieData) => {
    return pieData.map((item) => ({
      value: item.storeNum,
      name: item.provinceName,
    }));
  };
  return (
    <Spin spinning={loading}>
      <div className={styles.common}>
        <div className={styles.common_header}>
          <PanelNav title="分销商地区分布" />
        </div>
        <div className={styles.common_content}>
          <EnquirePieChart data={parsedata(data)} />
        </div>
      </div>
    </Spin>
  );
};

export default connect(({ bigscreen }) => ({
  data: bigscreen.distributorEnquireLocationData.data,
  loading: bigscreen.distributorEnquireLocationData.loading,
}))(DistributorEnquire);
