|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
import { LinkOutlined, MailOutlined, PhoneOutlined, UserOutlined, WhatsAppOutlined, FieldNumberOutlined } from "@ant-design/icons";
|
|
|
|
|
import { App, Button, Card, Empty, Flex, Select, Spin, Typography, Divider, Modal, List, Row, Col, Tag } from "antd";
|
|
|
|
|
import { App, Button, Card, Empty, Flex, Select, Spin, Typography, Divider, Modal, List, Row, Col, Tag, Checkbox } from "antd";
|
|
|
|
|
import { useEffect, useState, useRef, useCallback } from "react";
|
|
|
|
|
import { useNavigate } from "react-router-dom";
|
|
|
|
|
import { useShallow } from 'zustand/react/shallow';
|
|
|
|
@ -7,7 +7,7 @@ import { useShallow } from 'zustand/react/shallow';
|
|
|
|
|
import { copy, isEmpty } from "@/utils/commons";
|
|
|
|
|
import { Conditional } from "@/components/Conditional";
|
|
|
|
|
import useConversationStore from "@/stores/ConversationStore";
|
|
|
|
|
import { useOrderStore, OrderLabelDefaultOptions, OrderStatusDefaultOptions } from "@/stores/OrderStore";
|
|
|
|
|
import { useOrderStore, OrderLabelDefaultOptions, OrderStatusDefaultOptions, remindStatusOptions, fetchSetRemindStateAction } from "@/stores/OrderStore";
|
|
|
|
|
import useAuthStore from "@/stores/AuthStore";
|
|
|
|
|
import QuotesHistory from "./QuotesHistory";
|
|
|
|
|
import ConversationBind from "./../ConversationBind";
|
|
|
|
@ -40,6 +40,7 @@ const CustomerProfile = () => {
|
|
|
|
|
const [resetOrderStore] = useOrderStore(state => [state.resetOrderStore])
|
|
|
|
|
|
|
|
|
|
const [chatOrder, setChatOrder] = useState(currentOrder);
|
|
|
|
|
const [orderRemindState, setOrderRemindState] = useState(orderDetail.remindstate);
|
|
|
|
|
|
|
|
|
|
const orderLabelOptions = copy(OrderLabelDefaultOptions);
|
|
|
|
|
orderLabelOptions.unshift({ value: 0, label: "未设置", disabled: true });
|
|
|
|
@ -76,6 +77,7 @@ const CustomerProfile = () => {
|
|
|
|
|
prevOrder.current = currentOrder
|
|
|
|
|
setOrderNumber(result.orderDetail.order_no)
|
|
|
|
|
setChatOrder(result.orderDetail.order_no)
|
|
|
|
|
setOrderRemindState(String(result.orderDetail.remindstate));
|
|
|
|
|
const queryEmail = result.customerDetail.email || channels?.email || '';
|
|
|
|
|
const queryWA = result.customerDetail.whatsapp_phone_number || result.customerDetail.phone || channels?.whatsapp_phone_number || ''
|
|
|
|
|
getHistoryOrder(queryEmail, queryWA)
|
|
|
|
@ -145,6 +147,24 @@ const CustomerProfile = () => {
|
|
|
|
|
updateCurrentConversation({ coli_sn });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleSetRemindState = async (checkedValue) => {
|
|
|
|
|
const state = checkedValue.filter(v => v !== orderRemindState);
|
|
|
|
|
const oldState = orderRemindState;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (isEmpty(state)) {
|
|
|
|
|
setOrderRemindState(null);
|
|
|
|
|
} else {
|
|
|
|
|
setOrderRemindState(state[0]);
|
|
|
|
|
}
|
|
|
|
|
await fetchSetRemindStateAction({ coli_sn: chatOrder, remindstate: state });
|
|
|
|
|
message.success('设置成功');
|
|
|
|
|
} catch (error) {
|
|
|
|
|
notification.warning({ message: '设置失败', description: error.message, placement: 'top', duration: 60 });
|
|
|
|
|
setOrderRemindState(oldState);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (currentOrder) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="divide-x-0 divide-y divide-dashed divide-gray-300">
|
|
|
|
@ -253,6 +273,10 @@ const CustomerProfile = () => {
|
|
|
|
|
</Flex>
|
|
|
|
|
</Flex>
|
|
|
|
|
</Card>
|
|
|
|
|
<Divider orientation="left">
|
|
|
|
|
<Typography.Text strong>催信:</Typography.Text>
|
|
|
|
|
</Divider>
|
|
|
|
|
<Checkbox.Group key='substatus' value={[orderRemindState]} options={remindStatusOptions} onChange={handleSetRemindState} />
|
|
|
|
|
<Divider orientation="left">
|
|
|
|
|
<Typography.Text strong>最新报价</Typography.Text>
|
|
|
|
|
</Divider>
|
|
|
|
|