正在显示
52 个修改的文件
包含
1031 行增加
和
194 行删除
1 | -import hyRequest from "@/service"; | ||
2 | -import { Send_prescription_formType } from '@/types' | 1 | +import hyrequest from "@/service"; |
2 | +import { Send_prescription_formType, PageListParamsType } from '@/types' | ||
3 | 3 | ||
4 | -export const getTopBanner = () => hyRequest.get({ url: '/banner' }) | 4 | +// export const getTopBanner = () => hyrequest.get({ url: '/banner' }) |
5 | 5 | ||
6 | // 公共 | 6 | // 公共 |
7 | -export const getSendMessage = (params: { phoneNum: string }) => hyRequest.get({ url: '/pet/login/sendMessage', params }) // 发送验证码 | ||
8 | -export const getMessageLogin = (params: any) => hyRequest.get({ url: '/pet/login/messageLogin', params }) // 验证码登录 | ||
9 | -export const updateSend_prescription_form = (params: Send_prescription_formType) => hyRequest.post({ url: '/veterinary/send_prescription_form', params }) // 发送处方单 | 7 | +export const getSendMessage = (params: { phoneNum: string }) => hyrequest.get({ url: '/pet/login/sendMessage', params }) // 发送验证码 |
8 | +export const getMessageLogin = (params: any) => hyrequest.get({ url: '/pet/login/messageLogin', params }) // 验证码登录 | ||
9 | + | ||
10 | +// 问诊及处方 | ||
11 | +export const getConsultation_information_list = (params: PageListParamsType) => hyrequest.get({ url: '/veterinary/consultation_information_list', params }) // 问诊订单列表 | ||
12 | +export const updateSend_prescription_form = (params: any) => hyrequest.post({ url: '/veterinary/send_prescription_form', params }) // 发送处方单 | ||
13 | +export const getPrescription_detail = (params: { id: string | number }) => hyrequest.get({ url: '/veterinary/prescription_detail', params }) // 处方单详情 | ||
14 | +export const getConsultation_information_detail = (params: { id: string | number }) => hyrequest.get({ url: '/veterinary/consultation_information_detail', params }) // 问诊订单详情 |
@@ -15,49 +15,49 @@ body, textarea, select, input, button { | @@ -15,49 +15,49 @@ body, textarea, select, input, button { | ||
15 | margin: 0 auto; | 15 | margin: 0 auto; |
16 | } | 16 | } |
17 | 17 | ||
18 | -.sprite_01 { | ||
19 | - background: url(../img/sprite_01.png) no-repeat 0 9999px; | ||
20 | -} | 18 | +// .sprite_01 { |
19 | +// background: url(../img/sprite_01.png) no-repeat 0 9999px; | ||
20 | +// } | ||
21 | 21 | ||
22 | -.sprite_02 { | ||
23 | - background: url(../img/sprite_02.png) no-repeat 0 9999px; | ||
24 | -} | 22 | +// .sprite_02 { |
23 | +// background: url(../img/sprite_02.png) no-repeat 0 9999px; | ||
24 | +// } | ||
25 | 25 | ||
26 | -.sprite_cover { | ||
27 | - background: url(../img/sprite_cover.png) no-repeat 0 9999px; | ||
28 | -} | 26 | +// .sprite_cover { |
27 | +// background: url(../img/sprite_cover.png) no-repeat 0 9999px; | ||
28 | +// } | ||
29 | 29 | ||
30 | -.sprite_icon { | ||
31 | - background: url(../img/sprite_icon.png) no-repeat 0 9999px; | ||
32 | -} | 30 | +// .sprite_icon { |
31 | +// background: url(../img/sprite_icon.png) no-repeat 0 9999px; | ||
32 | +// } | ||
33 | 33 | ||
34 | -.sprite_icon2 { | ||
35 | - background: url(../img/sprite_icon2.png) no-repeat 0 9999px; | ||
36 | -} | 34 | +// .sprite_icon2 { |
35 | +// background: url(../img/sprite_icon2.png) no-repeat 0 9999px; | ||
36 | +// } | ||
37 | 37 | ||
38 | -.sprite_icon3 { | ||
39 | - background: url(../img/sprite_icon3.png) no-repeat 0 9999px; | ||
40 | -} | 38 | +// .sprite_icon3 { |
39 | +// background: url(../img/sprite_icon3.png) no-repeat 0 9999px; | ||
40 | +// } | ||
41 | 41 | ||
42 | -.sprite_button { | ||
43 | - background: url(../img/sprite_button.png) no-repeat 0 9999px; | ||
44 | -} | 42 | +// .sprite_button { |
43 | +// background: url(../img/sprite_button.png) no-repeat 0 9999px; | ||
44 | +// } | ||
45 | 45 | ||
46 | -.sprite_button2 { | ||
47 | - background: url(../img/sprite_button2.png) no-repeat 0 9999px; | ||
48 | -} | 46 | +// .sprite_button2 { |
47 | +// background: url(../img/sprite_button2.png) no-repeat 0 9999px; | ||
48 | +// } | ||
49 | 49 | ||
50 | -.sprite_table { | ||
51 | - background: url(../img/sprite_table.png) no-repeat 0 9999px; | ||
52 | -} | 50 | +// .sprite_table { |
51 | +// background: url(../img/sprite_table.png) no-repeat 0 9999px; | ||
52 | +// } | ||
53 | 53 | ||
54 | -.sprite_playbar { | ||
55 | - background: url(../img/playbar_sprite.png) no-repeat 0 9999px; | ||
56 | -} | 54 | +// .sprite_playbar { |
55 | +// background: url(../img/playbar_sprite.png) no-repeat 0 9999px; | ||
56 | +// } | ||
57 | 57 | ||
58 | -.sprite_playlist { | ||
59 | - background: url(../img/playlist_sprite.png) no-repeat 0 9999px; | ||
60 | -} | 58 | +// .sprite_playlist { |
59 | +// background: url(../img/playlist_sprite.png) no-repeat 0 9999px; | ||
60 | +// } | ||
61 | 61 | ||
62 | .ant-message .ant-message-notice-content { | 62 | .ant-message .ant-message-notice-content { |
63 | // position: fixed; | 63 | // position: fixed; |
src/assets/img/banner-control-left.png
已删除
100644 → 0
303 字节
src/assets/img/banner-control-right.png
已删除
100644 → 0
304 字节
src/assets/img/banner_sprite.png
已删除
100644 → 0
4.4 KB
src/assets/img/body_bg.jpeg
已删除
100644 → 0
74.4 KB
src/assets/img/body_bg02.png
已删除
100644 → 0
55.5 KB
src/assets/img/body_bg03.png
已删除
100644 → 0
101.4 KB
src/assets/img/download.png
已删除
100644 → 0
17.7 KB
src/assets/img/friend_sprite.jpg
已删除
100644 → 0
23.9 KB
src/assets/img/mine_sprite.png
已删除
100644 → 0
22.7 KB
src/assets/img/pip_icon
已删除
100644 → 0
不能预览此文件类型
src/assets/img/playbar_sprite.png
已删除
100644 → 0
14.5 KB
src/assets/img/playlist_sprite.png
已删除
100644 → 0
3.7 KB
src/assets/img/playpanel_bg.png
已删除
100644 → 0
38.0 KB
src/assets/img/progress_bar.png
已删除
100644 → 0
1.2 KB
src/assets/img/radio_slide.png
已删除
100644 → 0
1.4 KB
src/assets/img/recommend-top-bg.png
已删除
100644 → 0
3.0 KB
src/assets/img/singer_sprite.png
已删除
100644 → 0
698 字节
src/assets/img/sprite_01.png
已删除
100644 → 0
3.0 KB
src/assets/img/sprite_02.png
已删除
100644 → 0
13.5 KB
src/assets/img/sprite_button.png
已删除
100644 → 0
45.2 KB
src/assets/img/sprite_button2.png
已删除
100644 → 0
13.7 KB
src/assets/img/sprite_cover.png
已删除
100644 → 0
77.0 KB
src/assets/img/sprite_footer_01.png
已删除
100644 → 0
22.7 KB
src/assets/img/sprite_footer_02.png
已删除
100644 → 0
47.2 KB
src/assets/img/sprite_icon.png
已删除
100644 → 0
14.1 KB
src/assets/img/sprite_icon2.png
已删除
100644 → 0
14.6 KB
src/assets/img/sprite_icon3.png
已删除
100644 → 0
13.5 KB
src/assets/img/sprite_table.png
已删除
100644 → 0
2.7 KB
src/assets/img/wrap-bg.png
已删除
100644 → 0
171 字节
src/service copy/index.ts
0 → 100644
1 | +// service统一出口 | ||
2 | +import HYRequest from './request' | ||
3 | +import { BASE_URL, TIME_OUT } from './request/config' | ||
4 | + | ||
5 | +const hyRequest = new HYRequest({ | ||
6 | + baseURL: BASE_URL, | ||
7 | + timeout: TIME_OUT, | ||
8 | + headers: { | ||
9 | + 'X-Access-Token': localStorage.getItem('token') || '' | ||
10 | + }, | ||
11 | + interceptors: { | ||
12 | + requestInterceptor: (config) => { | ||
13 | + return config | ||
14 | + }, | ||
15 | + requestInterceptorCatch: (err) => { | ||
16 | + return err | ||
17 | + }, | ||
18 | + responseInterceptor: (res) => { | ||
19 | + return res | ||
20 | + }, | ||
21 | + responseInterceptorCatch: (err) => { | ||
22 | + return err | ||
23 | + } | ||
24 | + } | ||
25 | +}) | ||
26 | + | ||
27 | +export default hyRequest |
1 | // const BASE_URL = 'http://codercba.com:9002/' | 1 | // const BASE_URL = 'http://codercba.com:9002/' |
2 | -const BASE_URL = 'http://192.168.10.63:8080/jeecg-boot' | 2 | +// const BASE_URL = 'http://192.168.10.63:8080/jeecg-boot' |
3 | +const BASE_URL = 'http://127.0.0.1:4523/m1/3332971-0-default/jeecg-boot' // mock | ||
3 | 4 | ||
4 | const TIME_OUT = 10000 | 5 | const TIME_OUT = 10000 |
5 | 6 |
src/service copy/request/index.ts
0 → 100644
1 | +import axios from 'axios' | ||
2 | +import type { AxiosInstance } from 'axios' | ||
3 | +import type { HYRequestInterceptors, HYRequestConfig } from './type' | ||
4 | + | ||
5 | +const DEAFULT_LOADING = true | ||
6 | + | ||
7 | +class HYRequest { | ||
8 | + instance: AxiosInstance | ||
9 | + interceptors?: HYRequestInterceptors | ||
10 | + showLoading: boolean | ||
11 | + | ||
12 | + constructor(config: HYRequestConfig) { | ||
13 | + // 创建axios实例 | ||
14 | + this.instance = axios.create(config) | ||
15 | + | ||
16 | + // 保存基本信息 | ||
17 | + this.showLoading = config.showLoading ?? DEAFULT_LOADING | ||
18 | + this.interceptors = config.interceptors | ||
19 | + | ||
20 | + // 使用拦截器 | ||
21 | + // 1.从config中取出的拦截器是对应的实例的拦截器 | ||
22 | + this.instance.interceptors.request.use( | ||
23 | + // this.interceptors?.requestInterceptor, | ||
24 | + this.interceptors?.requestInterceptorCatch | ||
25 | + ) | ||
26 | + this.instance.interceptors.response.use( | ||
27 | + this.interceptors?.responseInterceptor, | ||
28 | + this.interceptors?.responseInterceptorCatch | ||
29 | + ) | ||
30 | + | ||
31 | + // 2.添加所有的实例都有的拦截器 | ||
32 | + this.instance.interceptors.request.use( | ||
33 | + (config) => { | ||
34 | + return config | ||
35 | + }, | ||
36 | + (err) => { | ||
37 | + return err | ||
38 | + } | ||
39 | + ) | ||
40 | + | ||
41 | + this.instance.interceptors.response.use( | ||
42 | + (res: any) => { | ||
43 | + console.log(res, 'res') | ||
44 | + // const data = res | ||
45 | + // console.log(data, '请求数据') | ||
46 | + // if (data.code === '404') { | ||
47 | + // console.log('请求失败~, 错误信息') | ||
48 | + // } else { | ||
49 | + // return data | ||
50 | + // } | ||
51 | + return res | ||
52 | + }, | ||
53 | + (err) => { | ||
54 | + // 例子: 判断不同的HttpErrorCode显示不同的错误信息 | ||
55 | + if (err.response.status === 404) { | ||
56 | + console.log('404的错误~') | ||
57 | + } | ||
58 | + return err | ||
59 | + } | ||
60 | + ) | ||
61 | + } | ||
62 | + | ||
63 | + request<T = any>(config: HYRequestConfig<T>): Promise<T> { | ||
64 | + return new Promise((resolve, reject) => { | ||
65 | + // 1.单个请求对请求config的处理 | ||
66 | + if (config.interceptors?.requestInterceptor) { | ||
67 | + config = config.interceptors.requestInterceptor(config) | ||
68 | + } | ||
69 | + | ||
70 | + // 2.判断是否需要显示loading | ||
71 | + if (config.showLoading === false) { | ||
72 | + this.showLoading = config.showLoading | ||
73 | + } | ||
74 | + | ||
75 | + this.instance | ||
76 | + .request<any, T>(config) | ||
77 | + .then((res) => { | ||
78 | + // 1.单个请求对数据的处理 | ||
79 | + if (config.interceptors?.responseInterceptor) { | ||
80 | + res = config.interceptors.responseInterceptor(res) | ||
81 | + } | ||
82 | + // 2.将showLoading设置true, 这样不会影响下一个请求 | ||
83 | + this.showLoading = DEAFULT_LOADING | ||
84 | + | ||
85 | + // 3.将结果resolve返回出去 | ||
86 | + resolve(res) | ||
87 | + }) | ||
88 | + .catch((err) => { | ||
89 | + // 将showLoading设置true, 这样不会影响下一个请求 | ||
90 | + this.showLoading = DEAFULT_LOADING | ||
91 | + reject(err) | ||
92 | + return err | ||
93 | + }) | ||
94 | + }) | ||
95 | + } | ||
96 | + | ||
97 | + get<T = any>(config: HYRequestConfig<T>): Promise<T> { | ||
98 | + return this.request<T>({ ...config, method: 'GET' }) | ||
99 | + } | ||
100 | + | ||
101 | + post<T = any>(config: HYRequestConfig<T>): Promise<T> { | ||
102 | + return this.request<T>({ ...config, method: 'POST' }) | ||
103 | + } | ||
104 | + | ||
105 | + delete<T = any>(config: HYRequestConfig<T>): Promise<T> { | ||
106 | + return this.request<T>({ ...config, method: 'DELETE' }) | ||
107 | + } | ||
108 | + | ||
109 | + patch<T = any>(config: HYRequestConfig<T>): Promise<T> { | ||
110 | + return this.request<T>({ ...config, method: 'PATCH' }) | ||
111 | + } | ||
112 | +} | ||
113 | + | ||
114 | +export default HYRequest |
src/service/config/index.ts
0 → 100644
1 | -// service统一出口 | ||
2 | -import HYRequest from './request' | ||
3 | -import { BASE_URL, TIME_OUT } from './request/config' | 1 | +import { LStore } from "@/utils/store"; |
2 | +import { BASE_URL, TIME_OUT } from "./config"; | ||
3 | +import HYRequest from "./request"; | ||
4 | 4 | ||
5 | -const hyRequest = new HYRequest({ | 5 | +const hyrequest = new HYRequest({ |
6 | baseURL: BASE_URL, | 6 | baseURL: BASE_URL, |
7 | timeout: TIME_OUT, | 7 | timeout: TIME_OUT, |
8 | - headers: { | ||
9 | - 'X-Access-Token': localStorage.getItem('token') || '' | ||
10 | - }, | ||
11 | interceptors: { | 8 | interceptors: { |
12 | - requestInterceptor: (config) => { | 9 | + |
10 | + requestSuccessFn(config) { | ||
11 | + const token = LStore.get('token') | ||
12 | + if (token && config.headers) { | ||
13 | + config.headers['Content-Type'] = 'multipart/form-data;' | ||
14 | + config.headers.token = token | ||
15 | + config.headers['X-Access-Token'] = token | ||
16 | + } | ||
13 | return config | 17 | return config |
14 | }, | 18 | }, |
15 | - requestInterceptorCatch: (err) => { | ||
16 | - return err | ||
17 | - }, | ||
18 | - responseInterceptor: (res) => { | ||
19 | - return res | 19 | + |
20 | + responseFailureFn(err) { | ||
21 | + // console.log(err, '相应失败') | ||
22 | + // return err | ||
20 | }, | 23 | }, |
21 | - responseInterceptorCatch: (err) => { | ||
22 | - return err | 24 | + |
25 | + requestFailureFn(err) { | ||
26 | + // console.log(err, '请求失败') | ||
27 | + // return err | ||
23 | } | 28 | } |
29 | + | ||
24 | } | 30 | } |
25 | }) | 31 | }) |
26 | 32 | ||
27 | -export default hyRequest | 33 | +export default hyrequest |
1 | -import axios from 'axios' | ||
2 | -import type { AxiosInstance } from 'axios' | ||
3 | -import type { HYRequestInterceptors, HYRequestConfig } from './type' | ||
4 | - | ||
5 | -const DEAFULT_LOADING = true | 1 | +import axios from "axios" |
2 | +import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios' | ||
3 | +import type { HYRequestConfig } from './types' | ||
4 | +// import router from "../../router" | ||
5 | + | ||
6 | +/** | ||
7 | + * 两个难点: | ||
8 | + * 1. 拦截器进行精细控制 | ||
9 | + * > 全局拦截器 | ||
10 | + * > 实例拦截器 | ||
11 | + * > 单次请求拦截器 | ||
12 | + * 2. 响应结果的类型处理(泛型) | ||
13 | + */ | ||
6 | 14 | ||
7 | class HYRequest { | 15 | class HYRequest { |
8 | instance: AxiosInstance | 16 | instance: AxiosInstance |
9 | - interceptors?: HYRequestInterceptors | ||
10 | - showLoading: boolean | ||
11 | - | 17 | + // request 实例 => axios 实例 |
12 | constructor(config: HYRequestConfig) { | 18 | constructor(config: HYRequestConfig) { |
13 | - // 创建axios实例 | ||
14 | this.instance = axios.create(config) | 19 | this.instance = axios.create(config) |
15 | 20 | ||
16 | - // 保存基本信息 | ||
17 | - this.showLoading = config.showLoading ?? DEAFULT_LOADING | ||
18 | - this.interceptors = config.interceptors | ||
19 | - | ||
20 | - // 使用拦截器 | ||
21 | - // 1.从config中取出的拦截器是对应的实例的拦截器 | ||
22 | - this.instance.interceptors.request.use( | ||
23 | - // this.interceptors?.requestInterceptor, | ||
24 | - this.interceptors?.requestInterceptorCatch | ||
25 | - ) | ||
26 | - this.instance.interceptors.response.use( | ||
27 | - this.interceptors?.responseInterceptor, | ||
28 | - this.interceptors?.responseInterceptorCatch | ||
29 | - ) | ||
30 | 21 | ||
31 | - // 2.添加所有的实例都有的拦截器 | ||
32 | - this.instance.interceptors.request.use( | ||
33 | - (config) => { | 22 | + // 每个 instance 实例都添加拦截器 |
23 | + this.instance.interceptors.request.use((config) => { | ||
24 | + // loading/token | ||
34 | return config | 25 | return config |
35 | - }, | ||
36 | - (err) => { | 26 | + }, err => { |
27 | + console.log('全局请求失败的拦截', err) | ||
37 | return err | 28 | return err |
29 | + }) | ||
30 | + this.instance.interceptors.response.use(res => { | ||
31 | + // console.log('全局相应成功的拦截') | ||
32 | + return res.data | ||
33 | + }, err => { | ||
34 | + if (err.response.data.code === 401) { | ||
35 | + // router.push('/login') | ||
38 | } | 36 | } |
39 | - ) | 37 | + console.log('全局相应失败的拦截', err.response.data) |
38 | + return err | ||
39 | + }) | ||
40 | 40 | ||
41 | + // 针对特定的 hyRequest 实例添加拦截器 | ||
42 | + if (config.interceptors) { | ||
43 | + this.instance.interceptors.request.use( | ||
44 | + config?.interceptors.requestSuccessFn, | ||
45 | + config?.interceptors.requestFailureFn | ||
46 | + ) | ||
41 | this.instance.interceptors.response.use( | 47 | this.instance.interceptors.response.use( |
42 | - (res) => { | ||
43 | - const data = res.data | ||
44 | - if (data.returnCode === '-1001') { | ||
45 | - console.log('请求失败~, 错误信息') | ||
46 | - } else { | ||
47 | - return data | ||
48 | - } | ||
49 | - }, | ||
50 | - (err) => { | ||
51 | - // 例子: 判断不同的HttpErrorCode显示不同的错误信息 | ||
52 | - if (err.response.status === 404) { | ||
53 | - console.log('404的错误~') | ||
54 | - } | ||
55 | - return err | ||
56 | - } | 48 | + config?.interceptors.responseSuccessFn, |
49 | + config?.interceptors.responseFailureFn | ||
57 | ) | 50 | ) |
58 | } | 51 | } |
59 | - | ||
60 | - request<T = any>(config: HYRequestConfig<T>): Promise<T> { | ||
61 | - return new Promise((resolve, reject) => { | ||
62 | - // 1.单个请求对请求config的处理 | ||
63 | - if (config.interceptors?.requestInterceptor) { | ||
64 | - config = config.interceptors.requestInterceptor(config) | ||
65 | } | 52 | } |
66 | 53 | ||
67 | - // 2.判断是否需要显示loading | ||
68 | - if (config.showLoading === false) { | ||
69 | - this.showLoading = config.showLoading | 54 | + request<T = any>(config: HYRequestConfig<T>) { |
55 | + // 单次请求的成功拦截器 | ||
56 | + if (config.interceptors?.requestSuccessFn) { | ||
57 | + config = config.interceptors.requestSuccessFn(config) | ||
70 | } | 58 | } |
71 | - | ||
72 | - this.instance | ||
73 | - .request<any, T>(config) | ||
74 | - .then((res) => { | ||
75 | - // 1.单个请求对数据的处理 | ||
76 | - if (config.interceptors?.responseInterceptor) { | ||
77 | - res = config.interceptors.responseInterceptor(res) | 59 | + return new Promise<T>((resolve, reject) => { |
60 | + this.instance.request<any, T>(config).then(res => { | ||
61 | + // 单词响应的成功拦截器 | ||
62 | + if (config.interceptors?.responseSuccessFn) { | ||
63 | + res = config.interceptors.responseSuccessFn(res) | ||
78 | } | 64 | } |
79 | - // 2.将showLoading设置true, 这样不会影响下一个请求 | ||
80 | - this.showLoading = DEAFULT_LOADING | ||
81 | - | ||
82 | - // 3.将结果resolve返回出去 | ||
83 | resolve(res) | 65 | resolve(res) |
84 | - }) | ||
85 | - .catch((err) => { | ||
86 | - // 将showLoading设置true, 这样不会影响下一个请求 | ||
87 | - this.showLoading = DEAFULT_LOADING | 66 | + }).catch(err => { |
88 | reject(err) | 67 | reject(err) |
89 | - return err | ||
90 | }) | 68 | }) |
91 | }) | 69 | }) |
92 | } | 70 | } |
93 | 71 | ||
94 | - get<T = any>(config: HYRequestConfig<T>): Promise<T> { | ||
95 | - return this.request<T>({ ...config, method: 'GET' }) | 72 | + get<T = any>(config: HYRequestConfig<T>) { |
73 | + return this.request({ ...config, method: "GET" }) | ||
96 | } | 74 | } |
97 | - | ||
98 | - post<T = any>(config: HYRequestConfig<T>): Promise<T> { | ||
99 | - return this.request<T>({ ...config, method: 'POST' }) | 75 | + post<T = any>(config: HYRequestConfig<T>) { |
76 | + return this.request({ ...config, method: "POST" }) | ||
100 | } | 77 | } |
101 | - | ||
102 | - delete<T = any>(config: HYRequestConfig<T>): Promise<T> { | ||
103 | - return this.request<T>({ ...config, method: 'DELETE' }) | 78 | + delete<T = any>(config: HYRequestConfig<T>) { |
79 | + return this.request({ ...config, method: "DELETE" }) | ||
104 | } | 80 | } |
105 | - | ||
106 | - patch<T = any>(config: HYRequestConfig<T>): Promise<T> { | ||
107 | - return this.request<T>({ ...config, method: 'PATCH' }) | 81 | + patch<T = any>(config: HYRequestConfig<T>) { |
82 | + return this.request({ ...config, method: "PATCH" }) | ||
108 | } | 83 | } |
109 | } | 84 | } |
110 | 85 |
src/service/request/types.ts
0 → 100644
1 | +import type { AxiosRequestConfig, AxiosResponse } from "axios" | ||
2 | + | ||
3 | +/* eslint-disable */ | ||
4 | +interface HCInterceptors<T = AxiosResponse> { | ||
5 | + requestSuccessFn?: (config: any) => any | ||
6 | + requestFailureFn?: (err: any) => any | ||
7 | + responseSuccessFn?: (res: T) => T | ||
8 | + responseFailureFn?: (err: any) => any | ||
9 | +} | ||
10 | + | ||
11 | +// 针对 AxiosRequestConfig 接口进行扩展 | ||
12 | +export interface HYRequestConfig<T = AxiosResponse> extends AxiosRequestConfig { | ||
13 | + interceptors?: HCInterceptors<T> | ||
14 | +} |
@@ -11,7 +11,7 @@ const store = configureStore({ | @@ -11,7 +11,7 @@ const store = configureStore({ | ||
11 | }) | 11 | }) |
12 | 12 | ||
13 | type GetStateFnType = typeof store.getState | 13 | type GetStateFnType = typeof store.getState |
14 | -type RootState = ReturnType<GetStateFnType> | 14 | +export type RootState = ReturnType<GetStateFnType> |
15 | type DispatchType = typeof store.dispatch | 15 | type DispatchType = typeof store.dispatch |
16 | 16 | ||
17 | // 拿到 redux 内定义的变量的类型 | 17 | // 拿到 redux 内定义的变量的类型 |
1 | import { createSlice, createAsyncThunk } from '@reduxjs/toolkit' | 1 | import { createSlice, createAsyncThunk } from '@reduxjs/toolkit' |
2 | -import { getTopBanner } from '@/api' | 2 | +import { getConsultation_information_list, getConsultation_information_detail, getPrescription_detail } from '@/api' |
3 | +import type { PageListParamsType, ConsultationOrderListItemType, PageListType, ConsultationOrderDetailType, PrescriptionDetailType } from '@/types' | ||
4 | +import type { RootState } from '@/store' | ||
3 | 5 | ||
4 | -export const fetchOrderDataAction = createAsyncThunk( | ||
5 | - 'fetchdata', | ||
6 | - (payload, { dispatch }) => { | ||
7 | - // 1.顶部的banners | ||
8 | - getTopBanner().then((res: any) => { | ||
9 | - dispatch(changeBannerAction(res.banners)) | 6 | +export const fetchOrderDataAction = createAsyncThunk<void, PageListParamsType>( |
7 | + 'fetchdata', (payload, { dispatch }) => { | ||
8 | + console.log(payload, '接受的参数') | ||
9 | + // 1.获取问诊订单列表 | ||
10 | + getConsultation_information_list(payload).then(({ result }: { result: PageListType<ConsultationOrderListItemType[]> }) => { | ||
11 | + console.log(result, '问诊订单列表') | ||
12 | + dispatch(changeConsultationOrderAction(result)) | ||
10 | }) | 13 | }) |
14 | + } | ||
15 | +) | ||
11 | 16 | ||
12 | - return null | 17 | +export const fetchConsultationOrderDetailAction = createAsyncThunk<void, { id: string | number }>( |
18 | + 'ConsultationOrderDetailType', (payload, { dispatch }) => { | ||
19 | + // getConsultation_information_detail(payload).then(({ result }: { result: ConsultationOrderDetailType }) => { | ||
20 | + dispatch(changeConsultationOrderDetailAction({})) | ||
21 | + // }) | ||
22 | + } | ||
23 | +) | ||
24 | + | ||
25 | +export const fetchPrescriptionDetailAction = createAsyncThunk<void, { id: string | number }>( | ||
26 | + 'PrescriptionDetail', (payload, { dispatch }) => { | ||
27 | + // getPrescription_detail(payload).then(({ result }: { result: PrescriptionDetailType }) => { | ||
28 | + dispatch(changePrescriptionDetailAction({})) | ||
29 | + // }) | ||
13 | } | 30 | } |
14 | ) | 31 | ) |
15 | 32 | ||
@@ -19,15 +36,23 @@ const orderSlice = createSlice({ | @@ -19,15 +36,23 @@ const orderSlice = createSlice({ | ||
19 | count: 100, | 36 | count: 100, |
20 | message: 'hello Redux', | 37 | message: 'hello Redux', |
21 | name: 'HachimanC', | 38 | name: 'HachimanC', |
22 | - bannersList: [] | 39 | + ConsultationOrderList: [], |
40 | + ConsultationOrderDetailData: {}, | ||
41 | + PrescriptionDetailData: {} | ||
23 | }, | 42 | }, |
24 | reducers: { | 43 | reducers: { |
25 | - changeBannerAction(state, { payload }) { | ||
26 | - state.bannersList = payload | 44 | + changeConsultationOrderAction(state, { payload }) { |
45 | + state.ConsultationOrderList = payload | ||
46 | + }, | ||
47 | + changeConsultationOrderDetailAction(state, { payload }) { | ||
48 | + state.ConsultationOrderDetailData = payload | ||
49 | + }, | ||
50 | + changePrescriptionDetailAction(state, { payload }) { | ||
51 | + state.PrescriptionDetailData = payload | ||
27 | } | 52 | } |
28 | } | 53 | } |
29 | }) | 54 | }) |
30 | 55 | ||
31 | export default orderSlice.reducer | 56 | export default orderSlice.reducer |
32 | 57 | ||
33 | -export const { changeBannerAction } = orderSlice.actions | 58 | +export const { changeConsultationOrderAction, changeConsultationOrderDetailAction, changePrescriptionDetailAction } = orderSlice.actions |
@@ -8,6 +8,7 @@ export interface Send_prescription_formType { | @@ -8,6 +8,7 @@ export interface Send_prescription_formType { | ||
8 | * 处方药 | 8 | * 处方药 |
9 | */ | 9 | */ |
10 | drugList: DrugList[]; | 10 | drugList: DrugList[]; |
11 | + // drugList: any; | ||
11 | /** | 12 | /** |
12 | * 问诊订单id | 13 | * 问诊订单id |
13 | */ | 14 | */ |
@@ -46,3 +47,18 @@ export interface DrugList { | @@ -46,3 +47,18 @@ export interface DrugList { | ||
46 | num: string; | 47 | num: string; |
47 | [property: string]: any; | 48 | [property: string]: any; |
48 | } | 49 | } |
50 | +export interface PageListParamsType { | ||
51 | + /** | ||
52 | + * 订单状态 20-待问诊 30-问诊中 40-问诊结束 50-已取消 | ||
53 | + */ | ||
54 | + orderState?: number | string; | ||
55 | + /** | ||
56 | + * 页数 | ||
57 | + */ | ||
58 | + pageNo: number | string; | ||
59 | + /** | ||
60 | + * 每页显示条数 | ||
61 | + */ | ||
62 | + pageSize?: number | string; | ||
63 | + [property: string]: any; | ||
64 | +} |
src/types/props.d.ts
0 → 100644
1 | +import type { FC, ReactNode } from 'react' | ||
2 | +import type { Send_prescription_formType } from '@/types' | ||
3 | + | ||
4 | +export interface SendPrescriptionPropsType { | ||
5 | + children?: ReactNode | ||
6 | + ref?: any | ||
7 | + Send_prescription_formData: Send_prescription_formType | ||
8 | + fileList: any, | ||
9 | + setSend_prescription_formTypeData?: (e: any) => any | ||
10 | + setFileList?: (e: any) => any | ||
11 | +} |
@@ -55,3 +55,469 @@ export interface ConsultationOrderRecordsType { | @@ -55,3 +55,469 @@ export interface ConsultationOrderRecordsType { | ||
55 | orderState: number; | 55 | orderState: number; |
56 | effect_award: number; | 56 | effect_award: number; |
57 | } | 57 | } |
58 | + | ||
59 | +export interface ConsultationOrderListItemType { | ||
60 | + /** | ||
61 | + * 宠物年龄 | ||
62 | + */ | ||
63 | + age?: number; | ||
64 | + /** | ||
65 | + * 处方单价格 | ||
66 | + */ | ||
67 | + amount?: number; | ||
68 | + /** | ||
69 | + * 预计收入 | ||
70 | + */ | ||
71 | + award?: number; | ||
72 | + /** | ||
73 | + * 洗澡频次1=一周一次(狗狗)2=洗澡频次不规律3=想起来才洗4=定期洗澡(猫猫) | ||
74 | + */ | ||
75 | + batheFrequency?: string; | ||
76 | + /** | ||
77 | + * 问诊状态 0-未开始 1-进行中 2-已结束 | ||
78 | + */ | ||
79 | + consultationState?: number; | ||
80 | + /** | ||
81 | + * 问诊方式 10-快速问诊 21-专家图文语音问诊 22-专家视频问诊 23-专家电话问诊 | ||
82 | + */ | ||
83 | + consultationWay: number; | ||
84 | + /** | ||
85 | + * 医生信息 | ||
86 | + */ | ||
87 | + doctor: Doctor; | ||
88 | + /** | ||
89 | + * 处方药 | ||
90 | + */ | ||
91 | + drugList?: DrugList[]; | ||
92 | + /** | ||
93 | + * 实际收入 | ||
94 | + */ | ||
95 | + effect_award?: number; | ||
96 | + /** | ||
97 | + * 喂养方式1=配方粮2=配方粮+零食3=只吃人食物4=自制犬猫粮 | ||
98 | + */ | ||
99 | + feedType?: string; | ||
100 | + /** | ||
101 | + * 订单id | ||
102 | + */ | ||
103 | + id: string; | ||
104 | + /** | ||
105 | + * 症状图片 | ||
106 | + */ | ||
107 | + image?: string[]; | ||
108 | + /** | ||
109 | + * 宠物免疫情况1=已免疫2=未免疫3=免疫不全4=免疫不详 | ||
110 | + */ | ||
111 | + immuneStatus?: string; | ||
112 | + /** | ||
113 | + * 是否为复诊0=否1=是 | ||
114 | + */ | ||
115 | + isAgain?: number; | ||
116 | + /** | ||
117 | + * 是否绝育 0-否 1-是 | ||
118 | + */ | ||
119 | + isSterilization?: number; | ||
120 | + /** | ||
121 | + * 订单编号 | ||
122 | + */ | ||
123 | + order_no: string; | ||
124 | + /** | ||
125 | + * 订单状态 10=待支付 20-待问诊 30-进行中 40-已完成 50-已取消 | ||
126 | + */ | ||
127 | + orderState?: number; | ||
128 | + /** | ||
129 | + * 应付金额 | ||
130 | + */ | ||
131 | + payAmount: number; | ||
132 | + /** | ||
133 | + * 下单时间 | ||
134 | + */ | ||
135 | + payTime: string; | ||
136 | + /** | ||
137 | + * 宠物品种 | ||
138 | + */ | ||
139 | + petClass?: string; | ||
140 | + /** | ||
141 | + * 宠物id | ||
142 | + */ | ||
143 | + petId?: string; | ||
144 | + /** | ||
145 | + * 宠物名称 | ||
146 | + */ | ||
147 | + petName?: string; | ||
148 | + /** | ||
149 | + * 宠物性别 0-母 1-公 | ||
150 | + */ | ||
151 | + petSex?: number; | ||
152 | + /** | ||
153 | + * 宠物类型 10-猫 20-狗 30-异宠 | ||
154 | + */ | ||
155 | + petType?: number; | ||
156 | + /** | ||
157 | + * 处方单文件 | ||
158 | + */ | ||
159 | + prescriptionFile?: string; | ||
160 | + /** | ||
161 | + * 处方单问诊病情描述 | ||
162 | + */ | ||
163 | + prescriptionForm?: string; | ||
164 | + /** | ||
165 | + * 实付金额 | ||
166 | + */ | ||
167 | + realityPayAmount: number; | ||
168 | + /** | ||
169 | + * 剩余时间(秒) | ||
170 | + */ | ||
171 | + remainder?: number; | ||
172 | + /** | ||
173 | + * 补充症状 | ||
174 | + */ | ||
175 | + supplement?: string; | ||
176 | + /** | ||
177 | + * 宠物出现的症状1=呕吐2=软便拉稀3=皮肤问题4=眼睛问题5=泌尿问题6=绝育7=疫苗8=驱虫9=养护问题10=其他 | ||
178 | + */ | ||
179 | + symptom?: string; | ||
180 | + /** | ||
181 | + * 问诊时间 | ||
182 | + */ | ||
183 | + time?: string; | ||
184 | + /** | ||
185 | + * 症状出现时间1=<7天2=<1个月3=<3个月4=3个月以上 | ||
186 | + */ | ||
187 | + timeFrame?: string; | ||
188 | + /** | ||
189 | + * 提交问诊用户信息 | ||
190 | + */ | ||
191 | + user?: User; | ||
192 | + /** | ||
193 | + * 宠物体重 | ||
194 | + */ | ||
195 | + weight?: string; | ||
196 | + [property: string]: any; | ||
197 | +} | ||
198 | + | ||
199 | +// 问诊订单详情 | ||
200 | +export interface Response { | ||
201 | + code: number; | ||
202 | + message: string; | ||
203 | + result: Result; | ||
204 | + success: boolean; | ||
205 | + timestamp: number; | ||
206 | + [property: string]: any; | ||
207 | +} | ||
208 | + | ||
209 | +// 问诊订单详情 | ||
210 | +export interface ConsultationOrderDetailType { | ||
211 | + /** | ||
212 | + * 宠物年龄 | ||
213 | + */ | ||
214 | + age?: number; | ||
215 | + /** | ||
216 | + * 处方单价格 | ||
217 | + */ | ||
218 | + amount?: number; | ||
219 | + /** | ||
220 | + * 预计收入 | ||
221 | + */ | ||
222 | + award?: number; | ||
223 | + /** | ||
224 | + * 洗澡频次1=一周一次(狗狗)2=洗澡频次不规律3=想起来才洗4=定期洗澡(猫猫) | ||
225 | + */ | ||
226 | + batheFrequency?: string; | ||
227 | + /** | ||
228 | + * 问诊状态 0-未开始 1-进行中 2-已结束 | ||
229 | + */ | ||
230 | + consultationState?: number; | ||
231 | + /** | ||
232 | + * 问诊方式 10-快速问诊 21-专家图文语音问诊 22-专家视频问诊 23-专家电话问诊 | ||
233 | + */ | ||
234 | + consultationWay: number; | ||
235 | + /** | ||
236 | + * 医生信息 | ||
237 | + */ | ||
238 | + doctor: Doctor; | ||
239 | + /** | ||
240 | + * 处方药 | ||
241 | + */ | ||
242 | + drugList?: DrugList[]; | ||
243 | + /** | ||
244 | + * 实际收入 | ||
245 | + */ | ||
246 | + effect_award?: number; | ||
247 | + /** | ||
248 | + * 喂养方式1=配方粮2=配方粮+零食3=只吃人食物4=自制犬猫粮 | ||
249 | + */ | ||
250 | + feedType?: string; | ||
251 | + /** | ||
252 | + * 订单id | ||
253 | + */ | ||
254 | + id: string; | ||
255 | + /** | ||
256 | + * 症状图片 | ||
257 | + */ | ||
258 | + image?: string[]; | ||
259 | + /** | ||
260 | + * 宠物免疫情况1=已免疫2=未免疫3=免疫不全4=免疫不详 | ||
261 | + */ | ||
262 | + immuneStatus?: string; | ||
263 | + /** | ||
264 | + * 是否为复诊0=否1=是 | ||
265 | + */ | ||
266 | + isAgain?: number; | ||
267 | + /** | ||
268 | + * 是否绝育 0-否 1-是 | ||
269 | + */ | ||
270 | + isSterilization?: number; | ||
271 | + /** | ||
272 | + * 订单编号 | ||
273 | + */ | ||
274 | + order_no: string; | ||
275 | + /** | ||
276 | + * 订单状态 10=待支付 20-待问诊 30-进行中 40-已完成 50-已取消 | ||
277 | + */ | ||
278 | + orderState?: number; | ||
279 | + /** | ||
280 | + * 应付金额 | ||
281 | + */ | ||
282 | + payAmount: number; | ||
283 | + /** | ||
284 | + * 下单时间 | ||
285 | + */ | ||
286 | + payTime: string; | ||
287 | + /** | ||
288 | + * 宠物品种 | ||
289 | + */ | ||
290 | + petClass?: string; | ||
291 | + /** | ||
292 | + * 宠物id | ||
293 | + */ | ||
294 | + petId?: string; | ||
295 | + /** | ||
296 | + * 宠物名称 | ||
297 | + */ | ||
298 | + petName?: string; | ||
299 | + /** | ||
300 | + * 宠物性别 0-母 1-公 | ||
301 | + */ | ||
302 | + petSex?: number; | ||
303 | + /** | ||
304 | + * 宠物类型 10-猫 20-狗 30-异宠 | ||
305 | + */ | ||
306 | + petType?: number; | ||
307 | + /** | ||
308 | + * 处方单文件 | ||
309 | + */ | ||
310 | + prescriptionFile?: string; | ||
311 | + /** | ||
312 | + * 处方单问诊病情描述 | ||
313 | + */ | ||
314 | + prescriptionForm?: string; | ||
315 | + /** | ||
316 | + * 实付金额 | ||
317 | + */ | ||
318 | + realityPayAmount: number; | ||
319 | + /** | ||
320 | + * 剩余时间(秒) | ||
321 | + */ | ||
322 | + remainder?: number; | ||
323 | + /** | ||
324 | + * 补充症状 | ||
325 | + */ | ||
326 | + supplement?: string; | ||
327 | + /** | ||
328 | + * 宠物出现的症状1=呕吐2=软便拉稀3=皮肤问题4=眼睛问题5=泌尿问题6=绝育7=疫苗8=驱虫9=养护问题10=其他 | ||
329 | + */ | ||
330 | + symptom?: string; | ||
331 | + /** | ||
332 | + * 问诊时间 | ||
333 | + */ | ||
334 | + time?: string; | ||
335 | + /** | ||
336 | + * 症状出现时间1=<7天2=<1个月3=<3个月4=3个月以上 | ||
337 | + */ | ||
338 | + timeFrame?: string; | ||
339 | + /** | ||
340 | + * 提交问诊用户信息 | ||
341 | + */ | ||
342 | + user?: User; | ||
343 | + /** | ||
344 | + * 宠物体重 | ||
345 | + */ | ||
346 | + weight?: string; | ||
347 | + [property: string]: any; | ||
348 | +} | ||
349 | + | ||
350 | +// 处方单详情 | ||
351 | +export interface PrescriptionDetailType { | ||
352 | + /** | ||
353 | + * 宠物年龄 | ||
354 | + */ | ||
355 | + age?: number; | ||
356 | + /** | ||
357 | + * 处方单价格 | ||
358 | + */ | ||
359 | + amount?: number; | ||
360 | + /** | ||
361 | + * 预计收入 | ||
362 | + */ | ||
363 | + award?: number; | ||
364 | + /** | ||
365 | + * 洗澡频次1=一周一次(狗狗)2=洗澡频次不规律3=想起来才洗4=定期洗澡(猫猫) | ||
366 | + */ | ||
367 | + batheFrequency?: string; | ||
368 | + /** | ||
369 | + * 问诊状态 0-未开始 1-进行中 2-已结束 | ||
370 | + */ | ||
371 | + consultationState?: number; | ||
372 | + /** | ||
373 | + * 问诊方式 10-快速问诊 21-专家图文语音问诊 22-专家视频问诊 23-专家电话问诊 | ||
374 | + */ | ||
375 | + consultationWay?: number; | ||
376 | + /** | ||
377 | + * 处方药 | ||
378 | + */ | ||
379 | + drugList?: DrugList[]; | ||
380 | + /** | ||
381 | + * 喂养方式1=配方粮2=配方粮+零食3=只吃人食物4=自制犬猫粮 | ||
382 | + */ | ||
383 | + feedType?: string; | ||
384 | + /** | ||
385 | + * 订单id | ||
386 | + */ | ||
387 | + id?: string; | ||
388 | + /** | ||
389 | + * 症状图片 | ||
390 | + */ | ||
391 | + image?: string[]; | ||
392 | + /** | ||
393 | + * 宠物免疫情况1=已免疫2=未免疫3=免疫不全4=免疫不详 | ||
394 | + */ | ||
395 | + immuneStatus?: string; | ||
396 | + /** | ||
397 | + * 是否为复诊0=否1=是 | ||
398 | + */ | ||
399 | + isAgain?: number; | ||
400 | + /** | ||
401 | + * 是否绝育 0-否 1-是 | ||
402 | + */ | ||
403 | + isSterilization?: number; | ||
404 | + /** | ||
405 | + * 宠物品种 | ||
406 | + */ | ||
407 | + petClass?: string; | ||
408 | + /** | ||
409 | + * 宠物id | ||
410 | + */ | ||
411 | + petId?: string; | ||
412 | + /** | ||
413 | + * 宠物名称 | ||
414 | + */ | ||
415 | + petName?: string; | ||
416 | + /** | ||
417 | + * 宠物性别 0-母 1-公 | ||
418 | + */ | ||
419 | + petSex?: number; | ||
420 | + /** | ||
421 | + * 宠物类型 10-猫 20-狗 30-异宠 | ||
422 | + */ | ||
423 | + petType?: number; | ||
424 | + /** | ||
425 | + * 处方单文件 | ||
426 | + */ | ||
427 | + prescriptionFile?: string; | ||
428 | + /** | ||
429 | + * 处方单问诊病情描述 | ||
430 | + */ | ||
431 | + prescriptionForm?: string; | ||
432 | + /** | ||
433 | + * 剩余时间(秒) | ||
434 | + */ | ||
435 | + remainder?: number; | ||
436 | + /** | ||
437 | + * 订单状态 0-待发货 1-已发货 2-已完成 3-已退货 | ||
438 | + */ | ||
439 | + state?: number; | ||
440 | + /** | ||
441 | + * 补充症状 | ||
442 | + */ | ||
443 | + supplement?: string; | ||
444 | + /** | ||
445 | + * 宠物出现的症状1=呕吐2=软便拉稀3=皮肤问题4=眼睛问题5=泌尿问题6=绝育7=疫苗8=驱虫9=养护问题10=其他 | ||
446 | + */ | ||
447 | + symptom?: string; | ||
448 | + /** | ||
449 | + * 问诊时间 | ||
450 | + */ | ||
451 | + time?: string; | ||
452 | + /** | ||
453 | + * 症状出现时间1=<7天2=<1个月3=<3个月4=3个月以上 | ||
454 | + */ | ||
455 | + timeFrame?: string; | ||
456 | + /** | ||
457 | + * 提交问诊用户信息 | ||
458 | + */ | ||
459 | + user?: User; | ||
460 | + /** | ||
461 | + * 宠物体重 | ||
462 | + */ | ||
463 | + weight?: string; | ||
464 | + [property: string]: any; | ||
465 | +} | ||
466 | + | ||
467 | +/** | ||
468 | +* 医生信息 | ||
469 | +*/ | ||
470 | +export interface Doctor { | ||
471 | + /** | ||
472 | + * 头像 | ||
473 | + */ | ||
474 | + avatar: string; | ||
475 | + /** | ||
476 | + * 医生id | ||
477 | + */ | ||
478 | + id: string; | ||
479 | + /** | ||
480 | + * 昵称 | ||
481 | + */ | ||
482 | + nickname: string; | ||
483 | + [property: string]: any; | ||
484 | +} | ||
485 | + | ||
486 | +export interface DrugList { | ||
487 | + /** | ||
488 | + * 单价 | ||
489 | + */ | ||
490 | + amount: string; | ||
491 | + /** | ||
492 | + * 描述 | ||
493 | + */ | ||
494 | + des: string; | ||
495 | + /** | ||
496 | + * 药物名称 | ||
497 | + */ | ||
498 | + name: string; | ||
499 | + /** | ||
500 | + * 数量 | ||
501 | + */ | ||
502 | + num: number; | ||
503 | + [property: string]: any; | ||
504 | +} | ||
505 | + | ||
506 | +/** | ||
507 | + * 提交问诊用户信息 | ||
508 | + */ | ||
509 | +export interface User { | ||
510 | + /** | ||
511 | + * 头像 | ||
512 | + */ | ||
513 | + avatar: string; | ||
514 | + /** | ||
515 | + * 用户id | ||
516 | + */ | ||
517 | + id: string; | ||
518 | + /** | ||
519 | + * 昵称 | ||
520 | + */ | ||
521 | + nickname: string; | ||
522 | + [property: string]: any; | ||
523 | +} |
1 | -import { BASE_URL } from '@/service/request/config' | 1 | +import { BASE_URL } from '@/service/config' |
2 | 2 | ||
3 | // immuneStatus: { 1:'',2:'',3: '',4: '' } | 3 | // immuneStatus: { 1:'',2:'',3: '',4: '' } |
4 | type ObjectString = { | 4 | type ObjectString = { |
@@ -14,17 +14,17 @@ const GlobalData: ObjectString = { | @@ -14,17 +14,17 @@ const GlobalData: ObjectString = { | ||
14 | 'sexData': { 0: '未知', 1: '男', 2: '女' }, | 14 | 'sexData': { 0: '未知', 1: '男', 2: '女' }, |
15 | 'MessageType': { 1: '系统通知', 2: '用户反馈' }, | 15 | 'MessageType': { 1: '系统通知', 2: '用户反馈' }, |
16 | 'consultationWay': { 10: '快速问诊', 21: '专家图文语音问诊', 22: '专家视频问诊', 23: '专家电话问诊' }, | 16 | 'consultationWay': { 10: '快速问诊', 21: '专家图文语音问诊', 22: '专家视频问诊', 23: '专家电话问诊' }, |
17 | - 'isReply': { 0: '否', 1: '是' }, | 17 | + 'isReply': { 0: '否', 1: '是' }, // |
18 | 'orderState': { 20: '待问诊', 30: '问诊中', 40: '问诊结束', 50: '已取消' }, | 18 | 'orderState': { 20: '待问诊', 30: '问诊中', 40: '问诊结束', 50: '已取消' }, |
19 | 'state': { 0: '待发货', 1: '已发货', 2: '已完成', 3: '已退货' }, | 19 | 'state': { 0: '待发货', 1: '已发货', 2: '已完成', 3: '已退货' }, |
20 | 'isSterilization': { 0: '否', 1: '是' }, // 是否绝育 | 20 | 'isSterilization': { 0: '否', 1: '是' }, // 是否绝育 |
21 | - 'petSec': { 0: '母', 1: '公' }, | 21 | + 'petSex': { 0: '母', 1: '公' }, |
22 | 'immuneStatus': { 1: '已免疫', 2: '未免疫', 3: '免疫不全', 4: '免疫不详' }, | 22 | 'immuneStatus': { 1: '已免疫', 2: '未免疫', 3: '免疫不全', 4: '免疫不详' }, |
23 | 'feedType': { 1: '配方粮', 2: '配方粮+零食', 3: '只吃人食物', 4: '自制犬猫粮' }, | 23 | 'feedType': { 1: '配方粮', 2: '配方粮+零食', 3: '只吃人食物', 4: '自制犬猫粮' }, |
24 | 'batheFrequency': { 1: '一周一次(狗狗)', 2: '洗澡频次不规律', 3: '想起来才洗', 4: '定期洗澡(猫猫)' }, | 24 | 'batheFrequency': { 1: '一周一次(狗狗)', 2: '洗澡频次不规律', 3: '想起来才洗', 4: '定期洗澡(猫猫)' }, |
25 | 'timeFrame': { 1: '<7天', 2: '<1个月', 3: '<3个月', 4: '3个月以上' }, | 25 | 'timeFrame': { 1: '<7天', 2: '<1个月', 3: '<3个月', 4: '3个月以上' }, |
26 | 'petType': { 10: '猫', 20: '狗', 30: '异宠' }, | 26 | 'petType': { 10: '猫', 20: '狗', 30: '异宠' }, |
27 | - 'isAgain': { 1: '是', 0: '否' }, | 27 | + 'isAgain': { 1: '是', 0: '否' }, // 是否为复诊 |
28 | 'symptom': { 1: '呕吐', 2: '软便拉稀', 3: '皮肤问题', 4: '眼睛问题', 5: '泌尿问题', 6: '绝育', 7: '疫苗', 8: '驱虫', 9: '养护问题', 10: '其他' } | 28 | 'symptom': { 1: '呕吐', 2: '软便拉稀', 3: '皮肤问题', 4: '眼睛问题', 5: '泌尿问题', 6: '绝育', 7: '疫苗', 8: '驱虫', 9: '养护问题', 10: '其他' } |
29 | } | 29 | } |
30 | 30 |
src/utils/store.ts
0 → 100644
1 | +enum StoreType { | ||
2 | + local = 'local', | ||
3 | + session = 'session' | ||
4 | +} | ||
5 | +class Store { | ||
6 | + storage: Storage | ||
7 | + constructor(type: StoreType) { | ||
8 | + this.storage = type === StoreType.local ? localStorage : sessionStorage | ||
9 | + } | ||
10 | + set(key: string, value: any) { | ||
11 | + if (value) { | ||
12 | + this.storage.setItem(key, JSON.stringify(value)) | ||
13 | + } | ||
14 | + } | ||
15 | + | ||
16 | + get(key: string) { | ||
17 | + const value = this.storage.getItem(key) | ||
18 | + if (value) { | ||
19 | + // return JSON.parse(value) || value | ||
20 | + return value | ||
21 | + } | ||
22 | + } | ||
23 | + | ||
24 | + del(key: string) { | ||
25 | + this.storage.removeItem(key) | ||
26 | + } | ||
27 | + | ||
28 | + clear() { | ||
29 | + this.storage.clear() | ||
30 | + } | ||
31 | +} | ||
32 | + | ||
33 | +const LStore = new Store(StoreType.local) | ||
34 | +const SStore = new Store(StoreType.session) | ||
35 | + | ||
36 | +export { LStore, SStore } | ||
37 | + |
1 | import React, { memo, useState, forwardRef, useImperativeHandle } from 'react' | 1 | import React, { memo, useState, forwardRef, useImperativeHandle } from 'react' |
2 | -import type { FC, ReactNode } from 'react' | 2 | +import type { FC, ReactNode, Ref } from 'react' |
3 | import { Input, Modal, Upload } from 'antd' | 3 | import { Input, Modal, Upload } from 'antd' |
4 | import { MinusCircleOutlined, PlusCircleOutlined, PlusOutlined } from '@ant-design/icons' | 4 | import { MinusCircleOutlined, PlusCircleOutlined, PlusOutlined } from '@ant-design/icons' |
5 | import type { RcFile, UploadProps } from 'antd/es/upload' | 5 | import type { RcFile, UploadProps } from 'antd/es/upload' |
6 | import type { UploadFile } from 'antd/es/upload/interface' | 6 | import type { UploadFile } from 'antd/es/upload/interface' |
7 | import { SendPrescriptionWrapper } from '../style' | 7 | import { SendPrescriptionWrapper } from '../style' |
8 | -import { BASE_URL } from '@/service/request/config' | ||
9 | -import type { Send_prescription_formType, DrugList } from '@/types' | 8 | +import { BASE_URL } from '@/service/config' |
9 | +import type { Send_prescription_formType } from '@/types' | ||
10 | // /sys/common/appUpload | 10 | // /sys/common/appUpload |
11 | const { TextArea } = Input | 11 | const { TextArea } = Input |
12 | 12 | ||
@@ -24,7 +24,7 @@ const getBase64 = (file: RcFile): Promise<string> => | @@ -24,7 +24,7 @@ const getBase64 = (file: RcFile): Promise<string> => | ||
24 | }) | 24 | }) |
25 | 25 | ||
26 | const SendPrescription: FC<IProps> = memo( | 26 | const SendPrescription: FC<IProps> = memo( |
27 | - forwardRef<HTMLDivElement, IProps>((props, ref) => { | 27 | + forwardRef<HTMLDivElement, IProps>((props, ref: Ref<any>) => { |
28 | const [previewOpen, setPreviewOpen] = useState(false) | 28 | const [previewOpen, setPreviewOpen] = useState(false) |
29 | const [previewImage, setPreviewImage] = useState('') | 29 | const [previewImage, setPreviewImage] = useState('') |
30 | const [previewTitle, setPreviewTitle] = useState('') | 30 | const [previewTitle, setPreviewTitle] = useState('') |
@@ -73,9 +73,11 @@ const SendPrescription: FC<IProps> = memo( | @@ -73,9 +73,11 @@ const SendPrescription: FC<IProps> = memo( | ||
73 | 73 | ||
74 | const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) => setFileList(newFileList) | 74 | const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) => setFileList(newFileList) |
75 | 75 | ||
76 | - useImperativeHandle<HTMLDivElement, any>(ref, () => ({ | 76 | + useImperativeHandle(ref, () => ({ |
77 | Send_prescription_formData, | 77 | Send_prescription_formData, |
78 | - fileList | 78 | + fileList, |
79 | + setSend_prescription_formTypeData, | ||
80 | + setFileList | ||
79 | })) | 81 | })) |
80 | 82 | ||
81 | const uploadButton = ( | 83 | const uploadButton = ( |
1 | -import React, { memo } from 'react' | 1 | +import React, { memo, useEffect, useState } from 'react' |
2 | import type { FC, ReactNode } from 'react' | 2 | import type { FC, ReactNode } from 'react' |
3 | import { Image } from 'antd' | 3 | import { Image } from 'antd' |
4 | +import { EyeOutlined } from '@ant-design/icons' | ||
5 | +import { useAppDispatch, useAppSelector, shallowEqualApp } from '@/store' | ||
6 | +import { fetchPrescriptionDetailAction } from '@/store/modules/order' | ||
4 | import { ViewPrescriptionWrapper } from '../style' | 7 | import { ViewPrescriptionWrapper } from '../style' |
8 | +import type { PrescriptionDetailType } from '@/types' | ||
5 | 9 | ||
6 | interface IProps { | 10 | interface IProps { |
7 | children?: ReactNode | 11 | children?: ReactNode |
12 | + id: string | number | ||
8 | } | 13 | } |
9 | 14 | ||
10 | -const ViewPrescription: FC<IProps> = memo(() => { | 15 | +const ViewPrescription: FC<IProps> = memo((props) => { |
16 | + console.log(props.id, 'id') | ||
17 | + | ||
18 | + const dispatch = useAppDispatch() | ||
19 | + | ||
20 | + const [PrescriptionDetail, setPrescriptionDetail] = useState<PrescriptionDetailType>() | ||
21 | + | ||
22 | + useEffect(() => { | ||
23 | + console.log('first') | ||
24 | + dispatch(fetchPrescriptionDetailAction({ id: props.id })) | ||
25 | + }, [props.id]) | ||
26 | + | ||
27 | + const { PrescriptionDetailDetail } = useAppSelector( | ||
28 | + (state) => ({ | ||
29 | + PrescriptionDetailDetail: state.order.PrescriptionDetailData | ||
30 | + }), | ||
31 | + shallowEqualApp | ||
32 | + ) | ||
33 | + | ||
34 | + useEffect(() => { | ||
35 | + setPrescriptionDetail(PrescriptionDetailDetail) | ||
36 | + }, [PrescriptionDetailDetail]) | ||
37 | + | ||
11 | return ( | 38 | return ( |
12 | <ViewPrescriptionWrapper> | 39 | <ViewPrescriptionWrapper> |
13 | <div className="title">问诊病情:</div> | 40 | <div className="title">问诊病情:</div> |
14 | - <div className="content">即该不低加造年周消养明价切公没家管发七议性原提何们领从很己发战</div> | 41 | + <div className="content">{PrescriptionDetail?.prescriptionForm || '暂无问诊病情'}</div> |
15 | <div className="title">处方药:</div> | 42 | <div className="title">处方药:</div> |
16 | <div className="listbox"> | 43 | <div className="listbox"> |
44 | + {Array.isArray(PrescriptionDetail?.drugList) && PrescriptionDetail?.drugList?.length ? ( | ||
45 | + PrescriptionDetail?.drugList?.map((_, index) => ( | ||
46 | + <div className="itemo"> | ||
47 | + <div className="flexJ black" key={index}> | ||
48 | + <div>{_.name || '药物名称'}</div> | ||
49 | + <div>¥{_.amount || 0}</div> | ||
50 | + </div> | ||
51 | + <div className="flexJ gray"> | ||
52 | + <div>{_.des || '描述'}</div> | ||
53 | + <div>x{_.num || 0}</div> | ||
54 | + </div> | ||
55 | + </div> | ||
56 | + )) | ||
57 | + ) : ( | ||
17 | <div className="itemo"> | 58 | <div className="itemo"> |
18 | <div className="flexJ black"> | 59 | <div className="flexJ black"> |
19 | <div>药品名称</div> | 60 | <div>药品名称</div> |
@@ -24,10 +65,18 @@ const ViewPrescription: FC<IProps> = memo(() => { | @@ -24,10 +65,18 @@ const ViewPrescription: FC<IProps> = memo(() => { | ||
24 | <div>x2</div> | 65 | <div>x2</div> |
25 | </div> | 66 | </div> |
26 | </div> | 67 | </div> |
68 | + )} | ||
27 | </div> | 69 | </div> |
28 | <div className="title">处方单证明:</div> | 70 | <div className="title">处方单证明:</div> |
29 | - <Image width={120} src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" className="title" /> | ||
30 | - <div className="black">总金额:¥26.00</div> | 71 | + <Image |
72 | + width={120} | ||
73 | + preview={{ | ||
74 | + mask: <EyeOutlined /> | ||
75 | + }} | ||
76 | + src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" | ||
77 | + className="marbot" | ||
78 | + /> | ||
79 | + <div className="black">总金额:¥{PrescriptionDetail?.award || 0}</div> | ||
31 | </ViewPrescriptionWrapper> | 80 | </ViewPrescriptionWrapper> |
32 | ) | 81 | ) |
33 | }) | 82 | }) |
1 | -import React, { memo } from 'react' | 1 | +import React, { memo, useEffect, useState } from 'react' |
2 | import type { FC, ReactNode } from 'react' | 2 | import type { FC, ReactNode } from 'react' |
3 | import { Avatar, Image } from 'antd' | 3 | import { Avatar, Image } from 'antd' |
4 | +import { EyeOutlined } from '@ant-design/icons' | ||
5 | +import { useAppDispatch, useAppSelector, shallowEqualApp } from '@/store' | ||
6 | +import order, { fetchConsultationOrderDetailAction } from '@/store/modules/order' | ||
4 | import { ViewSymptomWrapper } from '../style' | 7 | import { ViewSymptomWrapper } from '../style' |
8 | +import GHandler from '@/utils/methods' | ||
9 | +import type { ConsultationOrderDetailType } from '@/types' | ||
5 | 10 | ||
6 | interface IProps { | 11 | interface IProps { |
7 | children?: ReactNode | 12 | children?: ReactNode |
13 | + id: string | number | ||
8 | } | 14 | } |
9 | 15 | ||
10 | const url = 'https://p1.ssl.qhmsg.com/dr/270_500_/t010c2d50907f0a7b9c.png' | 16 | const url = 'https://p1.ssl.qhmsg.com/dr/270_500_/t010c2d50907f0a7b9c.png' |
11 | 17 | ||
12 | -const ViewSymptom: FC<IProps> = memo(() => { | 18 | +const ViewSymptom: FC<IProps> = memo((props) => { |
19 | + const { id } = props | ||
20 | + | ||
21 | + const dispatch = useAppDispatch() | ||
22 | + | ||
23 | + const [orderDetail, setOrderDetail] = useState<ConsultationOrderDetailType>() | ||
24 | + | ||
25 | + useEffect(() => { | ||
26 | + console.log('id', id) | ||
27 | + dispatch(fetchConsultationOrderDetailAction({ id: props.id })) | ||
28 | + }, [props.id]) | ||
29 | + | ||
30 | + const { COrderDetail } = useAppSelector( | ||
31 | + (state) => ({ | ||
32 | + COrderDetail: state.order.ConsultationOrderDetailData | ||
33 | + }), | ||
34 | + shallowEqualApp | ||
35 | + ) | ||
36 | + | ||
37 | + useEffect(() => { | ||
38 | + console.log(COrderDetail, '请求回来的订单详情数据') | ||
39 | + setOrderDetail(COrderDetail as ConsultationOrderDetailType) | ||
40 | + }, [COrderDetail]) | ||
41 | + | ||
13 | return ( | 42 | return ( |
14 | <ViewSymptomWrapper> | 43 | <ViewSymptomWrapper> |
15 | <div className="flexJ"> | 44 | <div className="flexJ"> |
16 | <div className="flexA top"> | 45 | <div className="flexA top"> |
17 | - <Avatar size="large" src={<img src={url} alt="avatar" />} /> | ||
18 | - <div className="username">卡卡罗特</div> | ||
19 | - <div className="tag">图文问诊</div> | 46 | + <Avatar size="large" src={<img src={orderDetail?.user?.avatar} alt="avatar" />} /> |
47 | + <div className="username">{orderDetail?.user?.nickname}</div> | ||
48 | + <div className="tag">{GHandler.optObjectValue('consultationWay', orderDetail?.consultationWay || 10)}</div> | ||
20 | </div> | 49 | </div> |
21 | - <div className="money">预计收入:¥26.00</div> | 50 | + <div className="money">预计收入:¥{orderDetail?.award || 0}</div> |
22 | </div> | 51 | </div> |
23 | <div className="row"> | 52 | <div className="row"> |
24 | - 就诊宠物:<span>蓝猫/2岁/女/绝育/1kg</span> | 53 | + 就诊宠物: |
54 | + <span> | ||
55 | + {GHandler.optObjectValue('petType', orderDetail?.petType || 30)}/{orderDetail?.age || '年龄未知'}/ | ||
56 | + {GHandler.optObjectValue('petSex', orderDetail?.petSex || 1)}/{GHandler.optObjectValue('symptom', 7)}/{orderDetail?.weight || '体重未知'} | ||
57 | + </span> | ||
25 | </div> | 58 | </div> |
26 | <div className="row"> | 59 | <div className="row"> |
27 | - 免疫情况:<span>不详</span> | 60 | + 免疫情况:<span>{GHandler.optObjectValue('immuneStatus', orderDetail?.immuneStatus || 4)}</span> |
28 | </div> | 61 | </div> |
29 | <div className="row"> | 62 | <div className="row"> |
30 | - 喂养方式:<span>自制杂粮</span> | 63 | + 喂养方式: |
64 | + <span> | ||
65 | + <span>{GHandler.optObjectValue('feedType', orderDetail?.feedType || 4)}</span> | ||
66 | + </span> | ||
31 | </div> | 67 | </div> |
32 | <div className="row"> | 68 | <div className="row"> |
33 | 洗澡频次:<span>一周一次</span> | 69 | 洗澡频次:<span>一周一次</span> |
@@ -39,11 +75,29 @@ const ViewSymptom: FC<IProps> = memo(() => { | @@ -39,11 +75,29 @@ const ViewSymptom: FC<IProps> = memo(() => { | ||
39 | 症状时间:<span>{`<7天`}</span> | 75 | 症状时间:<span>{`<7天`}</span> |
40 | </div> | 76 | </div> |
41 | <div className="row"> | 77 | <div className="row"> |
42 | - 症状描述:<span>快死了哦快死了哦快死了哦快死了哦快死了哦快死了哦快死了哦快死了哦快死了哦快死了哦快死了哦快死了哦快死了哦快死了哦快死了哦快死了哦</span> | 78 | + 症状描述:<span>{orderDetail?.supplement || '暂无症状描述'}</span> |
43 | </div> | 79 | </div> |
44 | - <div className="row"> | ||
45 | - <div>上传图片</div> | ||
46 | - <Image width={120} src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" /> | 80 | + <div> |
81 | + <div className="row">症状图片</div> | ||
82 | + {Array.isArray(orderDetail?.image) && orderDetail?.image.length ? ( | ||
83 | + orderDetail?.image.map((_, index) => ( | ||
84 | + <Image | ||
85 | + width={120} | ||
86 | + preview={{ | ||
87 | + mask: <EyeOutlined /> | ||
88 | + }} | ||
89 | + src={_} | ||
90 | + /> | ||
91 | + )) | ||
92 | + ) : ( | ||
93 | + <Image | ||
94 | + width={120} | ||
95 | + preview={{ | ||
96 | + mask: <EyeOutlined /> | ||
97 | + }} | ||
98 | + src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" | ||
99 | + /> | ||
100 | + )} | ||
47 | </div> | 101 | </div> |
48 | </ViewSymptomWrapper> | 102 | </ViewSymptomWrapper> |
49 | ) | 103 | ) |
@@ -45,6 +45,9 @@ export const ViewPrescriptionWrapper = styled.div` | @@ -45,6 +45,9 @@ export const ViewPrescriptionWrapper = styled.div` | ||
45 | font-weight: 700; | 45 | font-weight: 700; |
46 | margin-bottom: 8px; | 46 | margin-bottom: 8px; |
47 | } | 47 | } |
48 | + .marbot{ | ||
49 | + margin-bottom: 8px; | ||
50 | + } | ||
48 | .content{ | 51 | .content{ |
49 | color: #323233; | 52 | color: #323233; |
50 | font-size: 14px; | 53 | font-size: 14px; |
@@ -75,6 +78,12 @@ export const ViewPrescriptionWrapper = styled.div` | @@ -75,6 +78,12 @@ export const ViewPrescriptionWrapper = styled.div` | ||
75 | export const ViewSymptomWrapper = styled.div` | 78 | export const ViewSymptomWrapper = styled.div` |
76 | max-height: 440px; | 79 | max-height: 440px; |
77 | overflow: auto; | 80 | overflow: auto; |
81 | + .title{ | ||
82 | + color: #323233; | ||
83 | + font-size: 14px; | ||
84 | + font-weight: 700; | ||
85 | + margin-bottom: 8px; | ||
86 | + } | ||
78 | .top{ | 87 | .top{ |
79 | margin-bottom: 12px; | 88 | margin-bottom: 12px; |
80 | } | 89 | } |
@@ -107,4 +116,7 @@ export const ViewSymptomWrapper = styled.div` | @@ -107,4 +116,7 @@ export const ViewSymptomWrapper = styled.div` | ||
107 | color:#666666; | 116 | color:#666666; |
108 | } | 117 | } |
109 | } | 118 | } |
119 | + .fff{ | ||
120 | + color: #fff; | ||
121 | + } | ||
110 | ` | 122 | ` |
@@ -5,7 +5,7 @@ import type { TabsProps } from 'antd' | @@ -5,7 +5,7 @@ import type { TabsProps } from 'antd' | ||
5 | import { ConsultationOrderWrapper, ConsultationOrderItemWrapper } from './styled' | 5 | import { ConsultationOrderWrapper, ConsultationOrderItemWrapper } from './styled' |
6 | import { useAppDispatch, useAppSelector, shallowEqualApp } from '@/store' | 6 | import { useAppDispatch, useAppSelector, shallowEqualApp } from '@/store' |
7 | import { updateSend_prescription_form } from '@/api' | 7 | import { updateSend_prescription_form } from '@/api' |
8 | -import { Send_prescription_formType } from '@/types' | 8 | +import { Send_prescription_formType, SendPrescriptionPropsType, DrugList } from '@/types' |
9 | import { fetchOrderDataAction } from '@/store/modules/order' | 9 | import { fetchOrderDataAction } from '@/store/modules/order' |
10 | import SendPrescription from '../../com/SendPrescription' | 10 | import SendPrescription from '../../com/SendPrescription' |
11 | import ViewPrescription from '../../com/ViewPrescription' | 11 | import ViewPrescription from '../../com/ViewPrescription' |
@@ -25,7 +25,7 @@ const ShowOrderComHandler: FC<IProps> = (props) => { | @@ -25,7 +25,7 @@ const ShowOrderComHandler: FC<IProps> = (props) => { | ||
25 | const [modalTitle, setModalTitle] = useState<string>(' ') | 25 | const [modalTitle, setModalTitle] = useState<string>(' ') |
26 | const [modalFlag, setModalFlag] = useState<number>(0) | 26 | const [modalFlag, setModalFlag] = useState<number>(0) |
27 | 27 | ||
28 | - const SendPrescriptionRef = useRef<ElementRef<typeof SendPrescription> | null>(null) | 28 | + const SendPrescriptionRef = useRef<SendPrescriptionPropsType | null>(null) |
29 | 29 | ||
30 | const showModalHandler = (flag: number) => { | 30 | const showModalHandler = (flag: number) => { |
31 | console.log(flag, '按钮状态') | 31 | console.log(flag, '按钮状态') |
@@ -36,17 +36,31 @@ const ShowOrderComHandler: FC<IProps> = (props) => { | @@ -36,17 +36,31 @@ const ShowOrderComHandler: FC<IProps> = (props) => { | ||
36 | 36 | ||
37 | const handleOk = async () => { | 37 | const handleOk = async () => { |
38 | if (modalFlag === 2) { | 38 | if (modalFlag === 2) { |
39 | - const instance = SendPrescriptionRef.current as any | 39 | + const instance = SendPrescriptionRef.current |
40 | + | ||
40 | await updateSend_prescription_form({ | 41 | await updateSend_prescription_form({ |
41 | - ...instance.Send_prescription_formData, | ||
42 | - drugList: JSON.stringify(instance.Send_prescription_formData.drugList), | ||
43 | - prescriptionFile: instance.fileList.map((_: any) => _.response.message).join() | 42 | + ...instance?.Send_prescription_formData, |
43 | + drugList: JSON.stringify(instance?.Send_prescription_formData.drugList), | ||
44 | + prescriptionFile: instance?.fileList.map((_: any) => _.response.message).join() | ||
45 | + }) | ||
46 | + | ||
47 | + typeof instance?.setSend_prescription_formTypeData === 'function' && | ||
48 | + instance?.setSend_prescription_formTypeData({ | ||
49 | + drugList: [{ amount: '', des: '', name: '', num: '' }], | ||
50 | + prescriptionForm: '', | ||
51 | + prescriptionAmount: 0 | ||
44 | }) | 52 | }) |
53 | + | ||
54 | + typeof instance?.setFileList === 'function' && instance.setFileList([]) | ||
45 | } | 55 | } |
56 | + | ||
46 | console.log(SendPrescriptionRef.current, 'SendPrescription 子组件实例') | 57 | console.log(SendPrescriptionRef.current, 'SendPrescription 子组件实例') |
58 | + | ||
47 | setConfirmLoading(true) | 59 | setConfirmLoading(true) |
60 | + | ||
48 | setTimeout(() => { | 61 | setTimeout(() => { |
49 | setOpenHandler(false) | 62 | setOpenHandler(false) |
63 | + | ||
50 | setConfirmLoading(false) | 64 | setConfirmLoading(false) |
51 | }, 2000) | 65 | }, 2000) |
52 | } | 66 | } |
@@ -60,7 +74,7 @@ const ShowOrderComHandler: FC<IProps> = (props) => { | @@ -60,7 +74,7 @@ const ShowOrderComHandler: FC<IProps> = (props) => { | ||
60 | return ( | 74 | return ( |
61 | <ConsultationOrderItemWrapper> | 75 | <ConsultationOrderItemWrapper> |
62 | <Modal title={modalTitle} open={open} onOk={handleOk} cancelText="关闭" okText="确认" confirmLoading={confirmLoading} onCancel={handleCancel}> | 76 | <Modal title={modalTitle} open={open} onOk={handleOk} cancelText="关闭" okText="确认" confirmLoading={confirmLoading} onCancel={handleCancel}> |
63 | - {{ 1: <ViewSymptom />, 2: <SendPrescription ref={SendPrescriptionRef} />, 3: <ViewPrescription /> }[modalFlag]} | 77 | + {{ 1: <ViewSymptom id={1} />, 2: <SendPrescription ref={SendPrescriptionRef} />, 3: <ViewPrescription id={1} /> }[modalFlag]} |
64 | </Modal> | 78 | </Modal> |
65 | {orderList?.length && | 79 | {orderList?.length && |
66 | orderList.map((_, index) => ( | 80 | orderList.map((_, index) => ( |
@@ -110,31 +124,33 @@ const ConsultationOrder: FC<IProps> = memo(() => { | @@ -110,31 +124,33 @@ const ConsultationOrder: FC<IProps> = memo(() => { | ||
110 | const dispatch = useAppDispatch() | 124 | const dispatch = useAppDispatch() |
111 | 125 | ||
112 | useEffect(() => { | 126 | useEffect(() => { |
113 | - // dispatch(fetchOrderDataAction()) | 127 | + dispatch(fetchOrderDataAction({ pageNo: 1 })) |
114 | }, []) | 128 | }, []) |
115 | 129 | ||
116 | - const { banners } = useAppSelector( | 130 | + const { ConsultationOrder } = useAppSelector( |
117 | (state) => ({ | 131 | (state) => ({ |
118 | - banners: state.order.bannersList | 132 | + ConsultationOrder: state.order.ConsultationOrderList |
119 | }), | 133 | }), |
120 | shallowEqualApp | 134 | shallowEqualApp |
121 | ) | 135 | ) |
122 | 136 | ||
123 | useEffect(() => { | 137 | useEffect(() => { |
124 | - if (!banners.length) return | ||
125 | - console.log(banners) | ||
126 | - }, [banners]) | 138 | + if (!ConsultationOrder.length) return |
139 | + console.log(ConsultationOrder) | ||
140 | + }, [ConsultationOrder]) | ||
127 | 141 | ||
128 | const [text, setText] = useState<string[]>([]) | 142 | const [text, setText] = useState<string[]>([]) |
129 | 143 | ||
130 | const items: TabsProps['items'] = [ | 144 | const items: TabsProps['items'] = [ |
131 | - { key: '0', label: '全部', children: ShowOrderComHandler({ orderList: text }) }, | ||
132 | - { key: '1', label: '待处理', children: ShowOrderComHandler({ orderList: text }) }, | ||
133 | - { key: '2', label: '处理中', children: ShowOrderComHandler({ orderList: text }) }, | ||
134 | - { key: '3', label: '已处理', children: ShowOrderComHandler({ orderList: text }) } | 145 | + { key: '', label: '全部', children: ShowOrderComHandler({ orderList: text }) }, |
146 | + { key: '20', label: '待问诊', children: ShowOrderComHandler({ orderList: text }) }, | ||
147 | + { key: '30', label: '问诊中', children: ShowOrderComHandler({ orderList: text }) }, | ||
148 | + { key: '40', label: '问诊结束', children: ShowOrderComHandler({ orderList: text }) }, | ||
149 | + { key: '50', label: '已取消', children: ShowOrderComHandler({ orderList: text }) } | ||
135 | ] | 150 | ] |
136 | 151 | ||
137 | const onChange = (key: string) => { | 152 | const onChange = (key: string) => { |
153 | + dispatch(fetchOrderDataAction({ pageNo: 1, orderState: key })) | ||
138 | setText([key, '1', '2', '', '', '', '']) | 154 | setText([key, '1', '2', '', '', '', '']) |
139 | } | 155 | } |
140 | 156 |
-
请 注册 或 登录 后发表评论