update message

This commit is contained in:
LittleBoy 2024-08-13 15:13:01 +08:00
parent 905ea2ae51
commit 46421fa3d5
3 changed files with 24 additions and 20 deletions

View File

@ -354,7 +354,6 @@ export const BillList: React.FC<BillListProps> = (props) => {
</div>}
<div className="bill-list-table">
{JSON.stringify(state.selectedKeys)}
<Table<BillModel>
bordered
columns={columns}

View File

@ -1,4 +1,4 @@
import {Button, Select, Space, Divider, InputNumber, Modal,} from "@douyinfe/semi-ui";
import {Button, Select, Space, Divider, InputNumber, Modal} from "@douyinfe/semi-ui";
import React, {useEffect} from "react";
import {useSetState} from "ahooks";
import MoneyFormat from "@/components/money-format.tsx";
@ -121,6 +121,11 @@ export const BillTypeConfirmModal: React.FC<BillTypeConfirmProps> = (props) => {
...state
}]).then(() => {
props.onClose?.(true)
}).catch(e=>{
Modal.error({
title: 'Error',
content: `Confirmed Fail: ${e.message}`
})
}).finally(() => {
setState({loading: false})
})

View File

@ -1,4 +1,4 @@
import {Button, Space, TabPane, Tabs, Notification, Popconfirm, Toast, Modal} from "@douyinfe/semi-ui";
import {Button, Space, TabPane, Tabs, Popconfirm, Toast, Modal} from "@douyinfe/semi-ui";
import {useRequest, useSetState} from "ahooks";
import {useTranslation} from "react-i18next";
import {useState} from "react";
@ -19,7 +19,7 @@ const BillReconciliation = () => {
confirm_status: 'CONFIRMED'
}), {
refreshDeps: [queryParams],
onSuccess:()=>{
onSuccess: () => {
setState({checkingId: -1})
},
onError: (e: Error) => {
@ -36,16 +36,16 @@ const BillReconciliation = () => {
})
const confirmBill = (records: number[]) => {
if (records.length == 0) {
Notification.error({title: 'Notice', content: t('bill.confirm_select_empty')})
Toast.error({content: t('bill.confirm_select_empty')})
return
}
const arr = data?.list.filter(item =>records.includes(item.id));
if(!arr) return;
const arr = data?.list.filter(item => records.includes(item.id));
if (!arr) return;
for (let i = 0; i < arr.length; i++) {
const item = arr[i];
// 判断confirm的总金额是否和实付金额相等
const total = item.detail_confirms? item.detail_confirms.reduce((total, item) => {
const total = item.detail_confirms ? item.detail_confirms.reduce((total, item) => {
return total + Number(item.amount)
}, 0) : 0;
@ -60,7 +60,7 @@ const BillReconciliation = () => {
setState({checkingId: records.length > 1 ? 0 : Number(records[0])})
confirmBills(records).then(() => {
Notification.success({title: 'Notice', content: t('bill.confirm_success')})
Toast.success({content: t('bill.confirm_success')})
refresh()
}).catch((e: BizError) => {
Toast.error({
@ -109,7 +109,7 @@ const BillReconciliation = () => {
source={data} type={'reconciliation'}
operationRender={queryParams.apply_status == 'CHECKED' ? undefined : operation}
beforeTotalAmount={<div>{queryParams.apply_status != 'CHECKED' && (
(selectKeys.length == 0 )? <Button theme={'solid'} disabled style={{marginRight: 10}}>
(selectKeys.length == 0) ? <Button theme={'solid'} disabled style={{marginRight: 10}}>
{t('bill.confirm_batch')}
</Button> :
<Popconfirm