import React, { useContext, useState, useEffect } from 'react'; import { Row, Col, Divider, Table, Tooltip } from 'antd'; import { InfoCircleOutlined } from '@ant-design/icons'; import { utils, writeFileXLSX } from 'xlsx'; import { stores_Context } from '../config'; import { observer } from 'mobx-react'; import SearchForm from './../components/search/SearchForm'; import LineWithAvg from '../components/LineWithAvg'; import { toJS } from 'mobx'; import { TableExportBtn, RenderVSDataCell } from '../components/Data'; import useCustomerRelationsStore from '../zustand/CustomerRelations'; import { useShallow } from 'zustand/shallow'; import { fixTo2Decimals, isEmpty } from '@haina/utils-commons'; const Customer_care_regular = () => { const { date_picker_store, customer_store } = useContext(stores_Context); const regular_data = customer_store.regular_data; const [loading, loading2, searchValues, searchValuesToSub] = useCustomerRelationsStore(useShallow((state) => [state.loading, state.loading2, state.searchValues, state.searchValuesToSub])); const [setSearchValues] = useCustomerRelationsStore(useShallow((state) => [state.setSearchValues])); const [regular] = useCustomerRelationsStore(useShallow((state) => [state.regular])); const getRegularCustomer = useCustomerRelationsStore((state) => state.getRegularCustomer); const columns = [ { title: '订单号', dataIndex: 'COLI_ID', key: 'COLI_ID', }, { title: '预定日期', dataIndex: 'COLI_ApplyDate', key: 'COLI_ApplyDate', }, { title: '订单状态', width: '4rem', dataIndex: 'OrderState1', key: 'OrderState1', render: (text, record) => record.OrderState === 1 ? '成行' : '未成行', sorter: (a, b) => b.OrderState - a.OrderState, }, { title: '毛利', dataIndex: 'ML', key: 'ML', }, { title: '人数', dataIndex: 'PersonNum', key: 'PersonNum', }, { title: '天数', dataIndex: 'COLI_Days', key: 'COLI_Days', }, { title: '人天数', dataIndex: 'CGI_PersonDays', key: 'CGI_PersonDays', }, { title: '走团日期', dataIndex: 'COLI_OrderStartDate', key: 'COLI_OrderStartDate', }, { title: '走团国家', dataIndex: 'recommend_country', key: 'recommend_country', width: '4em', }, { title: '经过城市', dataIndex: 'PassCity_This', key: 'PassCity_This', }, { title: '小组', dataIndex: 'Department', key: 'Department', }, { title: '老客户', dataIndex: 'COLI_IsOld', key: 'COLI_IsOld', }, { title: '老客户推荐', dataIndex: 'COLI_IsCusCommend', key: 'COLI_IsCusCommend', }, { title: '国籍', dataIndex: 'MEI_Country', key: 'MEI_Country', }, { title: '网站', dataIndex: 'COLI_WebCode', key: 'COLI_WebCode', }, { title: '来源', dataIndex: 'SourceType', key: 'SourceType', }, { title: '页面类型', dataIndex: 'COLI_LineClass', key: 'COLI_LineClass', }, { title: '产品类型', dataIndex: 'TourType_Name', key: 'TourType_Name', }, { title: '券额', dataIndex: 'Voucher_amount', key: 'Voucher_amount', width: '4em', }, { title: '券类别', dataIndex: 'Voucher_type', key: 'Voucher_type', width: '5em', }, { title: '上次 订单号', dataIndex: 'coli_id_Last', key: 'coli_id_Last', width: '5em', onCell: (r) => ({ style: { backgroundColor: '#5B8FF9' + '1A' }, }), }, { title: '上次 走团日期', dataIndex: 'COLI_OrderStartDate_Last', key: 'COLI_OrderStartDate_Last', width: '4em', onCell: (_, r) => ({ style: { backgroundColor: '#5B8FF9' + '1A' } , }), }, { title: '上次 小组', dataIndex: 'Department_Last', key: 'Department_Last', width: '4em', onCell: (_, r) => ({ style: { backgroundColor: '#5B8FF9' + '1A' } , }), }, ]; const export_columns = [].concat(columns, [ { title: '上次经过国家', dataIndex: 'last_country', key: 'last_country', onCell: (r) => ({ style: { backgroundColor: '#5B8FF9' + '1A' }, }), }, { title: '上次经过城市', dataIndex: 'PassCity_Last', key: 'PassCity_Last', onCell: (r) => ({ style: { backgroundColor: '#5B8FF9' + '1A' }, }), }, { title: '复购周期', dataIndex: 'Repurchase_cycle', key: 'Repurchase_cycle', width: '4em', onCell: (_, r) => ({ style: { backgroundColor: '#5B8FF9' + '1A' }, }), }, { title: '下单次数', dataIndex: 'Orders_number', key: 'Orders_number', width: '4em', onCell: (_, r) => ({ style: { backgroundColor: '#5B8FF9' + '1A' }, }), }, { title: '推荐次数', dataIndex: 'recommend_time', key: 'recommend_time', width: '4em', onCell: (_, r) => ({ style: { backgroundColor: '#5B8FF9' + '1A' }, }), }, { title: '历史成行次数', dataIndex: 'Travel_count', key: 'Travel_count', width: '4em', onCell: (_, r) => ({ style: { backgroundColor: '#5B8FF9' + '1A' }, }), }, { title: '旅行周期', dataIndex: 'Travel_cycle', key: 'Travel_cycle', width: '4em', onCell: (_, r) => ({ style: { backgroundColor: '#5B8FF9' + '1A' }, }), }, { title: '第1次走团日期', dataIndex: 'firstStartdate', key: 'firstStartdate', width: '4em', onCell: (_, r) => ({ style: { backgroundColor: '#5B8FF9' + '1A' }, }), }, ]); return (