Merge remote-tracking branch 'origin/main' into dev/chat

dev/chat
Lei OT 2 years ago
commit 2a333c1e45

@ -53,7 +53,7 @@ const router = createBrowserRouter([
ReactDOM.createRoot(document.getElementById('root')).render(
// <React.StrictMode>
<ThemeContext.Provider value={{ colorPrimary: '#1ba784', borderRadius: 4 }}>
<AuthContext.Provider value={{ loginUser: { userId: 354 } }}>
<AuthContext.Provider value={{ loginUser: { userId: 354, username: '廖一军', accountList: ['LYJ', 'LYJAH', 'LYJGH'] } }}>
<ConversationProvider>
<RouterProvider router={router} fallbackElement={() => <div>Loading...</div>} />
</ConversationProvider>

@ -1,8 +1,10 @@
import { useEffect } from 'react'
import {
Row, Col, Space, Descriptions, Avatar, Radio
Row, Col, Space, Descriptions, Avatar, Radio, Tag
} from 'antd'
import {
UserOutlined
} from '@ant-design/icons'
import { useAuthContext } from '@/stores/AuthContext'
function AccountProfile() {
@ -12,24 +14,16 @@ function AccountProfile() {
//
// throw new Error('💥 CABOOM 💥')
}, [])
return (
<Row>
<Col span={12} offset={6}>
<Descriptions title='个人资料' layout='vertical' column={2}>
<Descriptions.Item label='名字'><Space size='middle'><Avatar src={loginUser.avatarUrl} />{loginUser.username}</Space></Descriptions.Item>
<Descriptions.Item label='名字'><Space size='middle'><Avatar src={loginUser.avatarUrl}>{loginUser.username.substring(1)}</Avatar>{loginUser.username}</Space></Descriptions.Item>
<Descriptions.Item label='HT 账号'>
{loginUser.accountName}
<Radio.Group
options={[
{ label: 'LMY', value: '1' },
{ label: 'christy', value: '2' },
{ label: 'LMYGH', value: '3' }
]}
value='2'
optionType='button'
buttonStyle='solid'
/>
{loginUser.accountList?.map(a => { return (
<Tag icon={<UserOutlined />} bordered={false}>{a}</Tag>
)})}
</Descriptions.Item>
<Descriptions.Item label='手机'>{loginUser.mobile}</Descriptions.Item>
<Descriptions.Item label='邮件'>{loginUser.email}</Descriptions.Item>

@ -90,7 +90,7 @@ function AuthApp() {
trigger={['click']}
>
<a onClick={(e) => e.preventDefault()} style={{ color: colorPrimary }}>
<Space><Avatar src={loginUser.avatarUrl} />廖一军<DownOutlined /></Space>
<Space><Avatar src={loginUser.avatarUrl}>{loginUser.username.substring(1)}</Avatar>{loginUser.username}<DownOutlined /></Space>
</a>
</Dropdown>

@ -1,16 +1,6 @@
import {
App,
Badge,
Button,
DatePicker,
Divider,
Flex, Form,
Input,
Radio, Select,
Space,
Switch,
Table,
Tag
App, Badge, Button, DatePicker, Divider, Flex, Form, Input,
Radio, Row, Col, Select, Space, Switch, Table, Tag
} from 'antd'
import { memo, useCallback, useEffect, useState } from 'react'
import { NavLink } from 'react-router-dom'
@ -55,87 +45,106 @@ const AdvanceSearchForm = memo(function ({ onSubmit }) {
}
return (
<Form
layout={'inline'}
layout={'vertical'}
form={form}
initialValues={{ orderLabel: '', orderStatus: '',
startDateRange: [dayjs().startOf('M'), dayjs().endOf('M')]
initialValues={{
orderLabel: '', orderStatus: '', remindState: '',
startDateRange: [dayjs().startOf('M'), dayjs().endOf('M')]
}}
onFinish={handleSubmit}
style={{
maxWidth: 'none',
}}
>
<Form.Item label='标签' name='orderLabel'>
<Select
style={{
width: 100,
}}
options={[
{ value: '', label: '全部' },
{ value: '240003', label: '重点' },
{ value: '240002', label: '潜力' },
{ value: '240001', label: '休眠' }
]}
/>
</Form.Item>
<Form.Item label='状态' name='orderStatus'>
<Select
style={{
width: 100,
}}
options={[
{ value: '', label: '全部' },
{
value: '1',
label: '新订单',
},
{
value: '2',
label: '报价中',
},
{
value: '3',
label: '以后联系',
},
{
value: '4',
label: '等待付订金',
},
{
value: '5',
label: '成行',
},
{
value: '6',
label: '丢失',
},
{
value: '7',
label: '取消',
},
]}
/>
</Form.Item>
<Form.Item label='订单号' name='orderNumber'>
<Input placeholder='订单号' allowClear />
</Form.Item>
<Form.Item label='出发日期' name='startDateRange'>
<RangePicker
allowClear={false}
inputReadOnly={true}
presets={DATE_PRESETS}
/>
</Form.Item>
<Form.Item >
<Button type='primary' htmlType='submit'>搜索</Button>
</Form.Item>
<Row justify='start' gutter={16}>
<Col span={4}>
<Form.Item label='订单号' name='orderNumber'>
<Input placeholder='订单号' allowClear />
</Form.Item>
</Col>
<Col span={4}>
<Form.Item label='FirstName' name='firstName'>
<Input placeholder='FirstName' allowClear />
</Form.Item>
</Col>
<Col span={4}>
<Form.Item label='LastName' name='lastName'>
<Input placeholder='LastName' allowClear />
</Form.Item>
</Col>
<Col span={4}>
<Form.Item label='邮件地址/客人电话/传真' name='email'>
<Input placeholder='邮件地址/客人电话/传真' allowClear />
</Form.Item>
</Col>
</Row>
<Row justify='start' gutter={16}>
<Col span={2}>
<Form.Item label='标签' name='orderLabel'>
<Select
options={[
{ value: '', label: '全部' },
{ value: '240003', label: '重点' },
{ value: '240002', label: '次重点' },
{ value: '240001', label: '一般' }
]}
/>
</Form.Item>
</Col>
<Col span={2}>
<Form.Item label='状态' name='orderStatus'>
<Select
options={[
{ value: '', label: '全部' },
{ value: '1', label: '新订单' },
{ value: '2', label: '报价中' },
{ value: '3', label: '以后联系' },
{ value: '4', label: '等待付订金' },
{ value: '5', label: '成行' },
{ value: '6', label: '丢失' },
{ value: '7', label: '取消' }
]}
/>
</Form.Item>
</Col>
<Col span={2}>
<Form.Item label='催信' name='remindState'>
<Select
options={[
{ value: '', label: '全部' },
{ value: '1', label: '一催' },
{ value: '2', label: '二催' },
{ value: '3', label: '三催' }
]}
/>
</Form.Item>
</Col>
<Col span={4}>
<Form.Item label='出发日期' name='startDateRange'>
<RangePicker
allowClear={false}
inputReadOnly={true}
presets={DATE_PRESETS}
/>
</Form.Item>
</Col>
<Col span={4}>
<Form.Item label='确认日期' name='confirmDateRange'>
<RangePicker
allowClear={false}
inputReadOnly={true}
presets={DATE_PRESETS}
/>
</Form.Item>
</Col>
<Col span={2}>
<Button type='primary' htmlType='submit'>搜索</Button>
</Col>
</Row>
</Form>
)
})
function OrderList({ formValues }) {
console.info(formValues)
const orderColumns = [
{
title: '订单号',
@ -143,8 +152,8 @@ function OrderList({ formValues }) {
width: 222,
render: (text, record) => {
if (record.COLI_LineGrade === 240003) return <Space>{text}<Tag color='red'>重点</Tag></Space>
else if (record.COLI_LineGrade === 240002) return <Space>{text}<Tag color='green'>潜力</Tag></Space>
else if (record.COLI_LineGrade === 240001) return <Space>{text}<Tag color='blue'>休眠</Tag></Space>
else if (record.COLI_LineGrade === 240002) return <Space>{text}<Tag color='green'>次重点</Tag></Space>
else if (record.COLI_LineGrade === 240001) return <Space>{text}<Tag color='blue'>一般</Tag></Space>
else return <Space>{text}</Space>
}
},
@ -195,19 +204,20 @@ function OrderList({ formValues }) {
]
const { notification } = App.useApp()
const [orderData, setOrderData] = useState([])
const [loading, setLoading] = useState(false)
const [loading, setLoading] = useState(false)
const { loginUser } = useAuthContext()
let fetchOrderUrl = `https://p9axztuwd7x8a7.mycht.cn/whatsapp_callback/getwlorder?opisn=${loginUser.userId}&otype=${formValues.type}`
if (formValues.type === 'advance') {
const fromDate = formValues.startDateRange[0].format('YYYY-MM-DD')
const thruDate = formValues.startDateRange[1].format('YYYY-MM-DD')
fetchOrderUrl = prepareUrl('https://p9axztuwd7x8a7.mycht.cn/whatsapp_callback/getdvancedwlorder')
fetchOrderUrl = prepareUrl('https://p9axztuwd7x8a7.mycht.cn/whatsapp_callback/getdvancedwlorder')
.append('opisn', loginUser.userId)
.append('startdate', fromDate)
.append('enddate', thruDate)
.append('tag', formValues.orderLabel)
.append('orderstate', formValues.orderStatus)
.append('remindstate', formValues.remindState)
.append('coli_id', formValues.orderNumber)
.build()
}
@ -218,51 +228,7 @@ function OrderList({ formValues }) {
.then(response => response.json())
.then(json => {
if (json.errcode === 0) {
const testOrder = [{
"key": 240129001,
"COLI_SN": 240129001,
"COLI_ID": "LYJ240129001",
"unread_msg": Math.floor(Math.random() * (100 - 2 + 1) + 2),
"COLI_LineGrade": 240001,
"coli_guest": "LiaoYijun",
"buytime": 1,
"COLI_StateCode": 1,
"COLI_State": "新订单",
"lettertitle": "1st Trip Plan: 8-Day Essential Japan Family Trip with Disneyland",
"last_received_time": new Date().toDateString(),
"COLI_Introduction": "",
"RemindState": 0
},{
"key": 240129002,
"COLI_SN": 240129002,
"COLI_ID": "QQS240129002",
"unread_msg": Math.floor(Math.random() * (100 - 2 + 1) + 2),
"COLI_LineGrade": 240002,
"coli_guest": "QinQianSheng",
"buytime": 2,
"COLI_StateCode": 1,
"COLI_State": "新订单",
"lettertitle": "2nd Trip Plan: 2-Week Japan Private Family Vacation",
"last_received_time": new Date().toDateString(),
"COLI_Introduction": "",
"RemindState": 0
},{
"key": 240129003,
"COLI_SN": 240129003,
"COLI_ID": "LYT240129003",
"unread_msg": Math.floor(Math.random() * (100 - 2 + 1) + 2),
"COLI_LineGrade": 240003,
"coli_guest": "LeiYuanTing",
"buytime": 3,
"COLI_StateCode": 1,
"COLI_State": "新订单",
"lettertitle": "3rd Trip Plan: 12-Day Best of Thailand and Cambodia Tour",
"last_received_time": new Date().toDateString(),
"COLI_Introduction": "",
"RemindState": 0
}]
const fetchData = json.result.map((order) => { return {...order, key: order.COLI_ID}})
setOrderData([...testOrder, ...fetchData])
setOrderData(json.result.map((order) => { return { ...order, key: order.COLI_ID } }))
} else {
notification.error({
message: '查询出错',
@ -284,14 +250,14 @@ function OrderList({ formValues }) {
}, [formValues])
return (
<Table key='Order Table' loading={loading} dataSource={orderData}
columns={orderColumns}
pagination={{
showQuickJumper: true,
showLessItems: true,
showSizeChanger: true,
showTotal: (total) => {return `总数:${total}`}
}} />
<Table key='Order Table' loading={loading} dataSource={orderData}
columns={orderColumns}
pagination={{
showQuickJumper: true,
showLessItems: true,
showSizeChanger: true,
showTotal: (total) => { return `总数:${total}` }
}} />
)
}
function OrderFollow() {
@ -306,7 +272,7 @@ function OrderFollow() {
})
const handleSubmit = useCallback((values) => {
setFormValues({...values, type: 'advance'})
setFormValues({ ...values, type: 'advance' })
}, [])
return (
@ -317,7 +283,7 @@ function OrderFollow() {
options={[
{ label: '今日任务', value: 'today' },
{ label: '重点订单', value: 'zhongdian' },
{ label: '潜力客户', value: 'qianli' },
{ label: '次重点客户', value: 'qianli' },
{ label: '成行', value: 'chengxing' },
{ label: '走团中', value: 'zoutuan' },
{ label: '走团后一月', value: 'zoutuanhou' }

Loading…
Cancel
Save