Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
markliu2013 committed Jan 23, 2024
1 parent 5c1a145 commit 2916458
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "moneywhere-user-fe",
"version": "1.0.38",
"version": "1.0.39",
"private": true,
"scripts": {
"analyze": "cross-env ANALYZE=1 max build",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en-US/flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default {
'placeholder.negative.refund': 'Negative number is refund',

'flow.operation.file': 'File',
'flow.file.size.error': 'Too Large'
'flow.file.size.error': 'Too Large',
'flow.currency.auto.tooltip': 'Convert,Currency:{rate}',

}
3 changes: 2 additions & 1 deletion src/locales/zh-CN/flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default {

'flow.operation.file': '文件',
'flow.modal.file.title': '账单文件',
'flow.file.size.error': '文件太大'
'flow.file.size.error': '文件太大',
'flow.currency.auto.tooltip': '自动折算,当前汇率:{rate}',

}
28 changes: 15 additions & 13 deletions src/pages/BalanceFlow/ActionForm.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {useEffect, useState, useMemo, useRef} from 'react';
import {Button, Col, Form, Input, Row, Space, Tabs} from 'antd';
import {Button, Col, Form, Input, Row, Space, Tabs, Tooltip} from 'antd';
import {MinusCircleOutlined, PlusCircleOutlined, CalculatorOutlined} from '@ant-design/icons';
import {
ProFormDateTimePicker,
Expand Down Expand Up @@ -170,8 +170,7 @@ export default ({ initType = 'EXPENSE' }) => {
if (newCategory?.amount && Number(newCategory.amount) !== 0) {
newValues.categories[field.key] = {
...newValues.categories[field.key],
amount: currencyRate * Number(newCategory.amount),
convertedAmount: currencyRate * Number(newCategory.amount),
convertedAmount: (currencyRate * Number(newCategory.amount)).toFixed(2),
}
}
formRef.current?.setFieldsValue({
Expand Down Expand Up @@ -239,6 +238,7 @@ export default ({ initType = 'EXPENSE' }) => {
const amountLabelMsg = t('flow.label.amount');
const convertCurrencyMsg = t('convertCurrency');
const placeholderRefundMsg = t('placeholder.negative.refund');
const currencyTooltipMsg = t('flow.currency.auto.tooltip', {rate: currencyRate})
return (
<>
<MyModalForm
Expand Down Expand Up @@ -340,17 +340,19 @@ export default ({ initType = 'EXPENSE' }) => {
</Col>
{currencyConvert.needConvert && (
<Col flex="210px">
<Form.Item
name={[field.name, 'convertedAmount']}
label={convertCurrencyMsg + currencyConvert.convertCode}
rules={requiredRules()}
labelCol={{ span: 10 }}
>
<Space.Compact>
<Input />
<Space.Compact>
<Form.Item
name={[field.name, 'convertedAmount']}
label={convertCurrencyMsg + currencyConvert.convertCode}
rules={requiredRules()}
labelCol={{ span: 10 }}
>
<Input />
</Form.Item>
<Tooltip title={currencyTooltipMsg}>
<Button onClick={() => rateClickHandler(field)} loading={currencyRateLoading} size="small" type="primary" icon={<CalculatorOutlined /> } />
</Space.Compact>
</Form.Item>
</Tooltip>
</Space.Compact>
</Col>
)}
<Col flex="25px">
Expand Down

0 comments on commit 2916458

Please sign in to comment.