|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
import { LinkOutlined, MailOutlined, PhoneOutlined, UserOutlined, WhatsAppOutlined } from "@ant-design/icons";
|
|
|
|
|
import { App, Button, Card, Empty, Flex, Select, Spin, Typography, Divider, Modal, List, Row, Col, Tag } from "antd";
|
|
|
|
|
import { useEffect, useState, useRef } from "react";
|
|
|
|
|
import { useEffect, useState, useRef, useCallback } from "react";
|
|
|
|
|
import { useNavigate } from "react-router-dom";
|
|
|
|
|
|
|
|
|
|
import { copy, isEmpty } from "@/utils/commons";
|
|
|
|
@ -19,19 +19,20 @@ const CustomerProfile = () => {
|
|
|
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
|
|
|
const [currentOrderNumber, setOrderNumber] = useState(false);
|
|
|
|
|
const [orderList, setOrderList] = useState([]);
|
|
|
|
|
const orderCommentRef = useRef(null);
|
|
|
|
|
|
|
|
|
|
const currentOrder = useConversationStore(state => state.currentConversation?.coli_sn || "");
|
|
|
|
|
const currentConversationID = useConversationStore(state => state.currentConversation?.sn || "");
|
|
|
|
|
const [updateCurrentConversation] = useConversationStore(state => [state.updateCurrentConversation]);
|
|
|
|
|
const [emailMsg, setEmailMsg, detailPopupOpen, setDetailOpen, openDetail] = useConversationStore(state => [state.emailMsg, state.setEmailMsg, state.detailPopupOpen, state.setDetailOpen, state.openDetail]);
|
|
|
|
|
const loginUser = useAuthStore(state => state.loginUser);
|
|
|
|
|
const [
|
|
|
|
|
orderDetail, customerDetail, lastQuotation, quotationList, fetchOrderDetail, setOrderPropValue, appendOrderComment, fetchOtherEmail, otherEmailList
|
|
|
|
|
orderDetail, customerDetail, lastQuotation, quotationList, fetchOrderDetail, setOrderPropValue, appendOrderComment, fetchOtherEmail, otherEmailList, fetchHistoryOrder
|
|
|
|
|
] = useOrderStore(s => [
|
|
|
|
|
s.orderDetail, s.customerDetail, s.lastQuotation, s.quotationList, s.fetchOrderDetail, s.setOrderPropValue, s.appendOrderComment, s.fetchOtherEmail, s.otherEmailList
|
|
|
|
|
s.orderDetail, s.customerDetail, s.lastQuotation, s.quotationList, s.fetchOrderDetail, s.setOrderPropValue, s.appendOrderComment, s.fetchOtherEmail, s.otherEmailList, s.fetchHistoryOrder
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
const navigate = useNavigate();
|
|
|
|
|
const orderLabelOptions = copy(OrderLabelDefaultOptions);
|
|
|
|
|
orderLabelOptions.unshift({ value: 0, label: "未设置", disabled: true });
|
|
|
|
|
|
|
|
|
@ -43,6 +44,13 @@ const CustomerProfile = () => {
|
|
|
|
|
fetchOrderDetail(currentOrder)
|
|
|
|
|
.then(result => {
|
|
|
|
|
setOrderNumber(result.orderDetail.order_no)
|
|
|
|
|
fetchHistoryOrder(result.orderDetail.order_no, result.customerDetail.email)
|
|
|
|
|
.then(orderList => {
|
|
|
|
|
const mapOrderList = orderList.map(o => {
|
|
|
|
|
return { value: o.coli_sn, label: o.coli_id }
|
|
|
|
|
})
|
|
|
|
|
setOrderList(mapOrderList)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.finally(() => setLoading(false))
|
|
|
|
|
.catch(reason => {
|
|
|
|
@ -83,11 +91,7 @@ const CustomerProfile = () => {
|
|
|
|
|
setNewChatModalVisible(false);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const renderOtherEmailList = () => {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleEmailClick = (emailItem) => {
|
|
|
|
|
const handleEmailClick = useCallback((emailItem) => {
|
|
|
|
|
const emailMsg = {
|
|
|
|
|
conversationid: currentConversationID,
|
|
|
|
|
order_opi: orderDetail.opi_sn,
|
|
|
|
@ -102,7 +106,7 @@ const CustomerProfile = () => {
|
|
|
|
|
}
|
|
|
|
|
setEmailMsg(emailMsg);
|
|
|
|
|
openDetail();
|
|
|
|
|
}
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
if (currentOrder) {
|
|
|
|
|
return (
|
|
|
|
@ -117,10 +121,7 @@ const CustomerProfile = () => {
|
|
|
|
|
}}
|
|
|
|
|
variant="borderless"
|
|
|
|
|
value={currentOrderNumber}
|
|
|
|
|
options={[
|
|
|
|
|
{ value: '-1', label: '全部' },
|
|
|
|
|
{ value: currentOrderNumber, label: currentOrderNumber }
|
|
|
|
|
]}
|
|
|
|
|
options={orderList}
|
|
|
|
|
/>}
|
|
|
|
|
actions={[
|
|
|
|
|
<Select
|
|
|
|
|