+ {
+ title: (
+ <>
+ 本期
订单数(按订单提交日期); 成团数(按订单确认日期); 入境(按团抵达日期)
+ >
+ ),
+ key: 'current',
+ children: [
+ {
+ title: '订单数',
+ dataIndex: 'OrderNum',
+ key: 'OrderNum',
+ },
+ {
+ title: '成团数',
+ dataIndex: 'GroupNum',
+ key: 'GroupNum',
+ },
+ {
+ title: '成团率',
+ dataIndex: 'SuccessRate',
+ key: 'SuccessRate',
+ render: (text, r) =>
,
+ },
+ {
+ title: '总人数',
+ dataIndex: 'TotalPersonNum',
+ key: 'TotalPersonNum',
+ },
+ {
+ title: '总报价',
+ dataIndex: 'PreTotalPrice',
+ key: 'PreTotalPrice',
+ },
+ {
+ title: '总利润',
+ dataIndex: 'PreTotalProfit',
+ key: 'PreTotalProfit',
+ },
+ {
+ title: '利润率',
+ dataIndex: 'PreProfitRate',
+ key: 'PreProfitRate',
+ render: (text, r) =>
,
+ },
+ {
+ title: '入境团数',
+ dataIndex: 'EntranceGroupNum',
+ key: 'EntranceGroupNum',
+ },
+ {
+ title: '入境人数',
+ dataIndex: 'EntrancePersonNum',
+ key: 'EntrancePersonNum',
+ },
+ ],
+ },
+ {
+ title: (
+ <>
+ 到目前
(按订单提交日期)
+ >
+ ),
+ key: 'until',
+ children: [
+ {
+ title: '订单数',
+ dataIndex: 'LYOrderNum',
+ key: 'LYOrderNum',
+ onCell: (r) => ({
+ style: { backgroundColor: '#5B8FF9' + '1A' },
+ }),
+ },
+ {
+ title: '订单中的成团数',
+ dataIndex: 'LYGroupNum',
+ key: 'LYGroupNum',
+ onCell: (r) => ({
+ style: { backgroundColor: '#5B8FF9' + '1A' },
+ }),
+ },
+ {
+ title: '成团率',
+ dataIndex: 'LYSuccessRate',
+ key: 'LYSuccessRate',
+ render: (text, r) =>
,
+ onCell: (r) => ({
+ style: { backgroundColor: '#5B8FF9' + '1A' },
+ }),
+ },
+ ],
+ },
+ {
+ title: (
+ <>
+ 本年
(按团抵达日期)
+ >
+ ),
+ key: 'toyear',
+ children: [
+ {
+ title: '团队数',
+ dataIndex: 'LYTotalGroupNum',
+ key: 'LYTotalGroupNum',
+ onCell: (r) => ({
+ style: { backgroundColor: '#9FB40F' + '1A' },
+ }),
+ },
+ {
+ title: '总人数',
+ dataIndex: 'LYTotalPersonNum',
+ key: 'LYTotalPersonNum',
+ onCell: (r) => ({
+ style: { backgroundColor: '#9FB40F' + '1A' },
+ }),
+ },
+ {
+ title: '总报价',
+ dataIndex: 'LYPreTotalPrice',
+ key: 'LYPreTotalPrice',
+ onCell: (r) => ({
+ style: { backgroundColor: '#9FB40F' + '1A' },
+ }),
+ },
+ {
+ title: '总利润',
+ dataIndex: 'LYPreTotalProfit',
+ key: 'LYPreTotalProfit',
+ onCell: (r) => ({
+ style: { backgroundColor: '#9FB40F' + '1A' },
+ }),
+ },
+ {
+ title: '利润率',
+ dataIndex: 'LYPreProfitRate',
+ key: 'LYPreProfitRate',
+ render: (text, r) =>
,
+ onCell: (r) => ({
+ style: { backgroundColor: '#9FB40F' + '1A' },
+ }),
+ },
+ ],
+ },
+ ];
+ const columnsTotal = (toJS(columns)).slice(1);
+ const tableProps = {
+ size: 'small',
+ pagination: false,
+ scroll: { x: 100 * 7 },
+ loading,
+ };
+
+ return (
+ <>
+
+
+
+ {
+ setSearchValues(obj, form);
+ getMeetingDataSales({ ...obj, IsDetail: 0 });
+ getMeetingDataSales({ ...obj, IsDetail: 1 });
+ // onTabChange(activeTab);
+ }}
+ />
+
+
+
+
+ 业绩
+
+
+ 顾问×页面类型业绩
+
+
+
+
+ >
+ );
+});
+export default MeetingSales;
diff --git a/src/zustand/SalesInsight.js b/src/zustand/SalesInsight.js
new file mode 100644
index 0000000..a26401d
--- /dev/null
+++ b/src/zustand/SalesInsight.js
@@ -0,0 +1,122 @@
+import { create } from 'zustand';
+import { devtools } from 'zustand/middleware';
+import { immer } from 'zustand/middleware/immer';
+import { groupsMappedByCode } from '../libs/ht';
+import { fetchJSON } from '@haina/utils-request';
+import { HT_HOST } from '../config';
+import { groupBy, isEmpty, } from '@haina/utils-commons';
+
+/**
+ * 顾问业绩 (例会数据)
+ */
+
+const defaultParams = { OrderType: 227001, IsDYTJ: '', IncludeTickets: 1, Team: '', WebCodeFX: '', CusType: '', OldCus: 0, lineClass: '', IsDetail: -1 };
+
+export const fetchMeetingDataSales = async (params) => {
+ const { errcode, errmsg, result } = await fetchJSON(HT_HOST + '/service-web/QueryData/WLCountForMeetingNew', {
+ ...defaultParams,
+ ...params,
+ WebCode: (params.WebCode || '').replace('all', ''),
+ OPI_SN: params.operator || '',
+ });
+ const ret =
+ errcode !== 0
+ ? []
+ : (result || [])
+ // .filter((ele) =>
+ // Object.keys(ele)
+ // .filter((col) => !['OPI_SN', 'OPI_Name', 'COLI_LineClass', 'LineClass', 'vi'].includes(col))
+ // .some((col) => !isEmpty(ele[col])),
+ // )
+ .map((ele) => ({ ...ele, key: `${ele.OPI_SN}_${ele.COLI_LineClass || ''}_${ele.vi || ''}` }));
+ const byOPI = groupBy(structuredClone(ret), 'OPI_SN');
+ const OPIValue = Object.keys(byOPI).reduce((r, opisn) => {
+ byOPI[opisn].forEach((ele, xi) => {
+ ele.rowSpan = xi === 0 ? byOPI[opisn].length : 0;
+ });
+ return [...r, ...byOPI[opisn]];
+ }, []);
+ const byLineClass = groupBy(structuredClone(ret), 'LineClass');
+ const LineClassValue = Object.keys(byLineClass).reduce((r, gkey) => {
+ byLineClass[gkey].forEach((ele, xi) => {
+ ele.rowSpan = xi === 0 ? byLineClass[gkey].length : 0;
+ });
+ return [...r, ...byLineClass[gkey]];
+ }, []);
+ return { result: ret, OPIValue, LineClassValue };
+};
+
+/**
+ * --------------------------------------------------------------------------------------------------------
+ */
+const initialState = {
+ loading: false,
+ typeLoading: false,
+ searchValues: {
+ // DateType: { key: 'applyDate', label: '提交日期' },
+ WebCode: { key: 'all', label: '所有来源' },
+ IncludeTickets: { key: '1', label: '含门票' },
+ DepartmentList: groupsMappedByCode.GH, // { key: 'All', label: '所有来源' }, //
+ },
+ searchValuesToSub: {
+ // DateType: 'applyDate',
+ WebCode: 'all',
+ IncludeTickets: '1',
+ DepartmentList: -1, // -1: All
+ },
+
+ salesDataTotal: [],
+ salesData: [],
+ matrixData: {},
+ matrixtableMajorKey: 'opi',
+ matrixTableData: [],
+
+ // 二级页面
+};
+
+const useSalesInsightStore = create(
+ devtools(
+ immer((set, get) => ({
+ ...initialState,
+ reset: () => set(initialState),
+
+ setLoading: (loading) => set({ loading }),
+ setTypeLoading: (typeLoading) => set({ typeLoading }),
+
+ setSearchValues: (obj, values) => set((state) => ({ searchValues: values, searchValuesToSub: obj })),
+ setSearchValuesToSub: (values) => set((state) => ({ searchValuesToSub: values })),
+ setActiveTab: (tab) => set({ activeTab: tab }),
+
+
+ // site effects
+ getMeetingDataSales: async (params) => {
+ const { setTypeLoading, } = get();
+ setTypeLoading(true);
+ try {
+ const res = await fetchMeetingDataSales(params);
+ if (params.IsDetail === 1) {
+ set({ matrixData: res, matrixTableData: res.OPIValue, matrixtableMajorKey: 'opi', salesData: res.result });
+ }
+ else {
+ set({ salesDataTotal: res.result });
+ }
+ } catch (error) {
+ console.error(error);
+ } finally {
+ setTypeLoading(false);
+ }
+ },
+
+ onMatrixChange: () => {
+ const { matrixtableMajorKey, matrixData } = get();
+ const newKey = matrixtableMajorKey === 'opi' ? 'lineclass' : 'opi';
+ const dataKey = matrixtableMajorKey === 'opi' ? 'LineClassValue' : 'OPIValue' ;
+ set({ matrixtableMajorKey: newKey, matrixTableData: matrixData?.[dataKey] });
+ },
+
+ // sub
+ })),
+ { name: 'SalesInsight' }
+ )
+);
+export default useSalesInsightStore;