Merge remote-tracking branch 'origin/main' into dev/chat

dev/chat
Lei OT 1 year ago
commit 02cc765e9a

@ -61,17 +61,22 @@ const useOrderStore = create((set, get) => ({
},
fetchOrderDetail: async (colisn) => {
const json = await fetchJSON(`${API_HOST}/getorderinfo`, { colisn })
if (json.errcode === 0 && json.result.length > 0) {
const orderResult = json.result[0]
set(() => ({
orderDetail: orderResult,
customerDetail: orderResult.contact.length > 0 ? orderResult.contact[0] : {},
lastQuotation: orderResult.quotes.length > 0 ? orderResult.quotes[0] : {},
quotationList: orderResult.quotes,
}))
}
fetchOrderDetail: (colisn) => {
return fetchJSON(`${API_HOST}/getorderinfo`, { colisn })
.then(json => {
if (json.errcode === 0 && json.result.length > 0) {
const orderResult = json.result[0]
set(() => ({
orderDetail: orderResult,
customerDetail: orderResult.contact.length > 0 ? orderResult.contact[0] : {},
lastQuotation: orderResult.quotes.length > 0 ? orderResult.quotes[0] : {},
quotationList: orderResult.quotes,
}))
} else {
throw new Error(json?.errmsg + ': ' + json.errcode)
}
})
},
setOrderPropValue: async (colisn, propName, value) => {

@ -1,6 +1,6 @@
import { LinkOutlined, MailOutlined, PhoneOutlined, UserOutlined, WhatsAppOutlined } from '@ant-design/icons'
import { App, Button, Card, Empty, Flex, Select, Typography } from 'antd'
import { useEffect } from 'react'
import { App, Button, Card, Empty, Flex, Select, Spin, Typography } from 'antd'
import { useEffect, useState } from 'react'
import { Conditional } from '@/components/Conditional'
import useConversationStore from '@/stores/ConversationStore'
@ -9,13 +9,26 @@ import QuotesHistory from './QuotesHistory'
const CustomerProfile = (() => {
const { notification } = App.useApp()
const [loading, setLoading] = useState(false)
const currentOrder = useConversationStore((state) => state.currentConversation?.coli_sn || '')
const { orderDetail, customerDetail, lastQuotation, quotationList,
fetchOrderDetail, setOrderPropValue
} = useOrderStore()
useEffect(() => {
if (currentOrder) fetchOrderDetail(currentOrder)
if (currentOrder) {
setLoading(true)
fetchOrderDetail(currentOrder)
.finally(() => setLoading(false))
.catch(reason => {
notification.error({
message: '查询出错',
description: reason.message,
placement: 'top',
duration: 60,
})
})
}
}, [currentOrder])
let regularText = ''
@ -24,6 +37,7 @@ const CustomerProfile = (() => {
if (currentOrder) {
return (
<div className=' divide-x-0 divide-y divide-dashed divide-gray-300 '>
<Spin spinning={loading}>
<Card className='p-2 '
bordered={false}
title={orderDetail.order_no}
@ -90,6 +104,7 @@ const CustomerProfile = (() => {
}/>
</Flex>
<p className='p-2 shadow-inner overflow-auto m-0 break-words whitespace-pre-wrap' dangerouslySetInnerHTML={{__html: orderDetail.order_detail}}></p>
</Spin>
</div>
)
} else {

@ -112,7 +112,8 @@ const AdvanceSearchForm = memo(function noName({ initialValues, onSubmit }) {
{ value: '4', label: '等待付订金' },
{ value: '5', label: '成行' },
{ value: '6', label: '丢失' },
{ value: '7', label: '取消' }
{ value: '7', label: '取消' },
{ value: '8', label: '未报价' }
]}
/>
</Form.Item>
@ -187,7 +188,10 @@ function OrderGroupTable({ formValues }) {
if (record.buytime > 0) regularText = '(R' + record.buytime + ')'
return (
<Space>
{isNotEmpty(record.coli_guest_WhatsApp) && <WhatsAppOutlined className={['pl-1', record.last_received_time ? 'text-whatsapp' : 'text-neutral-500']} />}
<Conditional
condition={isNotEmpty(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}
@ -202,7 +206,7 @@ function OrderGroupTable({ formValues }) {
{
title: '订单状态',
dataIndex: 'COLI_State',
width: 150,
width: 120,
render: (text, record) => {
// 1<InfoCircleTwoTone />2<MessageTwoTone />345<PhoneTwoTone />6<MailTwoTone />
const needTo = '要催信' + (record.coli_ordertype - 2)
@ -221,16 +225,35 @@ function OrderGroupTable({ formValues }) {
}
},
{
title: '报价title',
title: '报价 Title',
dataIndex: 'lettertitle',
ellipsis: true,
hidden: false,
// render: (text, record) => {
// return (
// <Tooltip title={text}>{text}</Tooltip>
// )
// }
},
{
title: '出发日期',
dataIndex: 'COLI_OrderStartDate',
width: 120,
hidden: false
},
{
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',
},
]

Loading…
Cancel
Save