import { memo, useCallback, useEffect, useState } from 'react' import { Badge, Divider, Table, Button, Input, Space, Tag, Radio, Select, Flex, Form, Switch, DatePicker, App } from 'antd' import { Conditional } from '@/components/Conditional' import { useAuthContext } from '@/stores/AuthContext' const { RangePicker } = DatePicker const AdvanceSearchForm = memo(function ({ onSubmit }) { const [form] = Form.useForm() function handleSubmit(values) { onSubmit?.(values) } return (
) }) function OrderList({ formValues }) { const orderColumns = [ { title: '订单号', dataIndex: 'COLI_ID', width: 222, render: (text, record, index) => { if (record.COLI_LineGrade === 240003) return {text}重点 else if (record.COLI_LineGrade === 240002) return {text}潜力 else if (record.COLI_LineGrade === 240001) return {text}休眠 else return {text} } }, { title: '客人姓名', dataIndex: 'coli_guest', render: (text, record) => { let regularText = '' if (record.buytime > 0) regularText = '(R' + record.buytime + ')' return ( {text + regularText} ) } }, { title: '订单状态', dataIndex: 'COLI_State', width: 120, render: (text, record) => { let extra = '' if (record.RemindState === 1) extra = '(一催)' if (record.RemindState === 2) extra = '(二催)' if (record.RemindState === 3) extra = '(三催)' return text + extra } }, { title: '报价title', dataIndex: 'lettertitle', ellipsis: true, }, { title: '客人最后一次回复时间', dataIndex: 'last_received_time', }, { title: '附加信息', dataIndex: 'COLI_Introduction', }, ] const { notification } = App.useApp() const [orderData, setOrderData] = useState([]) const [loading, setLoading] = useState(false) const { loginUser } = useAuthContext() useEffect(() => { setLoading(true) fetch(`http://202.103.68.157:8888/gettodayorder?opisn=${loginUser.userId}`) .then(response => response.json()) .then(json => { if (json.errcode === 0) { setOrderData(json.result.map((order) => { return {...order, key: order.COLI_ID}})) } else { notification.error({ message: '查询出错', description: json?.errmsg, placement: 'top', duration: 60, }) } }) .finally(() => setLoading(false)) .catch(reason => { notification.error({ message: '查询出错', description: reason.message, placement: 'top', duration: 60, }) }) }, [formValues]) return ( ) } function OrderFollow() { const [advanceChecked, toggleAdvance] = useState(false) const [formValues, setFormValues] = useState({ type: 'today', orderStatus: '新状态', orderNumber: '订单号', orderLabel: '订单标签', startDate: '走团时间' }) const handleSubmit = useCallback((values) => { setFormValues({...values, type: 'advance'}) }, []) return ( <> { setFormValues({ ...formValues, type: value }) }} optionType='button' buttonStyle='solid' disabled={advanceChecked} /> { toggleAdvance(!advanceChecked) }} /> } /> ) } export default OrderFollow