diff --git a/src/stores/OrderStore.js b/src/stores/OrderStore.js
index 009752e..a9651fc 100644
--- a/src/stores/OrderStore.js
+++ b/src/stores/OrderStore.js
@@ -139,6 +139,27 @@ export const useOrderStore = create(devtools((set, get) => ({
})
},
+ batchImportEmailMessage: () => {
+ const { orderList } = get()
+
+ const orderPromiseList = orderList.map(order => {
+ return new Promise((resolve, reject) => {
+ fetchJSON(`${API_HOST}/generate_email_msg`, { coli_sn: order.COLI_SN, coli_id: order.COLI_ID })
+ .then(json => {
+ if (json.errcode === 0) {
+ resolve(json)
+ } else {
+ reject(json?.errmsg + ': ' + json.errcode)
+ }
+ })
+ })
+ })
+
+ Promise.all(orderPromiseList).then((values) => {
+ console.log(values);
+ })
+ },
+
fetchOtherEmail: (coli_sn) => {
return fetchJSON(`${EMAIL_HOST}/email_supplier`, { coli_sn })
.then(json => {
diff --git a/src/views/orders/Follow.jsx b/src/views/orders/Follow.jsx
index 8aae0c1..e09f4a8 100644
--- a/src/views/orders/Follow.jsx
+++ b/src/views/orders/Follow.jsx
@@ -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 }) {
} size='small' onClick={() => handleImportEmail(record)} />}
+ whenTrue={} size='small' onClick={() => handleImportEmail(record)} />}
/>
{text}
@@ -65,7 +58,7 @@ function OrderGroupTable({ formValues }) {
{tagIcon}
)
- }
+ },
},
{
title: '客人姓名',
@@ -77,7 +70,11 @@ function OrderGroupTable({ formValues }) {
}
+ whenTrue={
+
+
+
+ }
/>
{text + regularText}
)
- }
+ },
},
{
title: '订单状态',
@@ -106,18 +103,13 @@ function OrderGroupTable({ formValues }) {
{text}
)
- }
+ },
},
{
title: '报价 Title',
dataIndex: 'lettertitle',
ellipsis: true,
hidden: false,
- // render: (text, record) => {
- // return (
- // {text}
- // )
- // }
},
{
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(
- {
- key: index,
- label: deptMap.get(deptNo),
- children: <>
+ deptItems.push({
+ key: index,
+ label: deptMap.get(deptNo),
+ children: (
+ <>
新订单
0}
- whenTrue={}
+ whenTrue={}
whenFalse={}
/>
新消息/老邮件
0}
- whenTrue={}
+ whenTrue={}
whenFalse={}
/>
催信
0}
- whenTrue={}
+ whenTrue={}
whenFalse={}
/>
余款收付
0}
- whenTrue={}
+ whenTrue={}
whenFalse={}
/>
入境提醒
0}
- whenTrue={ }
+ whenTrue={}
whenFalse={}
/>
-
>
- }
- )
+ ),
+ })
} else {
- deptItems.push(
- {
- key: index,
- label: deptMap.get(deptNo),
- children: <>
-
+ deptItems.push({
+ key: index,
+ label: deptMap.get(deptNo),
+ children: (
+ <>
+
>
- }
- )
+ ),
+ })
}
})
- return (
- 0}
- whenTrue={}
- whenFalse={}
- />
- )
+ return 0} whenTrue={} whenFalse={} />
}
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}
/>
- { toggleAdvance(!advanceChecked) }} />
+ onChange={() => {
+ toggleAdvance(!advanceChecked)
+ }}
+ />
+
+ } size='small' onClick={handleImportEmail}/>}
+ />
- }
- />
+ } />
>