diff --git a/src/hooks/useEmail.js b/src/hooks/useEmail.js index 41c4c00..892ef4c 100644 --- a/src/hooks/useEmail.js +++ b/src/hooks/useEmail.js @@ -415,8 +415,7 @@ export const useEmailTemplate = (templateKey, params) => { return { loading, error, templateContent }; } -export const mailboxSystemDirs = () => { - return [ +export const mailboxSystemDirs = [ { key: 1, value: 1, label: '收件箱' }, { key: 2, value: 2, label: '未读邮件' }, { key: 3, value: 3, label: '已发邮件' }, @@ -425,4 +424,4 @@ export const mailboxSystemDirs = () => { { key: 6, value: 6, label: '垃圾邮件' }, { key: 7, value: 7, label: '已处理邮件' }, ] -} + diff --git a/src/views/orders/components/MailOrderSearchModal.jsx b/src/views/orders/components/MailOrderSearchModal.jsx index c040f4b..76cef9e 100644 --- a/src/views/orders/components/MailOrderSearchModal.jsx +++ b/src/views/orders/components/MailOrderSearchModal.jsx @@ -1,10 +1,11 @@ import { createContext, useEffect, useState } from 'react' import { ReloadOutlined, ReadOutlined, RightOutlined, LeftOutlined, SearchOutlined, MailOutlined } from '@ant-design/icons' -import { Button, Modal, Form, Input, Checkbox, Select, Radio, DatePicker, Divider, Typography } from 'antd' +import { Button, Modal, Form, Input, Checkbox, Select, Radio, DatePicker, Divider, Typography, Flex } from 'antd' import dayjs from 'dayjs' -import { getEmailDirAction, queryHTOrderListAction, } from '@/actions/EmailActions' +import { getEmailDirAction, queryHTOrderListAction, queryInMailboxAction } from '@/actions/EmailActions' import { isEmpty, objectMapper, pick } from '@/utils/commons' import useConversationStore from '@/stores/ConversationStore' +import { mailboxSystemDirs } from '@/hooks/useEmail' const MailOrderSearchModal = ({ ...props }) => { const [currentMailboxOPI] = useConversationStore((state) => [state.currentMailboxOPI]) @@ -19,7 +20,7 @@ const MailOrderSearchModal = ({ ...props }) => { setLoading(true) const valuesToSub = objectMapper(values, { year: { key: 'year', transform: (val) => (val ? dayjs(val).year() : '') }, - important: { key: 'important', transform: (val) => (val || '-1') }, + important: { key: 'important', transform: (val) => val || '-1' }, by_success: { key: 'by_success', transform: (val) => (val ? '1' : '0') }, if_want_book: { key: 'if_want_book', transform: (val) => (val ? '1' : '0') }, if_thinking: { key: 'if_thinking', transform: (val) => (val ? '1' : '0') }, @@ -27,23 +28,31 @@ const MailOrderSearchModal = ({ ...props }) => { coli_id: { key: 'coli_id', transform: (val) => (val ? val : '') }, is_biz: { key: 'sourcetype', transform: (val) => (val ? '227002' : '227001') }, }) - let result; + let result if (isEmpty(valuesToSub.coli_id)) { - const { coli_id, sourcetype, ...mailboxParams} = valuesToSub; + const { coli_id, sourcetype, ...mailboxParams } = valuesToSub result = await getEmailDirAction({ ...mailboxParams, opi_sn: currentMailboxOPI }, false) updateCurrentMailboxNestedDirs(result[`${currentMailboxOPI}`]) } else { - const htOrderParams = pick(valuesToSub, ['coli_id', 'sourcetype',]) - result = await queryHTOrderListAction({...htOrderParams, opi_sn: currentMailboxOPI}) + const htOrderParams = pick(valuesToSub, ['coli_id', 'sourcetype']) + result = await queryHTOrderListAction({ ...htOrderParams, opi_sn: currentMailboxOPI }) const addToTree = { key: 'search-orders', title: '搜索结果', iconIndex: 'search', _raw: { COLI_SN: 0, IsTrue: 0 }, - children: result.map((o) => ({ key: `search-${o.COLI_SN}`, title: `${o.COLI_ID}`, iconIndex: 13, parent: 'search-orders', parentTitle: '搜索结果', parentIconIndex: 'search', _raw: { ...o, VKey: o.COLI_SN, VName: o.COLI_ID, VParent: 'search-orders', IsTrue: 0, ApplyDate: '', OrderSourceType: htOrderParams.sourcetype, parent: 'search-orders' }, })), + children: result.map((o) => ({ + key: `search-${o.COLI_SN}`, + title: `${o.COLI_ID}`, + iconIndex: 13, + parent: 'search-orders', + parentTitle: '搜索结果', + parentIconIndex: 'search', + _raw: { ...o, VKey: o.COLI_SN, VName: o.COLI_ID, VParent: 'search-orders', IsTrue: 0, ApplyDate: '', OrderSourceType: htOrderParams.sourcetype, parent: 'search-orders' }, + })), } - updateCurrentMailboxNestedDirs([addToTree]); - setMailboxActiveNode(addToTree); + updateCurrentMailboxNestedDirs([addToTree]) + setMailboxActiveNode(addToTree) } setLoading(false) setOpen(false) @@ -55,19 +64,19 @@ const MailOrderSearchModal = ({ ...props }) => { setOpen(false)} - // footer={null} + footer={null} destroyOnHidden modalRender={(dom) => (
{ {dom}
)}> - - - - - - -
- - 成行订单 - - - 要预定 - - - 犹豫中 - -
- - 按出发日期 - -
- -
+ +
+ 按订单的时间范围 + + + + + + +
+ + 成行订单 + + + 要预定 + + + 犹豫中 + +
+ + 按出发日期 + +
+ +
- - 查找订单 - - - - - 商务订单 - + + 订单号精确查找 + + + + + 商务订单 + +
+ +
+ +
+
)