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

const OverSeasEnquire = ({ data, loading, currentSite }) => {
  const parsedata = (pieData) => {
    return pieData.map((item) => ({
      value: item.enquiryNum,
      name: item.country,
    }));
  };

  // const title = currentSite === "1" ? "海外" : "分销商";

  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, global }) => ({
  data: bigscreen.overseasEnquireLocationData.data,
  loading: bigscreen.overseasEnquireLocationData.loading,
  currentSite: global.currentSite
}))(OverSeasEnquire);
