index.tsx
3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import React, { memo, useEffect, useState } from 'react'
import type { FC, ReactNode } from 'react'
import { Avatar, Image } from 'antd'
import { EyeOutlined } from '@ant-design/icons'
import { useAppDispatch, useAppSelector, shallowEqualApp } from '@/store'
import order, { fetchConsultationOrderDetailAction } from '@/store/modules/order'
import { ViewSymptomWrapper } from '../style'
import GHandler from '@/utils/methods'
import type { ConsultationOrderDetailType } from '@/types'
interface IProps {
children?: ReactNode
id: string | number
}
const url = 'https://p1.ssl.qhmsg.com/dr/270_500_/t010c2d50907f0a7b9c.png'
const ViewSymptom: FC<IProps> = memo((props) => {
const { id } = props
const dispatch = useAppDispatch()
const [orderDetail, setOrderDetail] = useState<ConsultationOrderDetailType>()
useEffect(() => {
dispatch(fetchConsultationOrderDetailAction({ id: id }))
}, [id])
const { COrderDetail } = useAppSelector(
(state) => ({
COrderDetail: state.order.ConsultationOrderDetailData
}),
shallowEqualApp
)
useEffect(() => {
console.log(COrderDetail, '请求回来的订单详情数据')
setOrderDetail(COrderDetail as ConsultationOrderDetailType)
}, [COrderDetail])
return (
<ViewSymptomWrapper>
<div className="flexJ">
<div className="flexA top">
<Avatar size="large" src={<img src={GHandler.downFile(orderDetail?.user?.avatar)} alt="avatar" />} />
<div className="username">{orderDetail?.user?.nickname}</div>
<div className="tag">{GHandler.optObjectValue('consultationWay', orderDetail?.consultationWay || 10)}</div>
</div>
<div className="money">预计收入:¥{orderDetail?.award || 0}</div>
</div>
<div className="row">
就诊宠物:
<span>
{orderDetail?.petName || '姓名未知'}/{orderDetail?.petClass}/{orderDetail?.age || '年龄未知'}/
{GHandler.optObjectValue('petSex', orderDetail?.petSex as any)}/{GHandler.optObjectValue('isSterilization', orderDetail?.isSterilization as any)}/
{orderDetail?.weight ? orderDetail?.weight + 'kg' : '体重未知'}
</span>
</div>
<div className="row">
免疫情况:<span>{GHandler.optObjectValue('immuneStatus', orderDetail?.immuneStatus || 4)}</span>
</div>
<div className="row">
喂养方式:
<span>
<span>{GHandler.optObjectValue('feedType', orderDetail?.feedType || 4)}</span>
</span>
</div>
<div className="row">
洗澡频次:<span>{GHandler.optObjectValue('batheFrequency', orderDetail?.batheFrequency || 2)}</span>
</div>
<div className="row">
出现症状:
{orderDetail?.symptom?.length &&
orderDetail?.symptom?.split(',').map((_, index) => (
<span>
{GHandler.optObjectValue('symptom', _)}
{index !== (orderDetail.symptom as string).split(',').length - 1 ? ',' : ''}
</span>
))}
</div>
<div className="row">
症状时间:<span>{GHandler.optObjectValue('timeFrame', orderDetail?.timeFrame || 1)}</span>
</div>
<div className="row">
症状描述:<span>{orderDetail?.supplement || '暂无症状描述'}</span>
</div>
<div>
<div className="row">症状图片</div>
{orderDetail?.image ? (
orderDetail?.image.split(',').map((_, index) => (
<Image
width={120}
height={120}
preview={{
mask: <EyeOutlined />
}}
src={GHandler.downFile(_)}
/>
))
) : (
<div className="row">暂无症状图片</div>
)}
</div>
</ViewSymptomWrapper>
)
})
export default ViewSymptom