|
|
|
@ -1,19 +1,23 @@
|
|
|
|
|
import { LinkOutlined, MailOutlined, PhoneOutlined, UserOutlined, WhatsAppOutlined } from '@ant-design/icons'
|
|
|
|
|
import { App, Button, Card, Empty, Flex, Select, Spin, Typography } from 'antd'
|
|
|
|
|
import { useEffect, useState } from 'react'
|
|
|
|
|
import { App, Button, Card, Empty, Flex, Select, Spin, Typography, Divider, Modal } from 'antd'
|
|
|
|
|
import { useEffect, useState, useRef } from 'react'
|
|
|
|
|
|
|
|
|
|
import { copy, isNotEmpty } from '@/utils/commons'
|
|
|
|
|
import { copy, isEmpty } from '@/utils/commons'
|
|
|
|
|
import { Conditional } from '@/components/Conditional'
|
|
|
|
|
import useConversationStore from '@/stores/ConversationStore'
|
|
|
|
|
import { useOrderStore, OrderLabelDefaultOptions, OrderStatusDefaultOptions } from '@/stores/OrderStore'
|
|
|
|
|
import useAuthStore from '@/stores/AuthStore'
|
|
|
|
|
import QuotesHistory from './QuotesHistory'
|
|
|
|
|
|
|
|
|
|
const CustomerProfile = (() => {
|
|
|
|
|
const { notification, message } = App.useApp()
|
|
|
|
|
const [loading, setLoading] = useState(false)
|
|
|
|
|
const [isModalOpen, setIsModalOpen] = useState(false)
|
|
|
|
|
const orderCommentRef = useRef(null)
|
|
|
|
|
const currentOrder = useConversationStore((state) => state.currentConversation?.coli_sn || '')
|
|
|
|
|
const loginUser = useAuthStore((state) => state.loginUser)
|
|
|
|
|
const { orderDetail, customerDetail, lastQuotation, quotationList,
|
|
|
|
|
fetchOrderDetail, setOrderPropValue
|
|
|
|
|
fetchOrderDetail, setOrderPropValue, appendOrderComment
|
|
|
|
|
} = useOrderStore()
|
|
|
|
|
|
|
|
|
|
const orderLabelOptions = copy(OrderLabelDefaultOptions)
|
|
|
|
@ -103,8 +107,8 @@ const CustomerProfile = (() => {
|
|
|
|
|
</Flex>
|
|
|
|
|
</Flex>
|
|
|
|
|
</Card>
|
|
|
|
|
<Divider orientation='left'><Typography.Text strong>最新报价</Typography.Text></Divider>
|
|
|
|
|
<Flex vertical={true} className='p-2 '>
|
|
|
|
|
<Typography.Text strong>最新报价</Typography.Text>
|
|
|
|
|
<Conditional
|
|
|
|
|
condition={quotationList.length > 0}
|
|
|
|
|
whenFalse={<Empty description={<span>暂无报价</span>}></Empty>}
|
|
|
|
@ -117,7 +121,38 @@ const CustomerProfile = (() => {
|
|
|
|
|
</>
|
|
|
|
|
}/>
|
|
|
|
|
</Flex>
|
|
|
|
|
<p className='p-2 shadow-inner overflow-auto m-0 break-words whitespace-pre-wrap' dangerouslySetInnerHTML={{__html: orderDetail.order_detail}}></p>
|
|
|
|
|
|
|
|
|
|
<Divider orientation='left'><Typography.Text strong>表单信息</Typography.Text></Divider>
|
|
|
|
|
<p className='p-2 overflow-auto m-0 break-words whitespace-pre-wrap' dangerouslySetInnerHTML={{__html: orderDetail.order_detail}}></p>
|
|
|
|
|
<Modal title='添加备注' open={isModalOpen}
|
|
|
|
|
onOk={() => {
|
|
|
|
|
const orderCommnet = orderCommentRef.current.value
|
|
|
|
|
if (isEmpty(orderCommnet)) {
|
|
|
|
|
message.warning('请输入备注后再提交。')
|
|
|
|
|
} else {
|
|
|
|
|
appendOrderComment(loginUser.userId, currentOrder, orderCommnet)
|
|
|
|
|
.then(() => {
|
|
|
|
|
message.success('添加成功')
|
|
|
|
|
setIsModalOpen(false)
|
|
|
|
|
})
|
|
|
|
|
.catch(reason => {
|
|
|
|
|
notification.error({
|
|
|
|
|
message: '添加出错',
|
|
|
|
|
description: reason.message,
|
|
|
|
|
placement: 'top',
|
|
|
|
|
duration: 60,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
orderCommentRef.current.value = ''
|
|
|
|
|
}}
|
|
|
|
|
onCancel={() => {setIsModalOpen(false)}}>
|
|
|
|
|
<textarea ref={orderCommentRef} className='w-full' rows={4}></textarea>
|
|
|
|
|
</Modal>
|
|
|
|
|
<Button size={'small'} onClick={() => {
|
|
|
|
|
console.info('order: ' + loginUser.userId + '; order: ' + currentOrder)
|
|
|
|
|
setIsModalOpen(true)
|
|
|
|
|
}}>添加备注</Button>
|
|
|
|
|
</Spin>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|