|
|
|
@ -2,12 +2,13 @@ import { WhatsAppOutlined, FileAddOutlined, MailOutlined, PhoneOutlined, UserOut
|
|
|
|
|
|
|
|
|
|
import { useEffect, useState } from 'react'
|
|
|
|
|
import { App, Flex, Select, Tooltip, Tabs, Button, Divider, Typography, Skeleton, Checkbox } from 'antd'
|
|
|
|
|
import { useOrderStore, OrderLabelDefaultOptions, OrderStatusDefaultOptions, remindStatusOptions } from '@/stores/OrderStore'
|
|
|
|
|
import { copy } from '@/utils/commons'
|
|
|
|
|
import { useOrderStore, fetchSetRemindStateAction, OrderLabelDefaultOptions, OrderStatusDefaultOptions, remindStatusOptions } from '@/stores/OrderStore'
|
|
|
|
|
import { copy, isEmpty } from '@/utils/commons'
|
|
|
|
|
const OrderProfile = ({ coliSN, ...props }) => {
|
|
|
|
|
const { notification, message } = App.useApp()
|
|
|
|
|
|
|
|
|
|
const [loading, setLoading] = useState(false)
|
|
|
|
|
|
|
|
|
|
const orderLabelOptions = copy(OrderLabelDefaultOptions)
|
|
|
|
|
orderLabelOptions.unshift({ value: 0, label: '未设置', disabled: true })
|
|
|
|
|
|
|
|
|
@ -20,13 +21,11 @@ const OrderProfile = ({ coliSN, ...props }) => {
|
|
|
|
|
s.appendOrderComment,
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
const [orderRemindState, setOrderRemindState] = useState(orderDetail.remindstate);
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (coliSN) {
|
|
|
|
|
setLoading(true)
|
|
|
|
|
fetchOrderDetail(coliSN)
|
|
|
|
|
.then((result) => {
|
|
|
|
|
console.info(result)
|
|
|
|
|
})
|
|
|
|
|
.finally(() => setLoading(false))
|
|
|
|
|
.catch((reason) => {
|
|
|
|
|
notification.error({
|
|
|
|
@ -40,9 +39,27 @@ const OrderProfile = ({ coliSN, ...props }) => {
|
|
|
|
|
return () => {}
|
|
|
|
|
}, [coliSN])
|
|
|
|
|
|
|
|
|
|
const regularText = () => {
|
|
|
|
|
if (orderDetail.buytime > 0) return '(R' + orderDetail.buytime + ')'
|
|
|
|
|
return ''
|
|
|
|
|
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: coliSN, remindstate: state });
|
|
|
|
|
message.success('设置成功');
|
|
|
|
|
} catch (error) {
|
|
|
|
|
notification.warning({ message: '设置失败', description: error.message, placement: 'top', duration: 60 });
|
|
|
|
|
setOrderRemindState(oldState);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getCustomerName = () => {
|
|
|
|
|
if (orderDetail.buytime > 0) return customerDetail.name + '(R' + orderDetail.buytime + ')'
|
|
|
|
|
return customerDetail.name
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
@ -69,7 +86,7 @@ const OrderProfile = ({ coliSN, ...props }) => {
|
|
|
|
|
</Typography.Text>
|
|
|
|
|
<Typography.Text>
|
|
|
|
|
<UserOutlined className=' pr-1' />
|
|
|
|
|
{customerDetail.name + regularText()}
|
|
|
|
|
{getCustomerName()}
|
|
|
|
|
</Typography.Text>
|
|
|
|
|
<Typography.Text>
|
|
|
|
|
<CompassOutlined className=' pr-1' />
|
|
|
|
@ -116,7 +133,20 @@ const OrderProfile = ({ coliSN, ...props }) => {
|
|
|
|
|
width: '100%',
|
|
|
|
|
}}
|
|
|
|
|
variant='underlined'
|
|
|
|
|
onSelect={(value) => {}}
|
|
|
|
|
onSelect={value => {
|
|
|
|
|
setOrderPropValue(coliSN, "orderlabel", value)
|
|
|
|
|
.then(() => {
|
|
|
|
|
message.success("设置成功");
|
|
|
|
|
})
|
|
|
|
|
.catch(reason => {
|
|
|
|
|
notification.error({
|
|
|
|
|
message: "设置出错",
|
|
|
|
|
description: reason.message,
|
|
|
|
|
placement: "top",
|
|
|
|
|
duration: 60,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
value={orderDetail.tags}
|
|
|
|
|
options={orderLabelOptions}
|
|
|
|
|
/>
|
|
|
|
@ -128,7 +158,20 @@ const OrderProfile = ({ coliSN, ...props }) => {
|
|
|
|
|
width: '100%',
|
|
|
|
|
}}
|
|
|
|
|
variant='underlined'
|
|
|
|
|
onSelect={(value) => {}}
|
|
|
|
|
onSelect={value => {
|
|
|
|
|
setOrderPropValue(coliSN, "orderstatus", value)
|
|
|
|
|
.then(() => {
|
|
|
|
|
message.success("设置成功");
|
|
|
|
|
})
|
|
|
|
|
.catch(reason => {
|
|
|
|
|
notification.error({
|
|
|
|
|
message: "设置出错",
|
|
|
|
|
description: reason.message,
|
|
|
|
|
placement: "top",
|
|
|
|
|
duration: 60,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
value={orderDetail.states}
|
|
|
|
|
options={orderStatusOptions}
|
|
|
|
|
/>
|
|
|
|
@ -137,7 +180,7 @@ const OrderProfile = ({ coliSN, ...props }) => {
|
|
|
|
|
<Divider orientation='left'>
|
|
|
|
|
<Typography.Text strong>催信</Typography.Text>
|
|
|
|
|
</Divider>
|
|
|
|
|
<Checkbox.Group key='substatus' className='px-2' options={remindStatusOptions} />
|
|
|
|
|
<Checkbox.Group key='substatus' className="px-2" value={[orderRemindState]} options={remindStatusOptions} onChange={handleSetRemindState} />
|
|
|
|
|
|
|
|
|
|
<Divider orientation='left'>
|
|
|
|
|
<Typography.Text strong>表单信息</Typography.Text>
|
|
|
|
|