作者 韩昌

gaibug

... ... @@ -15,6 +15,7 @@
"antd": "^5.9.3",
"axios": "^1.4.0",
"craco-less": "^3.0.1",
"events": "^3.3.0",
"normalize.css": "^8.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
... ...
import React, { Suspense } from 'react'
import { useRoutes } from 'react-router-dom'
import React, { Suspense, useEffect } from 'react'
import { useRoutes, useNavigate } from 'react-router-dom'
import routes from './router'
import { useAppSelector, useAppDispatch, shallowEqualApp } from './store'
import { changeMessage } from './store/modules/counter'
import EventBus from '@/utils/events'
function App() {
const { counter } = useAppSelector((state) => state, shallowEqualApp)
const navigate = useNavigate()
const dispatch = useAppDispatch()
useEffect(() => {
EventBus.on('notLogin', function () {
navigate('/login')
})
}, [])
function changeMessageHandler() {
dispatch(changeMessage('hahah'))
}
... ...
... ... @@ -9,8 +9,8 @@ export const getMessageLogin = (params: any) => hyrequest.get({ url: '/pet/login
// 问诊及处方
export const getConsultation_information_list = (params: PageListParamsType) => hyrequest.get({ url: '/veterinary/consultation_information_list', params }) // 问诊订单列表
export const updateSend_prescription_form = (params: any) => hyrequest.post({ url: '/veterinary/send_prescription_form', params }) // 发送处方单
export const getPrescription_detail = (params: { id: string | number }) => hyrequest.get({ url: '/veterinary/prescription_detail', params }) // 处方单详情
export const updateSend_prescription_form = (params: any) => hyrequest.post({ url: '/veterinary/send_prescription_form', data: params }) // 发送处方单
export const getPrescription_detail = (params: { id: string | number }) => hyrequest.get({ url: '/veterinary/prescription_detail_information', params }) // 处方单详情
export const getConsultation_information_detail = (params: { id: string | number }) => hyrequest.get({ url: '/veterinary/consultation_information_detail', params }) // 问诊订单详情
// 我的
... ...
body, textarea, select, input, button {
body,
textarea,
select,
input,
button {
// font-size: 12px;
// color: #333;
// font-family: Arial, Helvetica, sans-serif;
... ... @@ -60,10 +64,8 @@ body, textarea, select, input, button {
// }
.ant-message .ant-message-notice-content {
// position: fixed;
// left: 50%;
// transform: translateX(-50%);
// bottom: 60px;
// background-color: rgba(0, 0, 0, .7);
// color: #fff;
position: fixed;
left: 50%;
transform: translateX(-50%);
bottom: -150px;
}
... ...
... ... @@ -3,6 +3,7 @@ import type { FC, ReactNode } from 'react'
import { useNavigate } from 'react-router-dom'
import { useAppDispatch, useAppSelector, shallowEqualApp } from '@/store'
import { fetchUserinfoAction } from '@/store/modules/order'
import GHandler from '@/utils/methods'
import { AppHeaderWrapper } from './styled'
import type { UserInfoType } from '@/types'
... ... @@ -44,8 +45,12 @@ const AppHeader: FC<IProps> = memo(() => {
<div className="flexJ box">
<div className="title flexA">宠物问诊</div>
<div className="flexA">
<img className="avatar" src={UserInfo?.avatar || 'https://tupian.qqw21.com/article/UploadPic/2020-4/20204421535275855.jpg'} alt="" />
<div className="username">{UserInfo?.nickname || '未设置昵称'}</div>
<img
className="avatar"
src={GHandler.downFile(UserInfo?.avatar) || 'https://tupian.qqw21.com/article/UploadPic/2020-4/20204421535275855.jpg'}
alt=""
/>
<div className="username">{UserInfo?.realname || '未设置昵称'}</div>
{token && (
<div className="loginout" onClick={loginOutHandler}>
退出登录
... ...
// const BASE_URL = 'http://codercba.com:9002/'
// const BASE_URL = 'http://192.168.10.63:8080/jeecg-boot'
const BASE_URL = 'http://127.0.0.1:4523/m1/3332971-0-default/jeecg-boot' // mock
// const BASE_URL = 'http://114.115.178.175:8799/jeecg-boot' // 测试
// const BASE_URL = 'http://192.168.10.63:8080/jeecg-boot' // 本地
// const BASE_URL = 'http://127.0.0.1:4523/m1/3332971-0-default/jeecg-boot' // mock
const BASE_URL = 'https://pet.apple02.brofirst.cn/jeecg-boot'
export const TIME_OUT = 10000;
export { BASE_URL }
... ...
... ... @@ -10,7 +10,7 @@ const hyrequest = new HYRequest({
requestSuccessFn(config) {
const token = LStore.get('token')
if (token && config.headers) {
config.headers['Content-Type'] = 'multipart/form-data;'
// config.headers['Content-Type'] = 'multipart/form-data;'
config.headers.token = token
config.headers['X-Access-Token'] = token
}
... ...
import axios from "axios"
import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'
import type { HYRequestConfig } from './types'
import EventBus from '@/utils/events'
// import router from "../../router"
/**
... ... @@ -32,7 +33,7 @@ class HYRequest {
return res.data
}, err => {
if (err.response.data.code === 401) {
// router.push('/login')
EventBus.emit('notLogin', err.response.data.message)
}
console.log('全局相应失败的拦截', err.response.data)
return err
... ...
... ... @@ -8,7 +8,8 @@ export const fetchOrderDataAction = createAsyncThunk<void, PageListParamsType>(
'fetchdata', (payload, { dispatch }) => {
getConsultation_information_list(payload).then(({ result }: { result: PageListType<ConsultationOrderListItemType[]> }) => {
console.log(result, '问诊订单列表')
dispatch(changeConsultationOrderAction(result.records))
dispatch(changeConsultationOrderAction(result?.records))
dispatch(changeConsultationOrderNumAction(result?.total))
})
}
)
... ... @@ -44,12 +45,16 @@ const orderSlice = createSlice({
ConsultationOrderList: [],
ConsultationOrderDetailData: {},
PrescriptionDetailData: {},
UserInfo: {}
UserInfo: {},
total: 0
},
reducers: {
changeConsultationOrderAction(state, { payload }) {
state.ConsultationOrderList = payload
},
changeConsultationOrderNumAction(state, { payload }) {
state.total = payload
},
changeConsultationOrderDetailAction(state, { payload }) {
state.ConsultationOrderDetailData = payload
},
... ... @@ -64,4 +69,4 @@ const orderSlice = createSlice({
export default orderSlice.reducer
export const { changeConsultationOrderAction, changeConsultationOrderDetailAction, changePrescriptionDetailAction, changeUserInfoAction } = orderSlice.actions
export const { changeConsultationOrderAction, changeConsultationOrderNumAction, changeConsultationOrderDetailAction, changePrescriptionDetailAction, changeUserInfoAction } = orderSlice.actions
... ...
... ... @@ -55,7 +55,7 @@ export interface ConsultationOrderRecordsType {
/**
* 实际收入
*/
effect_award?: number;
effectAward?: number;
/**
* 喂养方式1=配方粮2=配方粮+零食3=只吃人食物4=自制犬猫粮
*/
... ... @@ -195,7 +195,7 @@ export interface ConsultationOrderListItemType {
/**
* 实际收入
*/
effect_award?: number;
effectAward?: number;
/**
* 喂养方式1=配方粮2=配方粮+零食3=只吃人食物4=自制犬猫粮
*/
... ... @@ -346,7 +346,7 @@ export interface ConsultationOrderDetailType {
/**
* 实际收入
*/
effect_award?: number;
effectAward?: number;
/**
* 喂养方式1=配方粮2=配方粮+零食3=只吃人食物4=自制犬猫粮
*/
... ... @@ -358,7 +358,7 @@ export interface ConsultationOrderDetailType {
/**
* 症状图片
*/
image?: string[];
image?: string;
/**
* 宠物免疫情况1=已免疫2=未免疫3=免疫不全4=免疫不详
*/
... ... @@ -621,7 +621,8 @@ export interface User {
/**
* 昵称
*/
nickname: string;
nickname?: string;
nickName?: string
[property: string]: any;
}
... ...
import { EventEmitter } from 'events'
const eventBus = new EventEmitter()
export default eventBus
\ No newline at end of file
... ...
... ... @@ -15,9 +15,9 @@ const GlobalData: ObjectString = {
'MessageType': { 1: '系统通知', 2: '用户反馈', 'err': '状态码错误' },
'consultationWay': { 10: '快速问诊', 21: '专家图文语音问诊', 22: '专家视频问诊', 23: '专家电话问诊', 'err': '状态码错误' },
'isReply': { 0: '否', 1: '是', 'err': '状态码错误' }, //
'orderState': { 20: '待问诊', 30: '问诊中', 40: '问诊结束', 50: '已取消', 'err': '状态码错误' },
'orderState': { 10: '待接诊', 20: '待问诊', 30: '问诊中', 40: '问诊结束', 50: '已取消', 'err': '状态码错误' },
'state': { 0: '待发货', 1: '已发货', 2: '已完成', 3: '已退货', 'err': '状态码错误' },
'isSterilization': { 0: '否', 1: '是', 'err': '状态码错误' }, // 是否绝育
'isSterilization': { 0: '未绝育', 1: '已绝育', 'err': '状态码错误' }, // 是否绝育
'petSex': { 0: '母', 1: '公', 'err': '状态码错误' },
'immuneStatus': { 1: '已免疫', 2: '未免疫', 3: '免疫不全', 4: '免疫不详', 'err': '状态码错误' },
'feedType': { 1: '配方粮', 2: '配方粮+零食', 3: '只吃人食物', 4: '自制犬猫粮', 'err': '状态码错误' },
... ... @@ -35,12 +35,12 @@ export default {
optObjectValue(object: string, key: string | number, err: number | string = 'err') {
return GlobalData[object][key] || GlobalData[object][err]
},
downFile(fileName: string) {
downFile(fileName?: string) {
if (fileName == '' || fileName == undefined) return ''
if (fileName.indexOf(BASE_URL) > -1 || fileName.indexOf('http://') > -1 || fileName.indexOf('https://') > -1) return fileName
return BASE_URL + '/v1/public/downLoadPic?fileName=' + fileName
return BASE_URL + fileName
},
formatStr(str: string, val: string) {
if (str == null || str == undefined) return val || ''
... ...
import React, { memo, useState, forwardRef, useImperativeHandle } from 'react'
import React, { memo, useState, forwardRef, useImperativeHandle, useEffect } from 'react'
import type { FC, ReactNode, Ref } from 'react'
import { Input, Modal, Upload } from 'antd'
import { MinusCircleOutlined, PlusCircleOutlined, PlusOutlined } from '@ant-design/icons'
... ... @@ -7,10 +7,13 @@ import type { UploadFile } from 'antd/es/upload/interface'
import { SendPrescriptionWrapper } from '../style'
import { BASE_URL } from '@/service/config'
import type { Send_prescription_formType } from '@/types'
import GHandler from '@/utils/methods'
// /sys/common/appUpload
const { TextArea } = Input
interface IProps {
id?: string | number
children?: ReactNode
ref?: any
}
... ... @@ -59,6 +62,22 @@ const SendPrescription: FC<IProps> = memo(
setSend_prescription_formTypeData(setdata)
}
useEffect(() => {
let prescriptionAmount = 0
prescriptionAmount = Send_prescription_formData.drugList.reduce((accumulator, item) => {
const amount = item.amount ? parseFloat(item.amount) : 0
const num = item.num ? parseFloat(item.num) : 0
if (amount !== 0 && num !== 0) accumulator += amount * num
return accumulator
}, 0)
setSend_prescription_formTypeData({ ...Send_prescription_formData, prescriptionAmount })
}, [Send_prescription_formData.drugList])
const handleCancel = () => setPreviewOpen(false)
const handlePreview = async (file: UploadFile) => {
... ... @@ -143,7 +162,7 @@ const SendPrescription: FC<IProps> = memo(
{fileList.length >= 3 ? null : uploadButton}
</Upload>
<Modal open={previewOpen} title={previewTitle} footer={null} onCancel={handleCancel}>
<img alt="example" style={{ width: '100%' }} src={previewImage} />
<img alt="example" style={{ width: '100%' }} src={GHandler.downFile(previewImage)} />
</Modal>
<div className="title">总金额:¥{Send_prescription_formData.prescriptionAmount}</div>
</SendPrescriptionWrapper>
... ...
... ... @@ -6,6 +6,7 @@ import { useAppDispatch, useAppSelector, shallowEqualApp } from '@/store'
import { fetchPrescriptionDetailAction } from '@/store/modules/order'
import { ViewPrescriptionWrapper } from '../style'
import type { PrescriptionDetailType } from '@/types'
import GHandler from '@/utils/methods'
interface IProps {
children?: ReactNode
... ... @@ -13,14 +14,11 @@ interface IProps {
}
const ViewPrescription: FC<IProps> = memo((props) => {
console.log(props.id, 'id')
const dispatch = useAppDispatch()
const [PrescriptionDetail, setPrescriptionDetail] = useState<PrescriptionDetailType>()
useEffect(() => {
console.log('first')
dispatch(fetchPrescriptionDetailAction({ id: props.id }))
}, [props.id])
... ... @@ -55,41 +53,36 @@ const ViewPrescription: FC<IProps> = memo((props) => {
</div>
))
) : (
<div className="itemo">
<div className="flexJ black">
<div>药品名称</div>
<div>¥0.00</div>
</div>
<div className="flexJ gray">
<div>描述</div>
<div>x0</div>
</div>
</div>
<div className="title">暂无处方药</div>
)}
</div>
<div className="title">处方单证明:</div>
{Array.isArray(PrescriptionDetail?.image) && PrescriptionDetail?.image.length ? (
PrescriptionDetail.image.map((_) => (
{Array.isArray(PrescriptionDetail?.prescriptionFile) && PrescriptionDetail?.prescriptionFile.length ? (
PrescriptionDetail.prescriptionFile.map((_) => (
<Image
width={120}
height={120}
preview={{
mask: <EyeOutlined />
}}
src={_}
src={GHandler.downFile(_)}
className="marbot"
/>
))
) : (
) : typeof PrescriptionDetail?.prescriptionFile === 'string' && PrescriptionDetail.prescriptionFile.length ? (
PrescriptionDetail.prescriptionFile.split(',').map((_) => (
<Image
width={120}
height={120}
preview={{
mask: <EyeOutlined />
}}
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
src={GHandler.downFile(_)}
className="marbot"
/>
))
) : (
<div className="title">暂无处方单证明</div>
)}
<div className="black">总金额:¥{PrescriptionDetail?.award || 0}</div>
... ...
... ... @@ -23,9 +23,8 @@ const ViewSymptom: FC<IProps> = memo((props) => {
const [orderDetail, setOrderDetail] = useState<ConsultationOrderDetailType>()
useEffect(() => {
console.log('id', id)
dispatch(fetchConsultationOrderDetailAction({ id: props.id }))
}, [props.id])
dispatch(fetchConsultationOrderDetailAction({ id: id }))
}, [id])
const { COrderDetail } = useAppSelector(
(state) => ({
... ... @@ -43,7 +42,7 @@ const ViewSymptom: FC<IProps> = memo((props) => {
<ViewSymptomWrapper>
<div className="flexJ">
<div className="flexA top">
<Avatar size="large" src={<img src={orderDetail?.user?.avatar} alt="avatar" />} />
<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>
... ... @@ -52,9 +51,8 @@ const ViewSymptom: FC<IProps> = memo((props) => {
<div className="row">
就诊宠物:
<span>
{GHandler.optObjectValue('petType', orderDetail?.petType || 30)}/{orderDetail?.age || '年龄未知'}/
{GHandler.optObjectValue('petSex', orderDetail?.petSex || 1)}/{GHandler.optObjectValue('symptom', orderDetail?.symptom || 10)}/
{orderDetail?.weight || '体重未知'}
{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">
... ... @@ -70,7 +68,14 @@ const ViewSymptom: FC<IProps> = memo((props) => {
洗澡频次:<span>{GHandler.optObjectValue('batheFrequency', orderDetail?.batheFrequency || 2)}</span>
</div>
<div className="row">
出现症状:<span>{GHandler.optObjectValue('symptom', orderDetail?.symptom || 10)}</span>
出现症状:
{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>
... ... @@ -80,26 +85,19 @@ const ViewSymptom: FC<IProps> = memo((props) => {
</div>
<div>
<div className="row">症状图片</div>
{Array.isArray(orderDetail?.image) && orderDetail?.image.length ? (
orderDetail?.image.map((_, index) => (
{orderDetail?.image ? (
orderDetail?.image.split(',').map((_, index) => (
<Image
width={120}
height={120}
preview={{
mask: <EyeOutlined />
}}
src={_}
src={GHandler.downFile(_)}
/>
))
) : (
<Image
width={120}
height={120}
preview={{
mask: <EyeOutlined />
}}
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
/>
<div className="row">暂无症状图片</div>
)}
</div>
</ViewSymptomWrapper>
... ...
import React, { memo, useEffect, useState, useRef, ElementRef } from 'react'
import type { FC, ReactNode } from 'react'
import { Tabs, Avatar, Space, Divider, Button, Modal, Pagination, Carousel, Empty } from 'antd'
import { Tabs, Avatar, Space, Divider, Button, Modal, Pagination, Carousel, Empty, message } from 'antd'
import type { TabsProps } from 'antd'
import { ConsultationOrderWrapper, ConsultationOrderItemWrapper } from './styled'
import { useAppDispatch, useAppSelector, shallowEqualApp } from '@/store'
... ... @@ -11,13 +11,18 @@ import SendPrescription from '../../com/SendPrescription'
import ViewPrescription from '../../com/ViewPrescription'
import ViewSymptom from '../../com/ViewSymptom'
import GHandler from '@/utils/methods'
import mAvatar from '@/assets/img/mAvatar.png'
interface IProps {
children?: ReactNode
orderList?: ConsultationOrderListItemType[]
}
const url = 'https://p1.ssl.qhmsg.com/dr/270_500_/t010c2d50907f0a7b9c.png'
const url = mAvatar
message.config({
top: 1400
})
const ShowOrderComHandler: FC<IProps> = (props) => {
const { orderList } = props
... ... @@ -25,26 +30,58 @@ const ShowOrderComHandler: FC<IProps> = (props) => {
const [confirmLoading, setConfirmLoading] = useState(false)
const [modalTitle, setModalTitle] = useState<string>(' ')
const [modalFlag, setModalFlag] = useState<number>(0)
const [orderId, setOrderId] = useState<string | number>('')
const SendPrescriptionRef = useRef<SendPrescriptionPropsType | null>(null)
const showModalHandler = (flag: number) => {
console.log(flag, '按钮状态')
const [messageApi, contextHolder] = message.useMessage()
const warning = (content: string) => messageApi.open({ type: 'warning', content: content })
const success = (content: string) => messageApi.open({ type: 'success', content: content })
const showModalHandler = (flag: number, orderId: string | number) => {
setOrderId(orderId)
setModalFlag(flag)
setModalTitle({ 1: '查看症状', 2: '发送处方单', 3: '查看处方单' }[flag] as string)
setOpenHandler(true)
}
const closeSendPrescriptionHandler = () => {
setTimeout(() => {
setOpenHandler(false)
setConfirmLoading(false)
}, 1300)
}
const handleOk = async () => {
if (modalFlag === 2) {
setConfirmLoading(true)
const instance = SendPrescriptionRef.current
await updateSend_prescription_form({
const ret = await updateSend_prescription_form({
...instance?.Send_prescription_formData,
drugList: JSON.stringify(instance?.Send_prescription_formData.drugList),
id: orderId,
prescriptionFile: instance?.fileList.map((_: any) => _.response.message).join()
})
if ([200].includes(ret.code)) {
success('发送成功')
closeSendPrescriptionHandler()
}
if ([500, 401, 403].includes(ret.code)) {
warning(ret.message)
closeSendPrescriptionHandler()
}
typeof instance?.setSend_prescription_formTypeData === 'function' &&
instance?.setSend_prescription_formTypeData({
drugList: [{ amount: '', des: '', name: '', num: '' }],
... ... @@ -54,15 +91,8 @@ const ShowOrderComHandler: FC<IProps> = (props) => {
typeof instance?.setFileList === 'function' && instance.setFileList([])
console.log(SendPrescriptionRef.current, 'SendPrescription 子组件实例')
setConfirmLoading(true)
setTimeout(() => {
setOpenHandler(false)
// console.log(SendPrescriptionRef.current, 'SendPrescription 子组件实例')
setConfirmLoading(false)
}, 2000)
return
}
... ... @@ -72,23 +102,22 @@ const ShowOrderComHandler: FC<IProps> = (props) => {
}
const handleCancel = () => {
console.log('Clicked cancel button')
setOpenHandler(false)
}
return (
<ConsultationOrderItemWrapper>
{contextHolder}
<Modal title={modalTitle} open={open} onOk={handleOk} cancelText="关闭" okText="确认" confirmLoading={confirmLoading} onCancel={handleCancel}>
{{ 1: <ViewSymptom id={1} />, 2: <SendPrescription ref={SendPrescriptionRef} />, 3: <ViewPrescription id={1} /> }[modalFlag]}
{{ 1: <ViewSymptom id={orderId} />, 2: <SendPrescription ref={SendPrescriptionRef} id={orderId} />, 3: <ViewPrescription id={orderId} /> }[modalFlag]}
</Modal>
{orderList?.length ? (
orderList.map((_, index) => (
<div className="orderItem " key={index}>
<div className="topinfo flexJ">
<div className=" flexA">
<Avatar size="large" src={<img src={_.user?.avatar || url} alt="avatar" />} />
<div className="username">{_.user?.nickname || '暂无用户名'}</div>
<Avatar size="large" src={<img src={GHandler.downFile(_.user?.avatar) || url} alt="avatar" />} />
<div className="username">{_.user?.nickName || '暂无用户名'}</div>
<div className="statetag flexC">{GHandler.optObjectValue('consultationWay', _.consultationWay || 10)}</div>
<div className="time">{_.time}</div>
</div>
... ... @@ -96,12 +125,12 @@ const ShowOrderComHandler: FC<IProps> = (props) => {
</div>
<div className="contenttext">
<span>就诊宠物:</span>
{GHandler.optObjectValue('petType', _?.petType || 30)}/{_?.age || '年龄未知'}/{GHandler.optObjectValue('petSex', _?.petSex || 1)}/
{GHandler.optObjectValue('symptom', _?.symptom as string)}/{_?.weight || '体重未知'}
{_?.petName}/{_?.petClass}/{_?.age || '年龄未知'}/{GHandler.optObjectValue('petSex', _?.petSex || 1)}/
{GHandler.optObjectValue('isSterilization', _?.isSterilization || 0)}/{_?.weight ? _?.weight + 'kg' : '体重未知'}
</div>
<div className="contenttext">
<span>病情描述:</span>
{_.prescriptionForm || '暂无病情描述'}
{_.supplement || '暂无病情描述'}
</div>
<Divider />
<div className="flexJ">
... ... @@ -111,15 +140,32 @@ const ShowOrderComHandler: FC<IProps> = (props) => {
</div>
<div className="flexA">
<Space wrap>
<Button type="primary" shape="round" onClick={() => showModalHandler(1)}>
<Button type="primary" shape="round" onClick={() => showModalHandler(1, _.id)}>
查看症状
</Button>
<Button type="primary" shape="round" onClick={() => showModalHandler(2)}>
{[30, '30'].includes(_.orderState as string | number) ? (
<Button type="primary" shape="round" onClick={() => showModalHandler(2, _.id)}>
发送处方单
</Button>
<Button type="primary" shape="round" onClick={() => showModalHandler(3)}>
) : (
''
)}
{[20, '20'].includes(_.orderState as string | number) ? (
<Button type="primary" shape="round" onClick={() => warning('请到app内进行接诊')}>
接诊
</Button>
) : (
''
)}
{[30, '30', 40, '40'].includes(_.orderState as string | number) ? (
<Button type="primary" shape="round" onClick={() => showModalHandler(3, _.id)}>
查看处方单
</Button>
) : (
''
)}
</Space>
</div>
</div>
... ... @@ -139,14 +185,17 @@ const ConsultationOrder: FC<IProps> = memo(() => {
const [pageNo, setPageNo] = useState<number>(1)
const [orderTotal, setOrderTotal] = useState<number>(0)
useEffect(() => {
// return
dispatch(fetchOrderDataAction({ pageNo: pageNo }))
}, [])
const { ConsultationOrder } = useAppSelector(
const { ConsultationOrder, ConsultationOrderTotal } = useAppSelector(
(state) => ({
ConsultationOrder: state.order.ConsultationOrderList
ConsultationOrder: state.order.ConsultationOrderList,
ConsultationOrderTotal: state.order.total
}),
shallowEqualApp
)
... ... @@ -156,6 +205,7 @@ const ConsultationOrder: FC<IProps> = memo(() => {
if (!ConsultationOrder.length) return
// console.log(ConsultationOrder, '问诊订单列表数据')
setCOrderList(ConsultationOrder)
setOrderTotal(ConsultationOrderTotal)
}, [ConsultationOrder])
const [COrderList, setCOrderList] = useState<ConsultationOrderListItemType[]>([])
... ... @@ -168,7 +218,13 @@ const ConsultationOrder: FC<IProps> = memo(() => {
{ key: '50', label: '已取消', children: ShowOrderComHandler({ orderList: COrderList }) }
]
const onChange = (key: string) => dispatch(fetchOrderDataAction({ pageNo: 1, orderState: key }))
const onChange = (key: string) => {
setCOrderList([])
setOrderTotal(0)
dispatch(fetchOrderDataAction({ pageNo: 1, orderState: key }))
}
const changeOrderListHandler = (e: number) => dispatch(fetchOrderDataAction({ pageNo: e }))
... ... @@ -177,7 +233,7 @@ const ConsultationOrder: FC<IProps> = memo(() => {
<div className="title">问诊订单</div>
<Tabs defaultActiveKey="0" items={items} onChange={onChange} />;
<div className="paginationBox flexD">
<Pagination defaultCurrent={1} total={50} onChange={(e) => changeOrderListHandler(e)} />
<Pagination defaultCurrent={1} total={orderTotal} onChange={(e) => changeOrderListHandler(e)} />
</div>
</ConsultationOrderWrapper>
)
... ...
... ... @@ -14,9 +14,11 @@ export const ConsultationOrderWrapper = styled.div`
margin-bottom: 16px;
}
.paginationBox{
position: absolute;
bottom: 20px;
right: 20px;
display: flex;
align-items: flex-end;
// position: absolute;
// bottom: 20px;
// right: 20px;
}
`
... ...