Commit f644473e3ce911435b325c5a2a98419a77678b6e
Merge branch 'ehr-archives' into test
Showing
5 changed files
with
50 additions
and
15 deletions
src/pages/ehr/ConfirmThePhoneBillList/components/Modal.tsx
1 | 1 | /* |
2 | 2 | * @Date: 2021-07-13 14:26:59 |
3 | 3 | * @LastEditors: wangqiang@feewee.cn |
4 | - * @LastEditTime: 2023-03-03 16:51:23 | |
4 | + * @LastEditTime: 2023-03-20 17:32:27 | |
5 | 5 | */ |
6 | 6 | import React, { useEffect, useMemo, useState } from "react"; |
7 | 7 | import { |
... | ... | @@ -27,6 +27,7 @@ import PhoneBillFormItem from "./PhoneBillFormItem"; |
27 | 27 | import PreChargeFormItem from "./PreChargeFormItem"; |
28 | 28 | import { priceToThousands } from "@/utils/utils"; |
29 | 29 | import DetailItem from "@/pages/ehr/Authentication/Settings/components/DetailItem"; |
30 | +import { formatNumber } from '@/utils/validate'; | |
30 | 31 | |
31 | 32 | export default function MobileWhiteModal() { |
32 | 33 | const { current, setCurrent, visible, setVisible, pagination, ListStatus } = |
... | ... | @@ -102,6 +103,10 @@ export default function MobileWhiteModal() { |
102 | 103 | } |
103 | 104 | }; |
104 | 105 | |
106 | + const format = (num: number, digits: number = 2) => new Intl.NumberFormat("zh-Hans-CN", { | |
107 | + maximumFractionDigits: digits, | |
108 | + }).format(num); | |
109 | + | |
105 | 110 | const onOk = (val: any) => { |
106 | 111 | setConfirmLoading(true); |
107 | 112 | const mobileList = ( |
... | ... | @@ -121,7 +126,7 @@ export default function MobileWhiteModal() { |
121 | 126 | 0 |
122 | 127 | ) ?? 0 |
123 | 128 | : undefined, |
124 | - sumPreChargeAmount: | |
129 | + sumPreChargeAmount: formatNumber( | |
125 | 130 | mobileList.reduce( |
126 | 131 | ( |
127 | 132 | amount: number, |
... | ... | @@ -129,19 +134,22 @@ export default function MobileWhiteModal() { |
129 | 134 | ) => amount + +(item.preChargeAmount || 0), |
130 | 135 | 0 |
131 | 136 | ) ?? 0, |
137 | + 4 | |
138 | + ), | |
132 | 139 | sumRealAmount: |
133 | 140 | current?.status !== ListStatus.预充确认 |
134 | - ? mobileList.reduce( | |
135 | - ( | |
136 | - amount: number, | |
137 | - item: EHrConfirmThePhoneBillList.MobileStaffItemVO | |
138 | - ) => amount + +(item.realAmount || 0), | |
139 | - 0 | |
140 | - ) ?? 0 | |
141 | + ? formatNumber( | |
142 | + mobileList.reduce( | |
143 | + ( | |
144 | + amount: number, | |
145 | + item: EHrConfirmThePhoneBillList.MobileStaffItemVO | |
146 | + ) => amount + +(item.realAmount || 0), | |
147 | + 0 | |
148 | + ) ?? 0 | |
149 | + ) | |
141 | 150 | : undefined, |
142 | 151 | mobileList, |
143 | 152 | }; |
144 | - | |
145 | 153 | const api = |
146 | 154 | current?.status === ListStatus.预充确认 |
147 | 155 | ? submitPerChargeDetailApi | ... | ... |
src/pages/ehr/ConfirmThePhoneBillList/components/PhoneBillModal.tsx
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | * @Author: wangqiang@feewee.cn |
3 | 3 | * @Date: 2023-02-25 17:20:19 |
4 | 4 | * @LastEditors: wangqiang@feewee.cn |
5 | - * @LastEditTime: 2023-03-13 16:29:19 | |
5 | + * @LastEditTime: 2023-03-20 16:57:49 | |
6 | 6 | */ |
7 | 7 | import EditTable from "@/pages/ehr/components/EditTable"; |
8 | 8 | import { priceToThousands } from "@/utils/utils"; |
... | ... | @@ -330,7 +330,7 @@ export default function PhoneBillModal() { |
330 | 330 | dataIndex: "realAmount", |
331 | 331 | width: 200, |
332 | 332 | editable: true, |
333 | - inputType: 'input', | |
333 | + inputType: 'number', | |
334 | 334 | max: 999.99, |
335 | 335 | render: (realAmount: number) => priceToThousands(realAmount), |
336 | 336 | }, | ... | ... |
src/pages/ehr/GroupMobileRecord/components/GroupMobileRecordList.tsx
1 | 1 | /* |
2 | 2 | * @Date: 2021-01-05 14:24:23 |
3 | 3 | * @LastEditors: wangqiang@feewee.cn |
4 | - * @LastEditTime: 2023-02-24 09:45:18 | |
4 | + * @LastEditTime: 2023-03-20 17:30:43 | |
5 | 5 | */ |
6 | 6 | import React, { useState } from "react"; |
7 | 7 | import { |
... | ... | @@ -17,6 +17,7 @@ import { |
17 | 17 | import { CheckCircleFilled, CloseCircleFilled } from "@ant-design/icons"; |
18 | 18 | import { useStore } from "../index"; |
19 | 19 | import { deleteMobileApi } from "../api"; |
20 | +import { formatNumber } from "@/utils/validate"; | |
20 | 21 | |
21 | 22 | const { Column } = Table; |
22 | 23 | |
... | ... | @@ -181,6 +182,13 @@ export default function GroupMobileRecordList() { |
181 | 182 | <Divider type="vertical" /> |
182 | 183 | <span style={{ color: "#999" }}>归属地:</span> |
183 | 184 | <span style={{ color: "#333" }}>{record.address || "-"}</span> |
185 | + <Divider type="vertical" /> | |
186 | + <span style={{ color: "#999" }}>预充金额:</span> | |
187 | + <span style={{ color: "#333" }}> | |
188 | + {record.preChargeAmount | |
189 | + ? formatNumber(record.preChargeAmount) | |
190 | + : "-"} | |
191 | + </span> | |
184 | 192 | </span> |
185 | 193 | <span className="span_limit_1"> |
186 | 194 | <span style={{ color: "#999" }}>归属门店:</span> | ... | ... |
src/pages/ehr/GroupMobileRecord/interface.d.ts
1 | 1 | /* |
2 | 2 | * @Date: 2021-01-05 14:24:23 |
3 | 3 | * @LastEditors: wangqiang@feewee.cn |
4 | - * @LastEditTime: 2023-02-24 09:30:48 | |
4 | + * @LastEditTime: 2023-03-20 17:27:32 | |
5 | 5 | */ |
6 | 6 | declare namespace GroupMobileRecord { |
7 | 7 | interface QueryParams { |
... | ... | @@ -41,6 +41,7 @@ declare namespace GroupMobileRecord { |
41 | 41 | operatorId?: number; // 运营商ID |
42 | 42 | operatorName?: string; // 运营商 |
43 | 43 | postList?: PostVO[]; |
44 | + preChargeAmount?: number; // 上月预充金额 | |
44 | 45 | } |
45 | 46 | |
46 | 47 | interface PostVO { | ... | ... |
src/utils/validate.ts
1 | 1 | /* |
2 | 2 | * @Date: 2020-10-29 19:42:43 |
3 | 3 | * @LastEditors: wangqiang@feewee.cn |
4 | - * @LastEditTime: 2023-02-24 09:52:49 | |
4 | + * @LastEditTime: 2023-03-20 17:34:47 | |
5 | 5 | */ |
6 | 6 | // export function isIdNumber(idNumber: string | bigint): boolean { |
7 | 7 | // const wf = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"]; |
... | ... | @@ -150,6 +150,24 @@ export const validatorNumberCanWithDecimal = (rule: any, value: string) => { |
150 | 150 | }; |
151 | 151 | |
152 | 152 | /** |
153 | + * @description: 格式化数字 | |
154 | + * @param {number} num | |
155 | + * @param {number} digits | |
156 | + * @return {number} | |
157 | + */ | |
158 | +export const formatNumber = (num: number, digits: number = 2): number => { | |
159 | + const number = new Intl.NumberFormat("zh-Hans-CN", { | |
160 | + maximumFractionDigits: digits, | |
161 | + }).format(num); | |
162 | + const reg = new RegExp(`^(\\d)+(\\.\\d{${digits}})?$`, 'g'); | |
163 | + if (digits ? reg.test(number) : /^(\d)+$/g.test(number)) { | |
164 | + return +number; | |
165 | + } else { | |
166 | + return 0; | |
167 | + } | |
168 | +}; | |
169 | + | |
170 | +/** | |
153 | 171 | * @description: 数组去重,公共方法。 |
154 | 172 | * 可用于去重对象数组和普通数组。 |
155 | 173 | * 去重对象数组,请传入 only_key | ... | ... |