|
|
|
@ -5,23 +5,15 @@ import useFormStore from '@/stores/FormStore'
|
|
|
|
|
import { useOrderStore } from '@/stores/OrderStore'
|
|
|
|
|
import { copy, isNotEmpty, isEmpty } from '@/utils/commons'
|
|
|
|
|
import { WhatsAppOutlined, ImportOutlined } from '@ant-design/icons'
|
|
|
|
|
import {
|
|
|
|
|
App, Badge,
|
|
|
|
|
Empty,
|
|
|
|
|
Flex,Button,
|
|
|
|
|
Radio, Space, Switch, Table,
|
|
|
|
|
Tabs, Divider,
|
|
|
|
|
Tag, Tooltip
|
|
|
|
|
} from 'antd'
|
|
|
|
|
import { App, Badge, Empty, Flex, Button, Radio, Space, Switch, Table, Tabs, Divider, Tag, Tooltip } from 'antd'
|
|
|
|
|
import dayjs from 'dayjs'
|
|
|
|
|
import { useCallback, useEffect, useState } from 'react'
|
|
|
|
|
import { Link } from 'react-router-dom'
|
|
|
|
|
import { useShallow } from 'zustand/react/shallow'
|
|
|
|
|
import { UNREAD_MARK } from '@/actions/ConversationActions';
|
|
|
|
|
import AdvanceSearchForm from './AdvanceSearchForm';
|
|
|
|
|
import { UNREAD_MARK } from '@/actions/ConversationActions'
|
|
|
|
|
import AdvanceSearchForm from './AdvanceSearchForm'
|
|
|
|
|
|
|
|
|
|
function OrderGroupTable({ formValues }) {
|
|
|
|
|
|
|
|
|
|
const handleImportEmail = useCallback((order) => {
|
|
|
|
|
importEmailMessage({ orderId: order.COLI_SN, orderNumber: order.COLI_ID })
|
|
|
|
|
.then((r) => {
|
|
|
|
@ -38,7 +30,8 @@ function OrderGroupTable({ formValues }) {
|
|
|
|
|
description: ex.message,
|
|
|
|
|
placement: 'top',
|
|
|
|
|
duration: 4,
|
|
|
|
|
}))
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
const orderColumns = [
|
|
|
|
@ -57,7 +50,7 @@ function OrderGroupTable({ formValues }) {
|
|
|
|
|
<Space>
|
|
|
|
|
<Conditional
|
|
|
|
|
condition={isPermitted(PERM_IMPORT_EMAIL)}
|
|
|
|
|
whenTrue={<Button type="default" shape="round" icon={<ImportOutlined />} size='small' onClick={() => handleImportEmail(record)} />}
|
|
|
|
|
whenTrue={<Button type='default' shape='round' icon={<ImportOutlined />} size='small' onClick={() => handleImportEmail(record)} />}
|
|
|
|
|
/>
|
|
|
|
|
<Link to={`/order/chat/${record.COLI_SN}`} state={record}>
|
|
|
|
|
{text}
|
|
|
|
@ -65,7 +58,7 @@ function OrderGroupTable({ formValues }) {
|
|
|
|
|
{tagIcon}
|
|
|
|
|
</Space>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '客人姓名',
|
|
|
|
@ -77,7 +70,11 @@ function OrderGroupTable({ formValues }) {
|
|
|
|
|
<Space>
|
|
|
|
|
<Conditional
|
|
|
|
|
condition={isPermitted(record.coli_guest_WhatsApp)}
|
|
|
|
|
whenTrue={<Tooltip title={record.coli_guest_WhatsApp}><WhatsAppOutlined className={['pl-1', record.last_received_time ? 'text-whatsapp' : 'text-neutral-500']} /></Tooltip>}
|
|
|
|
|
whenTrue={
|
|
|
|
|
<Tooltip title={record.coli_guest_WhatsApp}>
|
|
|
|
|
<WhatsAppOutlined className={['pl-1', record.last_received_time ? 'text-whatsapp' : 'text-neutral-500']} />
|
|
|
|
|
</Tooltip>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
{text + regularText}
|
|
|
|
|
<Badge
|
|
|
|
@ -88,7 +85,7 @@ function OrderGroupTable({ formValues }) {
|
|
|
|
|
/>
|
|
|
|
|
</Space>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '订单状态',
|
|
|
|
@ -106,18 +103,13 @@ function OrderGroupTable({ formValues }) {
|
|
|
|
|
{text}
|
|
|
|
|
</Space>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '报价 Title',
|
|
|
|
|
dataIndex: 'lettertitle',
|
|
|
|
|
ellipsis: true,
|
|
|
|
|
hidden: false,
|
|
|
|
|
// render: (text, record) => {
|
|
|
|
|
// return (
|
|
|
|
|
// <Tooltip title={text}>{text}</Tooltip>
|
|
|
|
|
// )
|
|
|
|
|
// }
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '出发日期',
|
|
|
|
@ -129,7 +121,7 @@ function OrderGroupTable({ formValues }) {
|
|
|
|
|
const datejsA = isEmpty(a.COLI_OrderStartDate) ? 0 : new dayjs(a.COLI_OrderStartDate).valueOf()
|
|
|
|
|
const datejsB = isEmpty(b.COLI_OrderStartDate) ? 0 : new dayjs(b.COLI_OrderStartDate).valueOf()
|
|
|
|
|
return datejsA - datejsB
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '客人最后一次回复时间',
|
|
|
|
@ -139,7 +131,7 @@ function OrderGroupTable({ formValues }) {
|
|
|
|
|
if (record.last_received_time) {
|
|
|
|
|
return new dayjs(record.last_received_time).format('YYYY-MM-DD HH:mm:ss')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '附加信息',
|
|
|
|
@ -153,9 +145,7 @@ function OrderGroupTable({ formValues }) {
|
|
|
|
|
const orderList = useOrderStore((state) => state.orderList)
|
|
|
|
|
const fetchOrderList = useOrderStore((state) => state.fetchOrderList)
|
|
|
|
|
const importEmailMessage = useOrderStore((state) => state.importEmailMessage)
|
|
|
|
|
const [loginUser, isPermitted] = useAuthStore((state) => [
|
|
|
|
|
state.loginUser, state.isPermitted
|
|
|
|
|
])
|
|
|
|
|
const [loginUser, isPermitted] = useAuthStore((state) => [state.loginUser, state.isPermitted])
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
let canSearch = true
|
|
|
|
@ -163,7 +153,7 @@ function OrderGroupTable({ formValues }) {
|
|
|
|
|
if (formValues.type === 'advance') {
|
|
|
|
|
const copyObject = copy(formValues)
|
|
|
|
|
delete copyObject.type
|
|
|
|
|
const allEmpty = Object.values(copyObject).every(val => {
|
|
|
|
|
const allEmpty = Object.values(copyObject).every((val) => {
|
|
|
|
|
return val === null || val === '' || val === undefined
|
|
|
|
|
})
|
|
|
|
|
if (allEmpty) {
|
|
|
|
@ -181,7 +171,7 @@ function OrderGroupTable({ formValues }) {
|
|
|
|
|
setLoading(true)
|
|
|
|
|
fetchOrderList(formValues, loginUser)
|
|
|
|
|
.finally(() => setLoading(false))
|
|
|
|
|
.catch(reason => {
|
|
|
|
|
.catch((reason) => {
|
|
|
|
|
notification.error({
|
|
|
|
|
message: '查询出错',
|
|
|
|
|
description: reason.message,
|
|
|
|
@ -196,12 +186,14 @@ function OrderGroupTable({ formValues }) {
|
|
|
|
|
showQuickJumper: true,
|
|
|
|
|
showLessItems: true,
|
|
|
|
|
showSizeChanger: true,
|
|
|
|
|
showTotal: (total) => { return `总数:${total}` }
|
|
|
|
|
showTotal: (total) => {
|
|
|
|
|
return `总数:${total}`
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function groupByParam(array, param) {
|
|
|
|
|
return array.reduce((result, item) => {
|
|
|
|
|
(result[item[param]] = result[item[param]] || []).push(item)
|
|
|
|
|
;(result[item[param]] = result[item[param]] || []).push(item)
|
|
|
|
|
return result
|
|
|
|
|
}, {})
|
|
|
|
|
}
|
|
|
|
@ -262,88 +254,75 @@ function OrderGroupTable({ formValues }) {
|
|
|
|
|
return o.coli_ordertype === 8
|
|
|
|
|
})
|
|
|
|
|
if (formValues.type === 'today') {
|
|
|
|
|
deptItems.push(
|
|
|
|
|
{
|
|
|
|
|
deptItems.push({
|
|
|
|
|
key: index,
|
|
|
|
|
label: deptMap.get(deptNo),
|
|
|
|
|
children: <>
|
|
|
|
|
children: (
|
|
|
|
|
<>
|
|
|
|
|
<Divider orientation='left'>新订单</Divider>
|
|
|
|
|
<Conditional
|
|
|
|
|
condition={newOrderList.length > 0}
|
|
|
|
|
whenTrue={<Table key={'newOrderTable' + deptNo} loading={loading} dataSource={newOrderList}
|
|
|
|
|
columns={orderColumns}
|
|
|
|
|
pagination={newOrderList.length <= 10 ? false : paginationProps} />}
|
|
|
|
|
whenTrue={<Table key={'newOrderTable' + deptNo} loading={loading} dataSource={newOrderList} columns={orderColumns} pagination={newOrderList.length <= 10 ? false : paginationProps} />}
|
|
|
|
|
whenFalse={<Empty />}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<Divider orientation='left'>新消息/老邮件</Divider>
|
|
|
|
|
<Conditional
|
|
|
|
|
condition={newMsgList.length > 0}
|
|
|
|
|
whenTrue={<Table key={'newMsgTable' + deptNo} loading={loading} dataSource={newMsgList}
|
|
|
|
|
columns={orderColumns}
|
|
|
|
|
pagination={newMsgList.length <= 10 ? false : paginationProps} />}
|
|
|
|
|
whenTrue={<Table key={'newMsgTable' + deptNo} loading={loading} dataSource={newMsgList} columns={orderColumns} pagination={newMsgList.length <= 10 ? false : paginationProps} />}
|
|
|
|
|
whenFalse={<Empty />}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<Divider orientation='left'>催信</Divider>
|
|
|
|
|
<Conditional
|
|
|
|
|
condition={followUpList.length > 0}
|
|
|
|
|
whenTrue={<Table key={'followUpTable' + deptNo} loading={loading} dataSource={followUpList}
|
|
|
|
|
columns={orderColumns}
|
|
|
|
|
pagination={followUpList.length <= 10 ? false : paginationProps} />}
|
|
|
|
|
whenTrue={<Table key={'followUpTable' + deptNo} loading={loading} dataSource={followUpList} columns={orderColumns} pagination={followUpList.length <= 10 ? false : paginationProps} />}
|
|
|
|
|
whenFalse={<Empty />}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<Divider orientation='left'>余款收付</Divider>
|
|
|
|
|
<Conditional
|
|
|
|
|
condition={paymentList.length > 0}
|
|
|
|
|
whenTrue={<Table key={'paymentTable' + deptNo} loading={loading} dataSource={paymentList}
|
|
|
|
|
columns={orderColumns}
|
|
|
|
|
pagination={paymentList.length <= 10 ? false : paginationProps} />}
|
|
|
|
|
whenTrue={<Table key={'paymentTable' + deptNo} loading={loading} dataSource={paymentList} columns={orderColumns} pagination={paymentList.length <= 10 ? false : paginationProps} />}
|
|
|
|
|
whenFalse={<Empty />}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<Divider orientation='left'>入境提醒</Divider>
|
|
|
|
|
<Conditional
|
|
|
|
|
condition={entryList.length > 0}
|
|
|
|
|
whenTrue={<Table key={'entryTable' + deptNo} loading={loading} dataSource={entryList}
|
|
|
|
|
columns={orderColumns}
|
|
|
|
|
pagination={entryList.length <= 10 ? false : paginationProps} /> }
|
|
|
|
|
whenTrue={<Table key={'entryTable' + deptNo} loading={loading} dataSource={entryList} columns={orderColumns} pagination={entryList.length <= 10 ? false : paginationProps} />}
|
|
|
|
|
whenFalse={<Empty />}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
deptItems.push(
|
|
|
|
|
{
|
|
|
|
|
deptItems.push({
|
|
|
|
|
key: index,
|
|
|
|
|
label: deptMap.get(deptNo),
|
|
|
|
|
children: <>
|
|
|
|
|
<Table key={'advanceOrderTable' + deptNo} loading={loading} dataSource={deptOrderList}
|
|
|
|
|
columns={orderColumns}
|
|
|
|
|
pagination={deptOrderList.length <= 10 ? false : paginationProps} />
|
|
|
|
|
children: (
|
|
|
|
|
<>
|
|
|
|
|
<Table key={'advanceOrderTable' + deptNo} loading={loading} dataSource={deptOrderList} columns={orderColumns} pagination={deptOrderList.length <= 10 ? false : paginationProps} />
|
|
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Conditional
|
|
|
|
|
condition={orderList.length > 0}
|
|
|
|
|
whenTrue={<Tabs defaultActiveKey={0} items={deptItems} />}
|
|
|
|
|
whenFalse={<Empty />}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
return <Conditional condition={orderList.length > 0} whenTrue={<Tabs defaultActiveKey={0} items={deptItems} />} whenFalse={<Empty />} />
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Follow() {
|
|
|
|
|
|
|
|
|
|
const [formValues, setFormValues] = useFormStore(useShallow((state) => [state.orderFollowForm, state.setOrderFollowForm]))
|
|
|
|
|
const [advanceChecked, toggleAdvance] = useFormStore(useShallow((state) => [state.orderFollowAdvanceChecked, state.setOrderFollowAdvanceChecked]))
|
|
|
|
|
|
|
|
|
|
const batchImportEmailMessage = useOrderStore((state) => state.batchImportEmailMessage)
|
|
|
|
|
const [isPermitted] = useAuthStore((state) => [state.isPermitted])
|
|
|
|
|
|
|
|
|
|
const handleImportEmail = useCallback(() => {
|
|
|
|
|
batchImportEmailMessage()
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
const handleSubmit = useCallback((values) => {
|
|
|
|
|
setFormValues({ ...values, type: 'advance' })
|
|
|
|
|
}, [])
|
|
|
|
@ -359,25 +338,34 @@ function Follow() {
|
|
|
|
|
{ label: '次重点客户', value: 'qianli' },
|
|
|
|
|
{ label: '成行', value: 'chengxing' },
|
|
|
|
|
{ label: '走团中', value: 'zoutuan' },
|
|
|
|
|
{ label: '走团后一月', value: 'zoutuanhou' }
|
|
|
|
|
{ label: '走团后一月', value: 'zoutuanhou' },
|
|
|
|
|
]}
|
|
|
|
|
value={formValues.type}
|
|
|
|
|
onChange={({ target: { value } }) => {
|
|
|
|
|
setFormValues({
|
|
|
|
|
...formValues,
|
|
|
|
|
type: value
|
|
|
|
|
type: value,
|
|
|
|
|
})
|
|
|
|
|
}}
|
|
|
|
|
optionType='button'
|
|
|
|
|
buttonStyle='solid'
|
|
|
|
|
disabled={advanceChecked}
|
|
|
|
|
/>
|
|
|
|
|
<Switch checkedChildren='高级查询' unCheckedChildren='高级查询'
|
|
|
|
|
<Switch
|
|
|
|
|
checkedChildren='高级查询'
|
|
|
|
|
unCheckedChildren='高级查询'
|
|
|
|
|
checked={advanceChecked}
|
|
|
|
|
onChange={() => { toggleAdvance(!advanceChecked) }} />
|
|
|
|
|
</Flex>
|
|
|
|
|
<Conditional condition={advanceChecked} whenTrue={<AdvanceSearchForm onSubmit={handleSubmit} initialValues={formValues} />}
|
|
|
|
|
onChange={() => {
|
|
|
|
|
toggleAdvance(!advanceChecked)
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<Conditional
|
|
|
|
|
condition={isPermitted(PERM_IMPORT_EMAIL)}
|
|
|
|
|
whenTrue={<Button type='default' shape='round' icon={<ImportOutlined />} size='small' onClick={handleImportEmail}/>}
|
|
|
|
|
/>
|
|
|
|
|
</Flex>
|
|
|
|
|
<Conditional condition={advanceChecked} whenTrue={<AdvanceSearchForm onSubmit={handleSubmit} initialValues={formValues} />} />
|
|
|
|
|
<OrderGroupTable formValues={formValues} />
|
|
|
|
|
</Space>
|
|
|
|
|
</>
|
|
|
|
|