|
|
|
|
@ -1,13 +1,14 @@
|
|
|
|
|
import { WhatsAppOutlined, FileAddOutlined, MailOutlined, PhoneOutlined, UserOutlined, FieldNumberOutlined, CompassOutlined, CalendarOutlined, EditOutlined, CheckOutlined } from '@ant-design/icons'
|
|
|
|
|
|
|
|
|
|
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 { App, Flex, Select, Tooltip, Divider, Typography, Skeleton, Checkbox } from 'antd'
|
|
|
|
|
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 (
|
|
|
|
|
@ -62,14 +79,14 @@ const OrderProfile = ({ coliSN, ...props }) => {
|
|
|
|
|
})}
|
|
|
|
|
/> */}
|
|
|
|
|
<Skeleton active loading={loading}>
|
|
|
|
|
<Flex gap='small' vertical={true} justify='space-between'>
|
|
|
|
|
<Flex gap='small' vertical={true} justify='space-between' className='p-2'>
|
|
|
|
|
<Typography.Text>
|
|
|
|
|
<FieldNumberOutlined className='pr-1' />
|
|
|
|
|
{orderDetail.order_no}
|
|
|
|
|
</Typography.Text>
|
|
|
|
|
<Typography.Text>
|
|
|
|
|
<UserOutlined className=' pr-1' />
|
|
|
|
|
{customerDetail.name + regularText()}
|
|
|
|
|
{getCustomerName()}
|
|
|
|
|
</Typography.Text>
|
|
|
|
|
<Typography.Text>
|
|
|
|
|
<CompassOutlined className=' pr-1' />
|
|
|
|
|
@ -83,11 +100,7 @@ const OrderProfile = ({ coliSN, ...props }) => {
|
|
|
|
|
<MailOutlined className='pr-1' />
|
|
|
|
|
{customerDetail.email}
|
|
|
|
|
</Typography.Text>
|
|
|
|
|
<Typography.Link
|
|
|
|
|
href='#'
|
|
|
|
|
onClick={() => {
|
|
|
|
|
console.info('whatsapp clicked.')
|
|
|
|
|
}}>
|
|
|
|
|
<Typography.Link href={`/order/chat/${coliSN}`}>
|
|
|
|
|
<WhatsAppOutlined className=' pr-1' />
|
|
|
|
|
{customerDetail.whatsapp_phone_number}
|
|
|
|
|
</Typography.Link>
|
|
|
|
|
@ -116,7 +129,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 +154,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 +176,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>
|
|
|
|
|
|