顾问和国籍的利润显示

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

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

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

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

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

@ -1,5 +1,5 @@
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 { stores_Context } from "../config";
import { Column } from "@ant-design/charts";
@ -40,17 +40,24 @@ const Sale = () => {
<Col md={24} lg={10} xxl={12}></Col>
<Col md={24} lg={14} xxl={12}>
<Row>
<Col md={24} lg={8} xxl={7}>
<Col md={24} lg={7} xxl={6}>
<GroupSelect store={sale_store} />
<Radio.Group value={sale_store.date_type} onChange={e => sale_store.onChange_datetype(e)}>
<Radio value="applyDate">下单日期</Radio>
<Radio value="startDate">走团日期</Radio>
</Radio.Group>
<Select value={sale_store.date_type} style={{ width: "95%" }} onChange={value => sale_store.onChange_datetype(value)}>
<Select.Option key="1" value="okDate">
确认日期
</Select.Option>
<Select.Option key="2" value="applyDate">
下单日期
</Select.Option>
<Select.Option key="3" value="startDate">
走团日期
</Select.Option>
</Select>
</Col>
<Col md={24} lg={12} xxl={10}>
<DatePickerCharts />
</Col>
<Col md={24} lg={4} xxl={7}>
<Col md={24} lg={5} xxl={8}>
<Button
type="primary"
icon={<SearchOutlined />}
@ -72,7 +79,12 @@ const Sale = () => {
</Col>
<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
tab={
<span>
@ -80,14 +92,7 @@ const Sale = () => {
概览
</span>
}
key="All">
<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>
key="All"></Tabs.TabPane>
<Tabs.TabPane
tab={
<span>
@ -95,15 +100,14 @@ const Sale = () => {
国籍
</span>
}
key="page">
key="Country"></Tabs.TabPane>
</Tabs>
<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" /> */}
<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>
</Tabs.TabPane>
</Tabs>
</Col>
</Row>
</div>

Loading…
Cancel
Save