|
|
|
@ -1,9 +1,10 @@
|
|
|
|
|
import { Conditional } from '@/components/Conditional'
|
|
|
|
|
import useAuthStore from '@/stores/AuthStore'
|
|
|
|
|
import { PERM_MERGE_CONVERSATION } from '@/stores/AuthStore'
|
|
|
|
|
import useFormStore from '@/stores/FormStore'
|
|
|
|
|
import { useOrderStore } from '@/stores/OrderStore'
|
|
|
|
|
import { copy, isNotEmpty, isEmpty } from '@/utils/commons'
|
|
|
|
|
import { WhatsAppOutlined } from '@ant-design/icons'
|
|
|
|
|
import { WhatsAppOutlined, ImportOutlined } from '@ant-design/icons'
|
|
|
|
|
import {
|
|
|
|
|
App, Badge,
|
|
|
|
|
Empty,
|
|
|
|
@ -21,6 +22,25 @@ import AdvanceSearchForm from './AdvanceSearchForm';
|
|
|
|
|
|
|
|
|
|
function OrderGroupTable({ formValues }) {
|
|
|
|
|
|
|
|
|
|
const handleImportEmail = useCallback((order) => {
|
|
|
|
|
importEmailMessage({ orderId: order.COLI_SN, orderNumber: order.COLI_ID })
|
|
|
|
|
.then((result) => {
|
|
|
|
|
console.info(result)
|
|
|
|
|
notification.info({
|
|
|
|
|
message: 'Notification',
|
|
|
|
|
description: '订单邮件消息导入成功',
|
|
|
|
|
placement: 'top',
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.catch((ex) =>
|
|
|
|
|
notification.error({
|
|
|
|
|
message: 'Notification',
|
|
|
|
|
description: ex.message,
|
|
|
|
|
placement: 'top',
|
|
|
|
|
duration: 4,
|
|
|
|
|
}))
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
const orderColumns = [
|
|
|
|
|
{
|
|
|
|
|
title: '订单号',
|
|
|
|
@ -35,11 +55,14 @@ function OrderGroupTable({ formValues }) {
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Space>
|
|
|
|
|
<Conditional
|
|
|
|
|
condition={isPermitted(PERM_MERGE_CONVERSATION)}
|
|
|
|
|
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}
|
|
|
|
|
<Button color="default" variant="filled" size='small' onClick={() => {importEmailMessage({ orderId: record.COLI_SN, orderNumber: record.COLI_ID })}}>导入</Button>
|
|
|
|
|
</Space>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
@ -53,7 +76,7 @@ function OrderGroupTable({ formValues }) {
|
|
|
|
|
return (
|
|
|
|
|
<Space>
|
|
|
|
|
<Conditional
|
|
|
|
|
condition={isNotEmpty(record.coli_guest_WhatsApp)}
|
|
|
|
|
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}
|
|
|
|
@ -130,7 +153,9 @@ function OrderGroupTable({ formValues }) {
|
|
|
|
|
const orderList = useOrderStore((state) => state.orderList)
|
|
|
|
|
const fetchOrderList = useOrderStore((state) => state.fetchOrderList)
|
|
|
|
|
const importEmailMessage = useOrderStore((state) => state.importEmailMessage)
|
|
|
|
|
const loginUser = useAuthStore((state) => state.loginUser)
|
|
|
|
|
const [loginUser, isPermitted] = useAuthStore((state) => [
|
|
|
|
|
state.loginUser, state.isPermitted
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
let canSearch = true
|
|
|
|
|