显示对比数据
parent
8c32040a29
commit
12b8f250c0
@ -1,117 +1,41 @@
|
||||
import React, {Component} from 'react';
|
||||
import {Table, Button, DatePicker, Space, Radio} from 'antd';
|
||||
import {Table, Button, Space, Radio} from 'antd';
|
||||
import {SearchOutlined} from '@ant-design/icons';
|
||||
import moment from 'moment';
|
||||
import GroupSelect from './GroupSelect';
|
||||
import * as config from '../config' ;
|
||||
|
||||
import DatePickerCharts from "./DatePickerCharts";
|
||||
import {stores_Context} from "../config";
|
||||
import {observer} from "mobx-react";
|
||||
|
||||
class MobileDeal extends Component {
|
||||
static contextType = stores_Context;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
loading: false,
|
||||
mobile_deal_data: []
|
||||
};
|
||||
this.group_ids = React.createRef();
|
||||
this.data = {
|
||||
date_type: 'applyDate',
|
||||
applydate_check: 1,
|
||||
startdate_check: 0,
|
||||
startdate: moment().subtract(8, 'days'),//上周一
|
||||
enddate: moment().subtract(2, 'days'),//上周日
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
//this.asyncFetch();
|
||||
}
|
||||
|
||||
asyncFetch = () => {
|
||||
this.setState({loading: true});
|
||||
let url = '/service-tourdesign/CountYDOrder?DEI_SNList=' + this.group_ids.current.state.data.toString();
|
||||
if (this.data.date_type == 'applyDate') {
|
||||
url += '&ApplydateCheck=1&OrderStartdateCheck=0';
|
||||
} else {
|
||||
url += '&ApplydateCheck=0&OrderStartdateCheck=1';
|
||||
}
|
||||
url += '&ApplydateStart=' + this.data.startdate.format(config.DATE_FORMAT) + '&ApplydateEnd=' + this.data.enddate.format(config.DATE_FORMAT) + '%2023:59';
|
||||
url += '&OrderStartdateStart=' + this.data.startdate.format(config.DATE_FORMAT) + '&OrderStartdateEnd=' + this.data.enddate.format(config.DATE_FORMAT) + '%2023:59';
|
||||
fetch(config.HT_HOST + url)
|
||||
.then((response) => response.json())
|
||||
.then((json) => {
|
||||
let table_data = []
|
||||
json && json.map((item, index) => {
|
||||
table_data.push({
|
||||
key: index,
|
||||
department_name: item.DEI_DepartmentName,
|
||||
mobile_order: item.YDOrderNum + '/' + item.OrderNum + ' (' + (item.OrderNumRate * 100).toFixed(1) + '%)',
|
||||
mobile_deal: item.YDOrderNumSUC + ' / ' + item.OrderNumSUC + ' (' + (item.OrderNumSUCRate * 100).toFixed(1) + '%)',
|
||||
mobile_gross: item.YDML + ' / ' + item.ML + ' (' + (item.MLRate * 100).toFixed(1) + '%)',
|
||||
})
|
||||
})
|
||||
this.setState({mobile_deal_data: table_data});
|
||||
this.setState({loading: false});
|
||||
})
|
||||
.catch((error) => {
|
||||
this.setState({loading: false});
|
||||
console.log('fetch data failed', error);
|
||||
});
|
||||
};
|
||||
onChange_datetype = (e) => {
|
||||
this.data.date_type = e.target.value;
|
||||
};
|
||||
onChange_dataPicker = (dates) => {
|
||||
this.data.startdate = dates[0];
|
||||
this.data.enddate = dates[1];
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '市场',
|
||||
dataIndex: 'department_name',
|
||||
key: 'department_name',
|
||||
},
|
||||
{
|
||||
title: '移动订单/总订单',
|
||||
dataIndex: 'mobile_order',
|
||||
key: 'mobile_order',
|
||||
},
|
||||
{
|
||||
title: '移动成交/总成交',
|
||||
dataIndex: 'mobile_deal',
|
||||
key: 'mobile_deal',
|
||||
},
|
||||
{
|
||||
title: '移动毛利/总毛利',
|
||||
dataIndex: 'mobile_gross',
|
||||
key: 'mobile_gross',
|
||||
},
|
||||
];
|
||||
|
||||
const {dashboard_store} = this.context;
|
||||
const mobile_data=dashboard_store.mobile_data;
|
||||
return (
|
||||
<div>
|
||||
<h2>移动成交</h2>
|
||||
<GroupSelect ref={this.group_ids} defaultValue={['1', '2', '28', '7', '8', '9', '11', '12', '20', '21']} />
|
||||
<GroupSelect store={mobile_data} />
|
||||
<Space size="large">
|
||||
<DatePicker.RangePicker format={config.DATE_FORMAT}
|
||||
defaultValue={[this.data.startdate, this.data.enddate]}
|
||||
onChange={this.onChange_dataPicker}/>
|
||||
<Radio.Group defaultValue={this.data.date_type} onChange={this.onChange_datetype}>
|
||||
<DatePickerCharts hide_vs={true}/>
|
||||
|
||||
<Radio.Group value={mobile_data.date_type} onChange={mobile_data.onChange_datetype}>
|
||||
<Radio value="applyDate">预定日期</Radio>
|
||||
<Radio value="startDate">出发日期</Radio>
|
||||
</Radio.Group>
|
||||
<Button type="primary" icon={<SearchOutlined/>} loading={this.state.loading} onClick={() => {
|
||||
this.asyncFetch();
|
||||
|
||||
<Button type="primary" icon={<SearchOutlined/>} loading={mobile_data.loading} onClick={() => {
|
||||
mobile_data.asyncFetch();
|
||||
}}>统计</Button>
|
||||
</Space>
|
||||
<Table dataSource={this.state.mobile_deal_data} columns={columns} pagination={false} size="small"/>
|
||||
<Table dataSource={mobile_data.data} columns={mobile_data.columns} pagination={false} size="small"/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default MobileDeal;
|
||||
export default observer(MobileDeal);
|
||||
|
@ -1,153 +1,53 @@
|
||||
import React, {Component} from 'react';
|
||||
import {Table, Button, DatePicker, Space, Tooltip} from 'antd';
|
||||
import {Table, Button, Space} from 'antd';
|
||||
import {Line} from '@ant-design/charts';
|
||||
import GroupSelect from './GroupSelect';
|
||||
import SiteSelect from './SiteSelect';
|
||||
import {SearchOutlined} from '@ant-design/icons';
|
||||
import * as config from '../config' ;
|
||||
import moment from "moment";
|
||||
import {stores_Context} from "../config";
|
||||
import DatePickerCharts from "./DatePickerCharts";
|
||||
import {observer} from "mobx-react";
|
||||
|
||||
|
||||
class OrdersTempTable extends Component {
|
||||
|
||||
static contextType = stores_Context;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
data: [],
|
||||
table: [],
|
||||
show_table: false,
|
||||
loading: false,
|
||||
loading_detail: false
|
||||
};
|
||||
this.website_codes = React.createRef();
|
||||
this.data = {
|
||||
startdate: moment().subtract(7, 'days'),//上周一
|
||||
enddate: moment().subtract(0, 'days'),//上周日
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
}
|
||||
|
||||
asyncFetch = () => {
|
||||
this.setState({loading: true});
|
||||
this.setState({show_table: false});
|
||||
let url = '/service-baseinfo/QueryWebData?type=orders_temp&db=1';
|
||||
const website_code = "'" + this.website_codes.current.state.data.join("','") + "'";
|
||||
url += '&WebSite=' + website_code + '&ApplyDateStart=' + this.data.startdate.format(config.DATE_FORMAT) + '&ApplyDateEnd=' + this.data.enddate.format(config.DATE_FORMAT) + '%2023:59';
|
||||
fetch(config.HT_HOST + url)
|
||||
.then((response) => response.json())
|
||||
.then((json) => {
|
||||
this.setState({data: json.data})
|
||||
this.setState({loading: false});
|
||||
})
|
||||
.catch((error) => {
|
||||
this.setState({loading: false});
|
||||
console.log('fetch data failed', error);
|
||||
});
|
||||
};
|
||||
// componentDidMount() {
|
||||
// }
|
||||
|
||||
asyncFetch_detail = () => {
|
||||
this.setState({loading_detail: true});
|
||||
this.setState({show_table: true});
|
||||
let url = '/service-baseinfo/QueryWebData?type=orders_temp_detail&db=1';
|
||||
const website_code = "'" + this.website_codes.current.state.data.join("','") + "'";
|
||||
url += '&WebSite=' + website_code + '&ApplyDateStart=' + this.data.startdate.format(config.DATE_FORMAT) + '&ApplyDateEnd=' + this.data.enddate.format(config.DATE_FORMAT) + '%2023:59';
|
||||
fetch(config.HT_HOST + url)
|
||||
.then((response) => response.json())
|
||||
.then((json) => {
|
||||
this.setState({table: json.data})
|
||||
this.setState({loading_detail: false});
|
||||
})
|
||||
.catch((error) => {
|
||||
this.setState({loading_detail: false});
|
||||
console.log('fetch data failed', error);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
onChange_dataPicker = (dates) => {
|
||||
this.data.startdate = dates[0];
|
||||
this.data.enddate = dates[1];
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
const config = {
|
||||
data: this.state.data,
|
||||
padding: 'auto',
|
||||
xField: 'order_date',
|
||||
yField: 'order_count',
|
||||
seriesField: 'order_sitecode',
|
||||
xAxis: {
|
||||
type: 'timeCat',
|
||||
},
|
||||
smooth: true,
|
||||
};
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '订单号',
|
||||
dataIndex: 'COLI_ID',
|
||||
key: 'COLI_ID',
|
||||
},
|
||||
{
|
||||
title: '设备',
|
||||
dataIndex: 'COLI_OrderSource',
|
||||
key: 'COLI_OrderSource',
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
dataIndex: 'COLI_SourceType',
|
||||
key: 'COLI_SourceType',
|
||||
},
|
||||
{
|
||||
title: '网站',
|
||||
dataIndex: 'COLI_WebCode',
|
||||
key: 'COLI_WebCode',
|
||||
},
|
||||
{
|
||||
title: 'IP',
|
||||
dataIndex: 'COLI_SenderIP',
|
||||
key: 'COLI_SenderIP',
|
||||
},
|
||||
{
|
||||
title: '预定时间',
|
||||
dataIndex: 'COLI_ApplyDate',
|
||||
key: 'COLI_ApplyDate',
|
||||
},
|
||||
{
|
||||
title: '订单内容',
|
||||
dataIndex: 'COLI_OrderDetailText',
|
||||
key: 'COLI_OrderDetailText',
|
||||
ellipsis: true,
|
||||
},
|
||||
];
|
||||
const {dashboard_store} = this.context;
|
||||
const ordersTemp_data=dashboard_store.ordersTemp_data;
|
||||
|
||||
return (
|
||||
|
||||
<div>
|
||||
<h2>临时订单数量</h2>
|
||||
<SiteSelect ref={this.website_codes} multiple={"multiple"}
|
||||
defaultValue={['CHT', 'AH']}/>
|
||||
<Space>
|
||||
<DatePicker.RangePicker format={config.DATE_FORMAT}
|
||||
defaultValue={[this.data.startdate, this.data.enddate]}
|
||||
onChange={this.onChange_dataPicker}/>
|
||||
<Button type="primary" icon={<SearchOutlined/>} loading={this.state.loading} onClick={() => {
|
||||
this.asyncFetch();
|
||||
<SiteSelect store={ordersTemp_data} />
|
||||
<Space><DatePickerCharts hide_vs={true}/>
|
||||
<Button type="primary" icon={<SearchOutlined/>} loading={ordersTemp_data.loading} onClick={() => {
|
||||
ordersTemp_data.asyncFetch();
|
||||
}}>统计</Button>
|
||||
<Button type="primary" icon={<SearchOutlined/>} loading={this.state.loading_detail} onClick={() => {
|
||||
this.asyncFetch_detail();
|
||||
<Button type="primary" icon={<SearchOutlined/>} loading={ordersTemp_data.loading_detail} onClick={() => {
|
||||
ordersTemp_data.asyncFetch_detail();
|
||||
}}>查看详情</Button>
|
||||
</Space>
|
||||
{this.state.show_table ? (
|
||||
<Table dataSource={this.state.table} columns={columns} size="small"/>
|
||||
{ordersTemp_data.show_table ? (
|
||||
<Table dataSource={ordersTemp_data.data_detail} columns={ordersTemp_data.columns} size="small"/>
|
||||
) : (
|
||||
<Line {...config} />
|
||||
<Line {...ordersTemp_data.line} data={ordersTemp_data.data} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default OrdersTempTable;
|
||||
export default observer(OrdersTempTable);
|
||||
|
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
|
Before Width: | Height: | Size: 2.6 KiB |
Loading…
Reference in New Issue