Commit 79e282c5df1cfd1cb4ed3bb52f72e60f58e5f9aa
1 parent
a6c77b16
feat(invoice): optimize invoice components and add Chinese currency conversion utility
- Add dynamic invoice type display in Invoice.tsx. - Refactor InvoiceDetailTable.tsx to simplify code and remove unnecessary comments. - Optimize data processing and UI display in InvoiceModal.tsx. - Improve component structure and add orderId mapping in InvoiceRecordDetailModal.tsx. - Enhance InvoicingDrawerForm.tsx with total price calculation and validation.- Implement Chinese currency conversion function in numberUtil.ts. - Various code cleanups and documentation improvements.
Showing
3 changed files
with
187 additions
and
39 deletions
src/pages/Invoice/components/InvoicingModal.tsx
1 | 1 | import { RESPONSE_CODE } from '@/constants/enum'; |
2 | -import { postServiceInvoiceInvoicing } from '@/services'; | |
3 | -import { ModalForm } from '@ant-design/pro-components'; | |
2 | +import { | |
3 | + postServiceInvoiceGetInvoicingAccount, | |
4 | + postServiceInvoiceInvoicing, | |
5 | +} from '@/services'; | |
6 | +import { ModalForm, ProFormSelect } from '@ant-design/pro-components'; | |
4 | 7 | import { Button, Form, message } from 'antd'; |
5 | 8 | |
6 | 9 | export default ({ selectedRowKeys, reloadRecordTable }) => { |
... | ... | @@ -23,9 +26,10 @@ export default ({ selectedRowKeys, reloadRecordTable }) => { |
23 | 26 | onCancel: () => console.log('run'), |
24 | 27 | }} |
25 | 28 | submitTimeout={2000} |
26 | - onFinish={async () => { | |
29 | + onFinish={async (values) => { | |
27 | 30 | let res = await postServiceInvoiceInvoicing({ |
28 | 31 | data: { |
32 | + ...values, | |
29 | 33 | invoiceRecordIds: selectedRowKeys, |
30 | 34 | }, |
31 | 35 | }); |
... | ... | @@ -36,6 +40,22 @@ export default ({ selectedRowKeys, reloadRecordTable }) => { |
36 | 40 | message.success('提交成功'); |
37 | 41 | return true; |
38 | 42 | }} |
39 | - ></ModalForm> | |
43 | + > | |
44 | + <ProFormSelect | |
45 | + name="invoicingAccount" | |
46 | + label="开票账号" | |
47 | + request={async () => { | |
48 | + const res = await postServiceInvoiceGetInvoicingAccount(); | |
49 | + return res.data.map((item) => { | |
50 | + return { | |
51 | + label: item.accountText, | |
52 | + value: item.account, | |
53 | + }; | |
54 | + }); | |
55 | + }} | |
56 | + placeholder="请选择开票账号" | |
57 | + rules={[{ required: true, message: '请选择开票账号!' }]} | |
58 | + /> | |
59 | + </ModalForm> | |
40 | 60 | ); |
41 | 61 | }; |
... | ... |
src/services/definition.ts
... | ... | @@ -221,6 +221,21 @@ export interface AdminDeptVO { |
221 | 221 | pid?: number; |
222 | 222 | } |
223 | 223 | |
224 | +export interface AdminInvoicingAccountDto { | |
225 | + account?: string; | |
226 | + createByName?: string; | |
227 | + /** @format date-time */ | |
228 | + createTime?: string; | |
229 | + /** @format int64 */ | |
230 | + id?: number; | |
231 | + logicDelete?: boolean; | |
232 | + password?: string; | |
233 | + updateByName?: string; | |
234 | + /** @format date-time */ | |
235 | + updateTime?: string; | |
236 | + userNames?: Array<string>; | |
237 | +} | |
238 | + | |
224 | 239 | export interface AdminJobQueryVO { |
225 | 240 | /** @format int32 */ |
226 | 241 | current?: number; |
... | ... |
src/services/request.ts
... | ... | @@ -9,6 +9,7 @@ import type { |
9 | 9 | AdminClientDto, |
10 | 10 | AdminDeptQueryVO, |
11 | 11 | AdminDeptVO, |
12 | + AdminInvoicingAccountDto, | |
12 | 13 | AdminJobQueryVO, |
13 | 14 | AdminJobVO, |
14 | 15 | AdminMenuQueryVO, |
... | ... | @@ -62,6 +63,7 @@ import type { |
62 | 63 | MaterialUnitListRes, |
63 | 64 | MeasureUnitListRes, |
64 | 65 | MessageQueryDTO, |
66 | + ModelAndView, | |
65 | 67 | OrderAddVO, |
66 | 68 | OrderAuditLogQueryVO, |
67 | 69 | OrderBaseInfoQueryVO, |
... | ... | @@ -3170,9 +3172,7 @@ export interface GetErrorResponse { |
3170 | 3172 | * @description |
3171 | 3173 | * OK |
3172 | 3174 | */ |
3173 | - 200: { | |
3174 | - [propertyName: string]: any; | |
3175 | - }; | |
3175 | + 200: ModelAndView; | |
3176 | 3176 | /** |
3177 | 3177 | * @description |
3178 | 3178 | * Unauthorized |
... | ... | @@ -3193,9 +3193,9 @@ export interface GetErrorResponse { |
3193 | 3193 | export type GetErrorResponseSuccess = GetErrorResponse[200]; |
3194 | 3194 | /** |
3195 | 3195 | * @description |
3196 | - * error | |
3196 | + * errorHtml | |
3197 | 3197 | * @tags basic-error-controller |
3198 | - * @produces * | |
3198 | + * @produces text/html | |
3199 | 3199 | */ |
3200 | 3200 | export const getError = /* #__PURE__ */ (() => { |
3201 | 3201 | const method = 'get'; |
... | ... | @@ -3219,9 +3219,7 @@ export interface PutErrorResponse { |
3219 | 3219 | * @description |
3220 | 3220 | * OK |
3221 | 3221 | */ |
3222 | - 200: { | |
3223 | - [propertyName: string]: any; | |
3224 | - }; | |
3222 | + 200: ModelAndView; | |
3225 | 3223 | /** |
3226 | 3224 | * @description |
3227 | 3225 | * Created |
... | ... | @@ -3247,9 +3245,9 @@ export interface PutErrorResponse { |
3247 | 3245 | export type PutErrorResponseSuccess = PutErrorResponse[200]; |
3248 | 3246 | /** |
3249 | 3247 | * @description |
3250 | - * error | |
3248 | + * errorHtml | |
3251 | 3249 | * @tags basic-error-controller |
3252 | - * @produces * | |
3250 | + * @produces text/html | |
3253 | 3251 | * @consumes application/json |
3254 | 3252 | */ |
3255 | 3253 | export const putError = /* #__PURE__ */ (() => { |
... | ... | @@ -3274,9 +3272,7 @@ export interface PostErrorResponse { |
3274 | 3272 | * @description |
3275 | 3273 | * OK |
3276 | 3274 | */ |
3277 | - 200: { | |
3278 | - [propertyName: string]: any; | |
3279 | - }; | |
3275 | + 200: ModelAndView; | |
3280 | 3276 | /** |
3281 | 3277 | * @description |
3282 | 3278 | * Created |
... | ... | @@ -3302,9 +3298,9 @@ export interface PostErrorResponse { |
3302 | 3298 | export type PostErrorResponseSuccess = PostErrorResponse[200]; |
3303 | 3299 | /** |
3304 | 3300 | * @description |
3305 | - * error | |
3301 | + * errorHtml | |
3306 | 3302 | * @tags basic-error-controller |
3307 | - * @produces * | |
3303 | + * @produces text/html | |
3308 | 3304 | * @consumes application/json |
3309 | 3305 | */ |
3310 | 3306 | export const postError = /* #__PURE__ */ (() => { |
... | ... | @@ -3329,9 +3325,7 @@ export interface DeleteErrorResponse { |
3329 | 3325 | * @description |
3330 | 3326 | * OK |
3331 | 3327 | */ |
3332 | - 200: { | |
3333 | - [propertyName: string]: any; | |
3334 | - }; | |
3328 | + 200: ModelAndView; | |
3335 | 3329 | /** |
3336 | 3330 | * @description |
3337 | 3331 | * No Content |
... | ... | @@ -3352,9 +3346,9 @@ export interface DeleteErrorResponse { |
3352 | 3346 | export type DeleteErrorResponseSuccess = DeleteErrorResponse[200]; |
3353 | 3347 | /** |
3354 | 3348 | * @description |
3355 | - * error | |
3349 | + * errorHtml | |
3356 | 3350 | * @tags basic-error-controller |
3357 | - * @produces * | |
3351 | + * @produces text/html | |
3358 | 3352 | */ |
3359 | 3353 | export const deleteError = /* #__PURE__ */ (() => { |
3360 | 3354 | const method = 'delete'; |
... | ... | @@ -3378,9 +3372,7 @@ export interface OptionsErrorResponse { |
3378 | 3372 | * @description |
3379 | 3373 | * OK |
3380 | 3374 | */ |
3381 | - 200: { | |
3382 | - [propertyName: string]: any; | |
3383 | - }; | |
3375 | + 200: ModelAndView; | |
3384 | 3376 | /** |
3385 | 3377 | * @description |
3386 | 3378 | * No Content |
... | ... | @@ -3401,9 +3393,9 @@ export interface OptionsErrorResponse { |
3401 | 3393 | export type OptionsErrorResponseSuccess = OptionsErrorResponse[200]; |
3402 | 3394 | /** |
3403 | 3395 | * @description |
3404 | - * error | |
3396 | + * errorHtml | |
3405 | 3397 | * @tags basic-error-controller |
3406 | - * @produces * | |
3398 | + * @produces text/html | |
3407 | 3399 | * @consumes application/json |
3408 | 3400 | */ |
3409 | 3401 | export const optionsError = /* #__PURE__ */ (() => { |
... | ... | @@ -3428,9 +3420,7 @@ export interface HeadErrorResponse { |
3428 | 3420 | * @description |
3429 | 3421 | * OK |
3430 | 3422 | */ |
3431 | - 200: { | |
3432 | - [propertyName: string]: any; | |
3433 | - }; | |
3423 | + 200: ModelAndView; | |
3434 | 3424 | /** |
3435 | 3425 | * @description |
3436 | 3426 | * No Content |
... | ... | @@ -3451,9 +3441,9 @@ export interface HeadErrorResponse { |
3451 | 3441 | export type HeadErrorResponseSuccess = HeadErrorResponse[200]; |
3452 | 3442 | /** |
3453 | 3443 | * @description |
3454 | - * error | |
3444 | + * errorHtml | |
3455 | 3445 | * @tags basic-error-controller |
3456 | - * @produces * | |
3446 | + * @produces text/html | |
3457 | 3447 | * @consumes application/json |
3458 | 3448 | */ |
3459 | 3449 | export const headError = /* #__PURE__ */ (() => { |
... | ... | @@ -3478,9 +3468,7 @@ export interface PatchErrorResponse { |
3478 | 3468 | * @description |
3479 | 3469 | * OK |
3480 | 3470 | */ |
3481 | - 200: { | |
3482 | - [propertyName: string]: any; | |
3483 | - }; | |
3471 | + 200: ModelAndView; | |
3484 | 3472 | /** |
3485 | 3473 | * @description |
3486 | 3474 | * No Content |
... | ... | @@ -3501,9 +3489,9 @@ export interface PatchErrorResponse { |
3501 | 3489 | export type PatchErrorResponseSuccess = PatchErrorResponse[200]; |
3502 | 3490 | /** |
3503 | 3491 | * @description |
3504 | - * error | |
3492 | + * errorHtml | |
3505 | 3493 | * @tags basic-error-controller |
3506 | - * @produces * | |
3494 | + * @produces text/html | |
3507 | 3495 | * @consumes application/json |
3508 | 3496 | */ |
3509 | 3497 | export const patchError = /* #__PURE__ */ (() => { |
... | ... | @@ -12418,6 +12406,77 @@ export const postServiceInvoiceAddInvoice = /* #__PURE__ */ (() => { |
12418 | 12406 | return request; |
12419 | 12407 | })(); |
12420 | 12408 | |
12409 | +/** @description request parameter type for postServiceInvoiceAddInvoicingAccount */ | |
12410 | +export interface PostServiceInvoiceAddInvoicingAccountOption { | |
12411 | + /** | |
12412 | + * @description | |
12413 | + * dto | |
12414 | + */ | |
12415 | + body: { | |
12416 | + /** | |
12417 | + @description | |
12418 | + dto */ | |
12419 | + dto: AdminInvoicingAccountDto; | |
12420 | + }; | |
12421 | +} | |
12422 | + | |
12423 | +/** @description response type for postServiceInvoiceAddInvoicingAccount */ | |
12424 | +export interface PostServiceInvoiceAddInvoicingAccountResponse { | |
12425 | + /** | |
12426 | + * @description | |
12427 | + * OK | |
12428 | + */ | |
12429 | + 200: ServerResult; | |
12430 | + /** | |
12431 | + * @description | |
12432 | + * Created | |
12433 | + */ | |
12434 | + 201: any; | |
12435 | + /** | |
12436 | + * @description | |
12437 | + * Unauthorized | |
12438 | + */ | |
12439 | + 401: any; | |
12440 | + /** | |
12441 | + * @description | |
12442 | + * Forbidden | |
12443 | + */ | |
12444 | + 403: any; | |
12445 | + /** | |
12446 | + * @description | |
12447 | + * Not Found | |
12448 | + */ | |
12449 | + 404: any; | |
12450 | +} | |
12451 | + | |
12452 | +export type PostServiceInvoiceAddInvoicingAccountResponseSuccess = | |
12453 | + PostServiceInvoiceAddInvoicingAccountResponse[200]; | |
12454 | +/** | |
12455 | + * @description | |
12456 | + * 添加开票账号 | |
12457 | + * @tags 发票 | |
12458 | + * @produces * | |
12459 | + * @consumes application/json | |
12460 | + */ | |
12461 | +export const postServiceInvoiceAddInvoicingAccount = /* #__PURE__ */ (() => { | |
12462 | + const method = 'post'; | |
12463 | + const url = '/service/invoice/addInvoicingAccount'; | |
12464 | + function request( | |
12465 | + option: PostServiceInvoiceAddInvoicingAccountOption, | |
12466 | + ): Promise<PostServiceInvoiceAddInvoicingAccountResponseSuccess> { | |
12467 | + return requester(request.url, { | |
12468 | + method: request.method, | |
12469 | + ...option, | |
12470 | + }) as unknown as Promise<PostServiceInvoiceAddInvoicingAccountResponseSuccess>; | |
12471 | + } | |
12472 | + | |
12473 | + /** http method */ | |
12474 | + request.method = method; | |
12475 | + /** request url */ | |
12476 | + request.url = url; | |
12477 | + return request; | |
12478 | +})(); | |
12479 | + | |
12421 | 12480 | /** @description request parameter type for postServiceInvoiceApplyInvoice */ |
12422 | 12481 | export interface PostServiceInvoiceApplyInvoiceOption { |
12423 | 12482 | /** |
... | ... | @@ -13182,6 +13241,60 @@ export const postServiceInvoiceGetInvoiceRecord = /* #__PURE__ */ (() => { |
13182 | 13241 | return request; |
13183 | 13242 | })(); |
13184 | 13243 | |
13244 | +/** @description response type for postServiceInvoiceGetInvoicingAccount */ | |
13245 | +export interface PostServiceInvoiceGetInvoicingAccountResponse { | |
13246 | + /** | |
13247 | + * @description | |
13248 | + * OK | |
13249 | + */ | |
13250 | + 200: ServerResult; | |
13251 | + /** | |
13252 | + * @description | |
13253 | + * Created | |
13254 | + */ | |
13255 | + 201: any; | |
13256 | + /** | |
13257 | + * @description | |
13258 | + * Unauthorized | |
13259 | + */ | |
13260 | + 401: any; | |
13261 | + /** | |
13262 | + * @description | |
13263 | + * Forbidden | |
13264 | + */ | |
13265 | + 403: any; | |
13266 | + /** | |
13267 | + * @description | |
13268 | + * Not Found | |
13269 | + */ | |
13270 | + 404: any; | |
13271 | +} | |
13272 | + | |
13273 | +export type PostServiceInvoiceGetInvoicingAccountResponseSuccess = | |
13274 | + PostServiceInvoiceGetInvoicingAccountResponse[200]; | |
13275 | +/** | |
13276 | + * @description | |
13277 | + * 获取开票账号 | |
13278 | + * @tags 发票 | |
13279 | + * @produces * | |
13280 | + * @consumes application/json | |
13281 | + */ | |
13282 | +export const postServiceInvoiceGetInvoicingAccount = /* #__PURE__ */ (() => { | |
13283 | + const method = 'post'; | |
13284 | + const url = '/service/invoice/getInvoicingAccount'; | |
13285 | + function request(): Promise<PostServiceInvoiceGetInvoicingAccountResponseSuccess> { | |
13286 | + return requester(request.url, { | |
13287 | + method: request.method, | |
13288 | + }) as unknown as Promise<PostServiceInvoiceGetInvoicingAccountResponseSuccess>; | |
13289 | + } | |
13290 | + | |
13291 | + /** http method */ | |
13292 | + request.method = method; | |
13293 | + /** request url */ | |
13294 | + request.url = url; | |
13295 | + return request; | |
13296 | +})(); | |
13297 | + | |
13185 | 13298 | /** @description request parameter type for postServiceInvoiceImportInvoiceDetails */ |
13186 | 13299 | export interface PostServiceInvoiceImportInvoiceDetailsOption { |
13187 | 13300 | /** |
... | ... |