From 5980f76fded46b5d9fad935fcfc8ebeb3c9c17fa Mon Sep 17 00:00:00 2001 From: Jimmy Liow <18777396951@163.com> Date: Tue, 27 Dec 2022 10:47:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=9F=A5=E8=AF=A2=E7=9B=AE?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=9B=A2=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 3 + src/stores/CustomerServices.js | 81 +++++++++++++++- src/views/AgentGroupCount.js | 2 +- src/views/DestinationGroupCount.js | 148 +++++++++++++++++++++++++++++ 4 files changed, 232 insertions(+), 2 deletions(-) create mode 100644 src/views/DestinationGroupCount.js diff --git a/src/App.js b/src/App.js index 03a4f53..6807383 100644 --- a/src/App.js +++ b/src/App.js @@ -15,6 +15,7 @@ import Wechat_session from "./charts/Wechat_session"; import WhatsApp_session from "./charts/WhatsApp_session"; import AgentGroupCount from "./views/AgentGroupCount"; import AgentGroupList from "./views/AgentGroupList"; +import DestinationGroupCount from "./views/DestinationGroupCount"; import Credit_card_bill from "./views/Credit_card_bill"; import exchange_rate from "./charts/ExchangeRate"; import Sale from "./views/Sale"; @@ -72,6 +73,7 @@ const App = () => { icon: , children: [ { key: 61, label: 地接社接团 }, + { key: 62, label: 目的地接团 }, ], } ]; @@ -106,6 +108,7 @@ const App = () => { } /> } /> } /> + } /> } /> }> diff --git a/src/stores/CustomerServices.js b/src/stores/CustomerServices.js index fa4cb30..3d2fc54 100644 --- a/src/stores/CustomerServices.js +++ b/src/stores/CustomerServices.js @@ -36,7 +36,7 @@ class CustomerServices { }); } - fetchAgentGroupList() { + fetchAgentGroupCount() { this.inProgress = true; const fetchUrl = prepareUrl(config.HT_HOST + '/service-web/QueryData/GetAgentGroupInfoALL') .append('DateType', this.dateType) @@ -274,6 +274,82 @@ class CustomerServices { }); } + fetchDestinationGroupCount() { + this.inProgress = true; + const fetchUrl = prepareUrl(config.HT_HOST + '/service-web/QueryData/GetdistGroupInfoAll') + .append('DateType', this.dateType) + .append('Date1', this.startDateString) + .append('Date2', this.endDateString) + .append('OldDate1', this.startDateString) + .append('OldDate2', this.endDateString) + .append('DepList', this.selectedTeam) + .append('Country', this.selectedCountry) + .build(); + req.fetchJSON(fetchUrl) + .then(json => { + if (json.errcode === 0) { + runInAction(() => { + this.destinationGroupCount = json.result1; + const total1 = json.total1; + this.destinationGroupCountColumns = [ + { + title: '城市', + dataIndex: 'COLD_ServiceCityName', + children: [{ + dataIndex: 'COLD_ServiceCityName', + render: (text, record) => {record.COLD_ServiceCityName} + } + ] + }, + { + title: '团数', + dataIndex: 'GroupCount', + sorter: (a, b) => a.GroupCount - b.GroupCount, + children: [{ + title: total1.GroupCount, + dataIndex: 'GroupCount' + } + ] + }, + { + title: '人数', + dataIndex: 'PersonNum', + sorter: (a, b) => a.PersonNum - b.PersonNum, + children: [{ + title: total1.PersonNum, + dataIndex: 'PersonNum' + } + ] + }, + { + title: '团天数', + dataIndex: 'GroupDays', + sorter: (a, b) => a.GroupDays - b.GroupDays, + children: [{ + title: total1.GroupDays, + dataIndex: 'GroupDays' + } + ] + }, + { + title: '交易额', + dataIndex: 'TotalCost', + sorter: (a, b) => a.TotalCost - b.TotalCost, + children: [{ + title: total1.totalcost, + dataIndex: 'TotalCost' + } + ] + } + ]; + }); + } + }) + .then(() => { + this.inProgress = false; + }); + } + selectDateRange(startDate, endDate) { this.startDate = startDate; this.endDate = endDate; @@ -313,6 +389,9 @@ class CustomerServices { groupListColumns = []; + destinationGroupCount = []; + destinationGroupCountColumns =[]; + agentGroupList = [{ EOI_ObjSN: 1, VendorName: '---', diff --git a/src/views/AgentGroupCount.js b/src/views/AgentGroupCount.js index ccfb7e6..a45a90c 100644 --- a/src/views/AgentGroupCount.js +++ b/src/views/AgentGroupCount.js @@ -24,7 +24,7 @@ const AgentGroupCount = () => { }, []); const handleSearchClick = () => { - customerServicesStore.fetchAgentGroupList(); + customerServicesStore.fetchAgentGroupCount(); } const renderAgentItem = (agent) => { diff --git a/src/views/DestinationGroupCount.js b/src/views/DestinationGroupCount.js new file mode 100644 index 0000000..b6d7ab9 --- /dev/null +++ b/src/views/DestinationGroupCount.js @@ -0,0 +1,148 @@ +import React, {useContext, useEffect} from 'react'; +import { Row, Col, Typography, Space, DatePicker, Button, Select, Table, Divider } from 'antd'; +import { + SearchOutlined, +} from '@ant-design/icons'; +import { stores_Context } from '../config' +import * as config from "../config"; +import { observer } from 'mobx-react'; +import 'moment/locale/zh-cn'; +import moment from "moment"; +import zhCNlocale from 'antd/es/date-picker/locale/zh_CN'; +import { utils, writeFileXLSX } from "xlsx"; + +const DestinationGroupCount = () => { + + const {customerServicesStore} = useContext(stores_Context); + const agentList = customerServicesStore.agentList; + const destinationGroupCount = customerServicesStore.destinationGroupCount; + const destinationGroupCountColumns = customerServicesStore.destinationGroupCountColumns; + const {startDate, endDate, dateType, inProgress} = customerServicesStore; + + useEffect(() => { + customerServicesStore.selectCountry('china'); + }, []); + + const handleSearchClick = () => { + customerServicesStore.fetchDestinationGroupCount(); + } + + const renderAgentItem = (agent) => { + return ( + + {agent.VEI2_CompanyBN} + + ); + } + + return ( + <> + + + + + + + + + + + + + { customerServicesStore.selectDateRange(dates[0], dates[1]) }} + ranges={{ + '本周': [moment().startOf('week'), moment().endOf('week')], + '上周': [moment().startOf('week').subtract(7, 'days'), moment().endOf('week').subtract(7, 'days')], + '本月': [moment().startOf('month'), moment().endOf('month')], + '上个月': [moment().subtract(1, 'months').startOf('month'), moment(new Date()).subtract(1, 'months').endOf('month')], + '近30天': [moment().subtract(30, 'days'), moment()], + '近三个月': [moment().subtract(2, 'month').startOf('month'), moment().endOf('month')], + '今年': [moment().startOf('year').subtract(1, 'month'), moment().endOf('year').subtract(1, 'month')], + '去年': [moment().subtract(1, 'year').startOf('year').subtract(1, 'month'), moment().subtract(1, 'year').endOf('year').subtract(1, 'month')], + }} + /> + + + + + + + + 目的地团信息 + record.key} + loading={inProgress} + pagination={false} + scroll={{ x: "100%" }} + /> + + { + const wb = utils.table_to_book(document.getElementById("destinationGroupCount").getElementsByTagName("table")[0]); + writeFileXLSX(wb, "目的地团信息.xlsx"); + }}> + 导出excel + + + + + + + ); +} + +export default observer(DestinationGroupCount); \ No newline at end of file