顾问和国籍的利润显示

feature/2.0-sales-trade
尹诚诚 3 years ago
parent bc33fdc2ea
commit 3cf49c9c51

@ -14,7 +14,7 @@ class GroupSelect extends Component {
<div> <div>
<Select <Select
mode={store.group_select_mode} mode={store.group_select_mode}
style={{width: '100%',}} style={{width: '95%',}}
placeholder="选择小组" placeholder="选择小组"
value={store.groups} value={store.groups}
onChange={(value) => store.group_handleChange(value)} onChange={(value) => store.group_handleChange(value)}

@ -15,7 +15,7 @@ class SiteSelect extends Component {
<div> <div>
<Select <Select
mode={store.site_select_mode} mode={store.site_select_mode}
style={{width: 120}} style={{width: '95%'}}
placeholder="选择网站" placeholder="选择网站"
defaultValue={store.webcode} defaultValue={store.webcode}
onChange={store.handleChange_webcode} onChange={store.handleChange_webcode}

@ -32,8 +32,8 @@ class SaleStore {
} }
//下单日期或者出发日期 //下单日期或者出发日期
onChange_datetype(e) { onChange_datetype(value) {
this.date_type = e.target.value; this.date_type = value;
} }
//获取业绩信息 //获取业绩信息
@ -99,59 +99,83 @@ class SaleStore {
.then(json => { .then(json => {
if (!comm.empty(json.result2) && !comm.empty(date_moment.start_date_cp)) { if (!comm.empty(json.result2) && !comm.empty(date_moment.start_date_cp)) {
} else { } else {
let opi_arr = []; //顾问列表 if (this.active_tab_key == "All") {
let row_title = ""; //行标题 result.columns = [
let new_data_arr = []; //行列转换后的数组 {
Object.keys(json.result1[0]).map((col, col_i) => { title: "",
switch (col) { children: [
case "OPI_Name": {
opi_arr = [ title: "",
{ name: "", index: "c0" }, dataIndex: "OPI_Name",
...Object.values(json.result1).map((row, row_i) => { },
return { name: Object.values(row)[col_i], index: "c" + ++row_i }; ],
}), },
]; {
return; title: "毛利",
break; children: [{ title: "毛利合计", dataIndex: "COLI_ML" }],
case "COLI_OrderCount": sorter: (a, b) => parseInt(b.COLI_ML.replace(/,/g, "")) - parseInt(a.COLI_ML.replace(/,/g, "")),
row_title = "订单数"; },
break; {
case "COLI_ML": title: "成行率",
row_title = "毛利"; children: [{ title: "平均成行率", dataIndex: "COLI_CJrate" }],
break; sorter: (a, b) => parseInt(b.COLI_CJrate) - parseInt(a.COLI_CJrate),
case "COLI_CJCount": },
row_title = "成团数"; {
break; title: "成团数",
case "COLI_CJrate": children: [{ title: "成团数合计", dataIndex: "COLI_CJCount" }],
row_title = "成行率"; sorter: (a, b) => b.COLI_CJCount - a.COLI_CJCount,
break; },
case "COLI_Cycle": {
row_title = "成行周期"; title: "订单数",
break; children: [{ title: "订单数合计", dataIndex: "COLI_OrderCount" }],
case "COLI_SingleML": sorter: (a, b) => b.COLI_OrderCount - a.COLI_OrderCount,
row_title = "单团毛利"; },
break; {
default: title: "单团毛利",
return; children: [{ title: "平均单团毛利", dataIndex: "COLI_SingleML" }],
} sorter: (a, b) => parseInt(b.COLI_SingleML.replace(/,/g, "")) - parseInt(a.COLI_SingleML.replace(/,/g, "")),
new_data_arr.push( },
Object.assign( {
{ key: col_i }, title: "成团周期",
{ c0: row_title }, children: [{ title: "平均成团周期", dataIndex: "COLI_Cycle" }],
...Object.values(json.result1).map((row, row_i) => { sorter: (a, b) => b.COLI_Cycle - a.COLI_Cycle,
return { ["c" + ++row_i]: Object.values(row)[col_i] }; },
}) ];
) result.dataSource = json.result1;
); } else if (this.active_tab_key == "Country") {
}); //获取类型的项目,去掉重复,作为列名
let type_name_arr = [];
json.result1.map(item => {
type_name_arr[item.SubTypeSN] = { SubTypeSN: item.SubTypeSN, SubTypeName: item.SubTypeName };
});
let type_data = [];
let type_data_arr = [];
for (let item of opi_arr) { for (let item of json.result1) {
result.columns.push({ if (comm.empty(type_data["OP_" + item.OPI_SN])) {
title: item.name, type_data["OP_" + item.OPI_SN] = [{ key: item.OPI_SN }, { T_name: item.OPI_Name }, { T_total: item.OPI_TotalYJLY }];
dataIndex: item.index, }
type_data["OP_" + item.OPI_SN].push({ ["T_" + item.SubTypeSN]: item.COLI_YJLY });
}
Object.values(type_data).map(item => {
type_data_arr.push(
Object.assign(
...item.map(it => {
return it;
})
)
);
});
result.columns.push({ title: "顾问", dataIndex: "T_name" }, { title: "合计", dataIndex: "T_total" });
type_name_arr.map((item, index) => {
result.columns.push({
title: item.SubTypeName,
dataIndex: "T_" + item.SubTypeSN,
});
}); });
result.dataSource = type_data_arr;
} }
result.dataSource = new_data_arr;
} }
runInAction(() => { runInAction(() => {
this.type_data = result; this.type_data = result;

@ -114,6 +114,7 @@ const Credit_card_bill = () => {
return result; return result;
}; };
//去掉重复的项目
const filters_array = data_array => { const filters_array = data_array => {
return comm.unique(data_array).map(item => { return comm.unique(data_array).map(item => {
return { text: item, value: item }; return { text: item, value: item };

@ -1,5 +1,5 @@
import React, { useContext, useEffect } from "react"; import React, { useContext, useEffect } from "react";
import { Row, Col, Button, Tabs, Table, Space, Radio } from "antd"; import { Row, Col, Button, Tabs, Table, Space, Radio, Select } from "antd";
import { ContainerOutlined, SearchOutlined } from "@ant-design/icons"; import { ContainerOutlined, SearchOutlined } from "@ant-design/icons";
import { stores_Context } from "../config"; import { stores_Context } from "../config";
import { Column } from "@ant-design/charts"; import { Column } from "@ant-design/charts";
@ -40,17 +40,24 @@ const Sale = () => {
<Col md={24} lg={10} xxl={12}></Col> <Col md={24} lg={10} xxl={12}></Col>
<Col md={24} lg={14} xxl={12}> <Col md={24} lg={14} xxl={12}>
<Row> <Row>
<Col md={24} lg={8} xxl={7}> <Col md={24} lg={7} xxl={6}>
<GroupSelect store={sale_store} /> <GroupSelect store={sale_store} />
<Radio.Group value={sale_store.date_type} onChange={e => sale_store.onChange_datetype(e)}> <Select value={sale_store.date_type} style={{ width: "95%" }} onChange={value => sale_store.onChange_datetype(value)}>
<Radio value="applyDate">下单日期</Radio> <Select.Option key="1" value="okDate">
<Radio value="startDate">走团日期</Radio> 确认日期
</Radio.Group> </Select.Option>
<Select.Option key="2" value="applyDate">
下单日期
</Select.Option>
<Select.Option key="3" value="startDate">
走团日期
</Select.Option>
</Select>
</Col> </Col>
<Col md={24} lg={12} xxl={10}> <Col md={24} lg={12} xxl={10}>
<DatePickerCharts /> <DatePickerCharts />
</Col> </Col>
<Col md={24} lg={4} xxl={7}> <Col md={24} lg={5} xxl={8}>
<Button <Button
type="primary" type="primary"
icon={<SearchOutlined />} icon={<SearchOutlined />}
@ -72,7 +79,12 @@ const Sale = () => {
</Col> </Col>
<Col className="gutter-row" md={24}> <Col className="gutter-row" md={24}>
<Tabs activeKey={sale_store.active_tab_key} onChange={active_key => sale_store.onChange_Tabs(active_key)}> <Tabs
activeKey={sale_store.active_tab_key}
onChange={active_key => {
sale_store.onChange_Tabs(active_key);
sale_store.get_department_order_ml_by_type(date_picker_store);
}}>
<Tabs.TabPane <Tabs.TabPane
tab={ tab={
<span> <span>
@ -80,14 +92,7 @@ const Sale = () => {
概览 概览
</span> </span>
} }
key="All"> key="All"></Tabs.TabPane>
<Row>
<Col span={24}>
{sale_store.date_title}
<Table dataSource={type_data.dataSource} columns={type_data.columns} bordered size="small" rowKey={record => record.key} loading={sale_store.loading_table} pagination={false} scroll={{ x: "100%" }} />
</Col>
</Row>
</Tabs.TabPane>
<Tabs.TabPane <Tabs.TabPane
tab={ tab={
<span> <span>
@ -95,15 +100,14 @@ const Sale = () => {
国籍 国籍
</span> </span>
} }
key="page"> key="Country"></Tabs.TabPane>
<Row>
<Col span={24}>
{sale_store.date_title}
{/* <Table dataSource={table_data_p.dataSource} rowKey={record => record.key} columns={table_data_p.columns} size="small" /> */}
</Col>
</Row>
</Tabs.TabPane>
</Tabs> </Tabs>
<Row>
<Col span={24}>
{sale_store.date_title}
<Table dataSource={type_data.dataSource} columns={type_data.columns} size="small" rowKey={record => record.key} loading={sale_store.loading_table} pagination={false} scroll={{ x: "100%" }} />
</Col>
</Row>
</Col> </Col>
</Row> </Row>
</div> </div>

Loading…
Cancel
Save