优化头像显示、删除测试订单数据

dev/mobile
Jimmy Liow 2 years ago
parent c7b341b125
commit 0cf3c5d541

@ -53,7 +53,7 @@ const router = createBrowserRouter([
ReactDOM.createRoot(document.getElementById('root')).render( ReactDOM.createRoot(document.getElementById('root')).render(
// <React.StrictMode> // <React.StrictMode>
<ThemeContext.Provider value={{ colorPrimary: '#1ba784', borderRadius: 4 }}> <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> <ConversationProvider>
<RouterProvider router={router} fallbackElement={() => <div>Loading...</div>} /> <RouterProvider router={router} fallbackElement={() => <div>Loading...</div>} />
</ConversationProvider> </ConversationProvider>

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

@ -90,7 +90,7 @@ function AuthApp() {
trigger={['click']} trigger={['click']}
> >
<a onClick={(e) => e.preventDefault()} style={{ color: colorPrimary }}> <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> </a>
</Dropdown> </Dropdown>

@ -1,16 +1,6 @@
import { import {
App, App, Badge, Button, DatePicker, Divider, Flex, Form, Input,
Badge, Radio, Row, Col, Select, Space, Switch, Table, Tag
Button,
DatePicker,
Divider,
Flex, Form,
Input,
Radio, Row, Col, Select,
Space,
Switch,
Table,
Tag
} from 'antd' } from 'antd'
import { memo, useCallback, useEffect, useState } from 'react' import { memo, useCallback, useEffect, useState } from 'react'
import { NavLink } from 'react-router-dom' import { NavLink } from 'react-router-dom'
@ -56,104 +46,99 @@ const AdvanceSearchForm = memo(function ({ onSubmit }) {
return ( return (
<Form <Form
layout={'vertical'} layout={'vertical'}
// layout={'inline'}
form={form} form={form}
initialValues={{ orderLabel: '', orderStatus: '', remindState: '', initialValues={{
startDateRange: [dayjs().startOf('M'), dayjs().endOf('M')] orderLabel: '', orderStatus: '', remindState: '',
startDateRange: [dayjs().startOf('M'), dayjs().endOf('M')]
}} }}
onFinish={handleSubmit} onFinish={handleSubmit}
// style={{
// maxWidth: '200',
// }}
> >
<Row justify='start' align='middle' gutter={16}> <Row justify='start' gutter={16}>
<Col span={4}> <Col span={4}>
<Form.Item label='订单号' name='orderNumber'> <Form.Item label='订单号' name='orderNumber'>
<Input placeholder='订单号' allowClear /> <Input placeholder='订单号' allowClear />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={4}> <Col span={4}>
<Form.Item label='FirstName' name='firstName'> <Form.Item label='FirstName' name='firstName'>
<Input placeholder='FirstName' allowClear /> <Input placeholder='FirstName' allowClear />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={4}> <Col span={4}>
<Form.Item label='LastName' name='lastName'> <Form.Item label='LastName' name='lastName'>
<Input placeholder='LastName' allowClear /> <Input placeholder='LastName' allowClear />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={4}> <Col span={4}>
<Form.Item label='邮件地址/客人电话/传真' name='email'> <Form.Item label='邮件地址/客人电话/传真' name='email'>
<Input placeholder='邮件地址/客人电话/传真' allowClear /> <Input placeholder='邮件地址/客人电话/传真' allowClear />
</Form.Item> </Form.Item>
</Col> </Col>
</Row> </Row>
<Row justify='start' align='middle' gutter={16}> <Row justify='start' gutter={16}>
<Col span={2}> <Col span={2}>
<Form.Item label='标签' name='orderLabel'> <Form.Item label='标签' name='orderLabel'>
<Select <Select
options={[ options={[
{ value: '', label: '全部' }, { value: '', label: '全部' },
{ value: '240003', label: '重点' }, { value: '240003', label: '重点' },
{ value: '240002', label: '次重点' }, { value: '240002', label: '次重点' },
{ value: '240001', label: '一般' } { value: '240001', label: '一般' }
]} ]}
/> />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={2}> <Col span={2}>
<Form.Item label='状态' name='orderStatus'> <Form.Item label='状态' name='orderStatus'>
<Select <Select
options={[ options={[
{ value: '', label: '全部' }, { value: '', label: '全部' },
{ value: '1', label: '新订单' }, { value: '1', label: '新订单' },
{ value: '2', label: '报价中' }, { value: '2', label: '报价中' },
{ value: '3', label: '以后联系' }, { value: '3', label: '以后联系' },
{ value: '4', label: '等待付订金' }, { value: '4', label: '等待付订金' },
{ value: '5', label: '成行' }, { value: '5', label: '成行' },
{ value: '6', label: '丢失' }, { value: '6', label: '丢失' },
{ value: '7', label: '取消' } { value: '7', label: '取消' }
]} ]}
/> />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={2}> <Col span={2}>
<Form.Item label='催信' name='remindState'> <Form.Item label='催信' name='remindState'>
<Select <Select
options={[ options={[
{ value: '', label: '全部' }, { value: '', label: '全部' },
{ value: '1', label: '一催' }, { value: '1', label: '一催' },
{ value: '2', label: '二催' }, { value: '2', label: '二催' },
{ value: '3', label: '三催' } { value: '3', label: '三催' }
]} ]}
/> />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={4}> <Col span={4}>
<Form.Item label='出发日期' name='startDateRange'> <Form.Item label='出发日期' name='startDateRange'>
<RangePicker <RangePicker
allowClear={false} allowClear={false}
inputReadOnly={true} inputReadOnly={true}
presets={DATE_PRESETS} presets={DATE_PRESETS}
/> />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={4}> <Col span={4}>
<Form.Item label='确认日期' name='confirmDateRange'> <Form.Item label='确认日期' name='confirmDateRange'>
<RangePicker <RangePicker
allowClear={false} allowClear={false}
inputReadOnly={true} inputReadOnly={true}
presets={DATE_PRESETS} presets={DATE_PRESETS}
/> />
</Form.Item> </Form.Item>
</Col> </Col>
<Col flex="auto"> <Col span={2}>
{/* <Form.Item > */} <Button type='primary' htmlType='submit'>搜索</Button>
<Button type='primary' htmlType='submit'>搜索</Button> </Col>
{/* </Form.Item> */} </Row>
</Col>
</Row>
</Form> </Form>
) )
}) })
@ -219,20 +204,20 @@ function OrderList({ formValues }) {
] ]
const { notification } = App.useApp() const { notification } = App.useApp()
const [orderData, setOrderData] = useState([]) const [orderData, setOrderData] = useState([])
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
const { loginUser } = useAuthContext() const { loginUser } = useAuthContext()
let fetchOrderUrl = `https://p9axztuwd7x8a7.mycht.cn/whatsapp_callback/getwlorder?opisn=${loginUser.userId}&otype=${formValues.type}` let fetchOrderUrl = `https://p9axztuwd7x8a7.mycht.cn/whatsapp_callback/getwlorder?opisn=${loginUser.userId}&otype=${formValues.type}`
if (formValues.type === 'advance') { if (formValues.type === 'advance') {
const fromDate = formValues.startDateRange[0].format('YYYY-MM-DD') const fromDate = formValues.startDateRange[0].format('YYYY-MM-DD')
const thruDate = formValues.startDateRange[1].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('opisn', loginUser.userId)
.append('startdate', fromDate) .append('startdate', fromDate)
.append('enddate', thruDate) .append('enddate', thruDate)
.append('tag', formValues.orderLabel) .append('tag', formValues.orderLabel)
.append('orderstate', formValues.orderStatus) .append('orderstate', formValues.orderStatus)
.append('remindstate', formValues.remindState) .append('remindstate', formValues.remindState)
.append('coli_id', formValues.orderNumber) .append('coli_id', formValues.orderNumber)
.build() .build()
} }
@ -243,51 +228,7 @@ function OrderList({ formValues }) {
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
if (json.errcode === 0) { if (json.errcode === 0) {
const testOrder = [{ setOrderData(json.result.map((order) => { return { ...order, key: order.COLI_ID } }))
"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])
} else { } else {
notification.error({ notification.error({
message: '查询出错', message: '查询出错',
@ -309,14 +250,14 @@ function OrderList({ formValues }) {
}, [formValues]) }, [formValues])
return ( return (
<Table key='Order Table' loading={loading} dataSource={orderData} <Table key='Order Table' loading={loading} dataSource={orderData}
columns={orderColumns} columns={orderColumns}
pagination={{ pagination={{
showQuickJumper: true, showQuickJumper: true,
showLessItems: true, showLessItems: true,
showSizeChanger: true, showSizeChanger: true,
showTotal: (total) => {return `总数:${total}`} showTotal: (total) => { return `总数:${total}` }
}} /> }} />
) )
} }
function OrderFollow() { function OrderFollow() {
@ -331,7 +272,7 @@ function OrderFollow() {
}) })
const handleSubmit = useCallback((values) => { const handleSubmit = useCallback((values) => {
setFormValues({...values, type: 'advance'}) setFormValues({ ...values, type: 'advance' })
}, []) }, [])
return ( return (

Loading…
Cancel
Save