|
|
|
@ -41,189 +41,7 @@ import AdvanceSearchForm from './AdvanceSearchForm'
|
|
|
|
|
import EmailDetailInline from '../Conversations/Online/Components/EmailDetailInline'
|
|
|
|
|
|
|
|
|
|
function OrderGroupTable({ formValues }) {
|
|
|
|
|
const handleImportEmail = useCallback((order) => {
|
|
|
|
|
importEmailMessage({ orderId: order.COLI_SN, orderNumber: order.COLI_ID })
|
|
|
|
|
.then((r) => {
|
|
|
|
|
console.info(r)
|
|
|
|
|
notification.info({
|
|
|
|
|
message: 'Notification',
|
|
|
|
|
description: '订单:' + order.COLI_ID + ' 导入' + r.result.length + '条邮件消息',
|
|
|
|
|
placement: 'top',
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.catch((ex) =>
|
|
|
|
|
notification.error({
|
|
|
|
|
message: 'Notification',
|
|
|
|
|
description: ex.message,
|
|
|
|
|
placement: 'top',
|
|
|
|
|
duration: 4,
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
const orderColumns = [
|
|
|
|
|
{
|
|
|
|
|
title: '订单号',
|
|
|
|
|
dataIndex: 'COLI_ID',
|
|
|
|
|
width: 222,
|
|
|
|
|
render: (text, record) => {
|
|
|
|
|
let tagIcon = ''
|
|
|
|
|
|
|
|
|
|
if (record.COLI_LineGrade === 240003) tagIcon = <Tag color='red'>重点</Tag>
|
|
|
|
|
else if (record.COLI_LineGrade === 240002) tagIcon = <Tag color='green'>次重点</Tag>
|
|
|
|
|
else if (record.COLI_LineGrade === 240001) tagIcon = <Tag color='blue'>一般</Tag>
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Space>
|
|
|
|
|
<Conditional
|
|
|
|
|
condition={isPermitted(PERM_IMPORT_EMAIL)}
|
|
|
|
|
whenTrue={<Button type='default' shape='round' icon={<ImportOutlined />} size='small' onClick={() => handleImportEmail(record)} />}
|
|
|
|
|
/>
|
|
|
|
|
<Link to={`/order/chat/${record.COLI_SN}`} state={record}>
|
|
|
|
|
{text}
|
|
|
|
|
</Link>
|
|
|
|
|
{tagIcon}
|
|
|
|
|
</Space>
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '客人姓名',
|
|
|
|
|
dataIndex: 'coli_guest',
|
|
|
|
|
render: (text, record) => {
|
|
|
|
|
let regularText = ''
|
|
|
|
|
if (record.buytime > 0) regularText = '(R' + record.buytime + ')'
|
|
|
|
|
return (
|
|
|
|
|
<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>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
{text + regularText}
|
|
|
|
|
<Badge
|
|
|
|
|
count={record.unread_msg >= UNREAD_MARK ? ' ' : record.unread_msg}
|
|
|
|
|
style={{
|
|
|
|
|
backgroundColor: '#52c41a',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</Space>
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '订单状态',
|
|
|
|
|
dataIndex: 'COLI_State',
|
|
|
|
|
width: 140,
|
|
|
|
|
render: (text, record) => {
|
|
|
|
|
let extra = ''
|
|
|
|
|
if (record.coli_ordertype === 3 || record.coli_ordertype === 4 || record.coli_ordertype === 5) {
|
|
|
|
|
extra = '(' + (record.coli_ordertype - 2) + '催)'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Space>
|
|
|
|
|
{extra}
|
|
|
|
|
{text}
|
|
|
|
|
</Space>
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '报价 Title',
|
|
|
|
|
dataIndex: 'lettertitle',
|
|
|
|
|
ellipsis: true,
|
|
|
|
|
hidden: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '出发日期',
|
|
|
|
|
dataIndex: 'COLI_OrderStartDate',
|
|
|
|
|
width: 120,
|
|
|
|
|
hidden: false,
|
|
|
|
|
sortDirections: ['ascend', 'descend'],
|
|
|
|
|
sorter: (a, b) => {
|
|
|
|
|
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: '客人最后一次回复时间',
|
|
|
|
|
dataIndex: 'last_received_time',
|
|
|
|
|
width: 180,
|
|
|
|
|
render: (text, record) => {
|
|
|
|
|
if (record.last_received_time) {
|
|
|
|
|
return new dayjs(record.last_received_time).format('YYYY-MM-DD HH:mm:ss')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '附加信息',
|
|
|
|
|
ellipsis: true,
|
|
|
|
|
dataIndex: 'COLI_Introduction',
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
const { notification } = App.useApp()
|
|
|
|
|
const [loading, setLoading] = useState(false)
|
|
|
|
|
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])
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
let canSearch = true
|
|
|
|
|
|
|
|
|
|
if (formValues.type === 'advance') {
|
|
|
|
|
const copyObject = copy(formValues)
|
|
|
|
|
delete copyObject.type
|
|
|
|
|
const allEmpty = Object.values(copyObject).every((val) => {
|
|
|
|
|
return val === null || val === '' || val === undefined
|
|
|
|
|
})
|
|
|
|
|
if (allEmpty) {
|
|
|
|
|
canSearch = false
|
|
|
|
|
notification.warning({
|
|
|
|
|
message: '温馨提示',
|
|
|
|
|
description: '请输入至少一个条件',
|
|
|
|
|
placement: 'top',
|
|
|
|
|
duration: 60,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (canSearch) {
|
|
|
|
|
setLoading(true)
|
|
|
|
|
fetchOrderList(formValues, loginUser)
|
|
|
|
|
.finally(() => setLoading(false))
|
|
|
|
|
.catch((reason) => {
|
|
|
|
|
notification.error({
|
|
|
|
|
message: '查询出错',
|
|
|
|
|
description: reason.message,
|
|
|
|
|
placement: 'top',
|
|
|
|
|
duration: 60,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}, [formValues])
|
|
|
|
|
|
|
|
|
|
const paginationProps = {
|
|
|
|
|
showQuickJumper: true,
|
|
|
|
|
showLessItems: true,
|
|
|
|
|
showSizeChanger: true,
|
|
|
|
|
showTotal: (total) => {
|
|
|
|
|
return `总数:${total}`
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function groupByParam(array, param) {
|
|
|
|
|
return array.reduce((result, item) => {
|
|
|
|
|
;(result[item[param]] = result[item[param]] || []).push(item)
|
|
|
|
|
return result
|
|
|
|
|
}, {})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const deptMap = new Map([
|
|
|
|
|
['1', 'CH直销组'],
|
|
|
|
@ -258,85 +76,6 @@ function OrderGroupTable({ formValues }) {
|
|
|
|
|
['35', 'newsletter营销'],
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
const groupOrderData = groupByParam(orderList, 'OPI_DEI_SN')
|
|
|
|
|
const deptKeys = Object.keys(groupOrderData)
|
|
|
|
|
const deptItems = []
|
|
|
|
|
|
|
|
|
|
deptKeys.forEach((deptNo, index) => {
|
|
|
|
|
const deptOrderList = groupOrderData[deptNo]
|
|
|
|
|
// 1新订单;2未读消息;3需一催;4需二催;5需三催;6未处理邮件;入境提醒coli_ordertype=7,余款提醒coli_ordertype=8
|
|
|
|
|
const newOrderList = deptOrderList.filter((o) => {
|
|
|
|
|
return o.coli_ordertype === 1
|
|
|
|
|
})
|
|
|
|
|
const newMsgList = deptOrderList.filter((o) => {
|
|
|
|
|
return o.coli_ordertype === 2 || o.coli_ordertype === 6
|
|
|
|
|
})
|
|
|
|
|
const followUpList = deptOrderList.filter((o) => {
|
|
|
|
|
return o.coli_ordertype === 3 || o.coli_ordertype === 4 || o.coli_ordertype === 5
|
|
|
|
|
})
|
|
|
|
|
const entryList = deptOrderList.filter((o) => {
|
|
|
|
|
return o.coli_ordertype === 7
|
|
|
|
|
})
|
|
|
|
|
const paymentList = deptOrderList.filter((o) => {
|
|
|
|
|
return o.coli_ordertype === 8
|
|
|
|
|
})
|
|
|
|
|
if (formValues.type === 'today') {
|
|
|
|
|
deptItems.push({
|
|
|
|
|
key: index,
|
|
|
|
|
label: deptMap.get(deptNo),
|
|
|
|
|
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} />}
|
|
|
|
|
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} />}
|
|
|
|
|
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} />}
|
|
|
|
|
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} />}
|
|
|
|
|
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} />}
|
|
|
|
|
whenFalse={<Empty />}
|
|
|
|
|
/>
|
|
|
|
|
</>
|
|
|
|
|
),
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
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} />
|
|
|
|
|
</>
|
|
|
|
|
),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return <Conditional condition={orderList.length > 0} whenTrue={<Tabs defaultActiveKey={0} items={deptItems} />} whenFalse={<Empty />} />
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Follow() {
|
|
|
|
@ -377,7 +116,7 @@ const [collapsed, setCollapsed] = useState(false)
|
|
|
|
|
onSelect={(selectedKeys, e) => {
|
|
|
|
|
console.info('selectedKeys: ', selectedKeys)
|
|
|
|
|
}}
|
|
|
|
|
defaultExpandedKeys={['0-0-today-task', '0-1-todo-task']}
|
|
|
|
|
defaultExpandedKeys={['0-0-today-task', '0-1-todo-list']}
|
|
|
|
|
defaultSelectedKeys={['0-0-0']}
|
|
|
|
|
treeData={[
|
|
|
|
|
{
|
|
|
|
@ -397,7 +136,7 @@ const [collapsed, setCollapsed] = useState(false)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '待办任务',
|
|
|
|
|
key: '0-1-todo-task',
|
|
|
|
|
key: '0-1-todo-list',
|
|
|
|
|
icon: <CalendarTwoTone />,
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
@ -494,7 +233,7 @@ const [collapsed, setCollapsed] = useState(false)
|
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
</Flex></Layout.Sider>
|
|
|
|
|
<Layout.Content>
|
|
|
|
|
<Layout.Content style={{ maxHeight: 'calc(100vh - 166px)', height: 'calc(100vh - 166px)', minWidth: '360px' }}>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Row>
|
|
|
|
@ -671,7 +410,7 @@ const [collapsed, setCollapsed] = useState(false)
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
renderItem={item => (
|
|
|
|
|
<List.Item
|
|
|
|
|
<List.Item className={item.key===activeEmailId?`bg-blue-100`:''}
|
|
|
|
|
key={item.title}
|
|
|
|
|
// actions={[
|
|
|
|
|
// <a key="list-vertical-star-o">回复</a>,
|
|
|
|
@ -701,9 +440,7 @@ const [collapsed, setCollapsed] = useState(false)
|
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
|
|
</Layout.Content>
|
|
|
|
|
<Layout.Sider zeroWidthTriggerStyle={{top: '30px'}} width='280' style={{
|
|
|
|
|
backgroundColor: '#fff',
|
|
|
|
|
}} collapsible collapsed={collapsed} onCollapse={value => setCollapsed(value)} collapsedWidth={0} reverseArrow={true}>
|
|
|
|
|
<Layout.Sider zeroWidthTriggerStyle={{top: '30px'}} width='280' theme={'light'} style={{ maxHeight: 'calc(100vh - 166px)', height: 'calc(100vh - 166px)' }} collapsible collapsed={collapsed} onCollapse={value => setCollapsed(value)} collapsedWidth={0} reverseArrow={true}>
|
|
|
|
|
<Flex gap={6} vertical={true} justify='space-between'>
|
|
|
|
|
<Typography.Text>
|
|
|
|
|
<FieldNumberOutlined className='pr-1' />
|
|
|
|
|