几个小bug
This commit is contained in:
parent
7082a521cb
commit
1f476f6938
|
|
@ -86,6 +86,32 @@ export default OakComponent({
|
|||
}
|
||||
]);
|
||||
return payId;
|
||||
},
|
||||
setDepositMeta(depositMeta) {
|
||||
this.setState({ depositMeta });
|
||||
},
|
||||
setDepositOpen(depositOpen) {
|
||||
this.setState({ depositOpen });
|
||||
},
|
||||
setUfOpen(ufOpen) {
|
||||
this.setState({ ufOpen });
|
||||
},
|
||||
setDepPrice(depPrice) {
|
||||
this.setState({ depPrice });
|
||||
},
|
||||
setDepositChannel(depositChannel) {
|
||||
this.setState({ depositChannel });
|
||||
},
|
||||
setDepositing(depositing) {
|
||||
this.setState({ depositing });
|
||||
}
|
||||
},
|
||||
data: {
|
||||
depositOpen: false,
|
||||
ufOpen: false,
|
||||
depPrice: null,
|
||||
depositChannel: undefined,
|
||||
depositMeta: undefined,
|
||||
depositing: false,
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,4 +3,21 @@ import { RowWithActions, WebComponentProps } from 'oak-frontend-base';
|
|||
import { EntityDict } from '../../../oak-app-domain';
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'account', false, {
|
||||
account: RowWithActions<EntityDict, 'account'>;
|
||||
}>): React.JSX.Element;
|
||||
depositMax: number;
|
||||
unfinishedPayId?: string;
|
||||
onDepositPayId: (payId: string) => void;
|
||||
depositOpen: boolean;
|
||||
ufOpen: boolean;
|
||||
depPrice: number | null;
|
||||
depositChannel: string | undefined;
|
||||
depositMeta: any;
|
||||
depositing: boolean;
|
||||
}, {
|
||||
createDepositPay: (price: number, channel: string, meta: any) => Promise<string>;
|
||||
setDepositOpen: (v: boolean) => void;
|
||||
setUfOpen: (v: boolean) => void;
|
||||
setDepPrice: (v: number | null) => void;
|
||||
setDepositChannel: (v: string | undefined) => void;
|
||||
setDepositMeta: (v: any) => void;
|
||||
setDepositing: (v: boolean) => void;
|
||||
}>): React.JSX.Element | null;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,75 @@
|
|||
import React from 'react';
|
||||
import { Button, Popup } from 'antd-mobile';
|
||||
import Styles from './web.mobile.module.less';
|
||||
import classNames from 'classnames';
|
||||
import { CentToString } from 'oak-domain/lib/utils/money';
|
||||
import AccountDeposit from '../deposit';
|
||||
export default function Render(props) {
|
||||
return <div>account/detail</div>;
|
||||
const { account, depositMax, unfinishedPayId, onDepositPayId, depositOpen, ufOpen, depPrice, depositChannel, depositMeta, depositing } = props.data;
|
||||
const { t, createDepositPay, setMessage, setDepositOpen, setUfOpen, setDepPrice, setDepositChannel, setDepositMeta, setDepositing } = props.methods;
|
||||
if (account) {
|
||||
const { total, avail, '#oakLegalActions': legalActions, accountOper$account: opers } = account;
|
||||
return (<div className={Styles.container}>
|
||||
<div className={Styles.info}>
|
||||
<div className={classNames(Styles.grid, Styles.fortify)}>
|
||||
<span className={Styles.label}>{t('avail')}:</span>
|
||||
<span className={Styles.value}>{t('common::pay.symbol')} {CentToString(avail, 2)}</span>
|
||||
</div>
|
||||
<div className={Styles.grid}>
|
||||
<span className={Styles.label}>{t('total')}:</span>
|
||||
<span className={Styles.value}>{t('common::pay.symbol')} {CentToString(total, 2)}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ flex: 1 }}/>
|
||||
<div className={Styles.btn}>
|
||||
{legalActions?.includes('deposit') && <div className={Styles.item}>
|
||||
<Button block color="primary" disabled={ufOpen || depositOpen} onClick={() => {
|
||||
if (unfinishedPayId) {
|
||||
setUfOpen(true);
|
||||
}
|
||||
else {
|
||||
setDepositOpen(true);
|
||||
}
|
||||
}}>
|
||||
{t('account:action.deposit')}
|
||||
</Button>
|
||||
</div>}
|
||||
{legalActions?.includes('withdraw') && <div className={Styles.item}>
|
||||
<Button block onClick={() => setMessage({
|
||||
type: 'warning',
|
||||
content: '尚未实现'
|
||||
})}>
|
||||
{t('account:action.withdraw')}
|
||||
</Button>
|
||||
</div>}
|
||||
</div>
|
||||
<Popup visible={depositOpen} onMaskClick={() => {
|
||||
setDepositOpen(false);
|
||||
setDepPrice(null);
|
||||
setDepositChannel(undefined);
|
||||
setDepositMeta(undefined);
|
||||
}} onClose={() => {
|
||||
setDepositOpen(false);
|
||||
setDepPrice(null);
|
||||
setDepositChannel(undefined);
|
||||
setDepositMeta(undefined);
|
||||
}}>
|
||||
<div style={{ padding: 12, marginBottom: 6 }}>
|
||||
<AccountDeposit depositMax={depositMax} price={depPrice} channel={depositChannel} meta={depositMeta} onSetPrice={(price) => setDepPrice(price)} onSetChannel={(channel) => setDepositChannel(channel)} onSetMeta={(meta) => setDepositMeta(meta)}/>
|
||||
<Button block loading={depositing} color="primary" disabled={!depPrice || !depositChannel || depositing} onClick={async () => {
|
||||
setDepositing(true);
|
||||
const payId = await createDepositPay(depPrice, depositChannel, depositMeta || {});
|
||||
setDepPrice(null);
|
||||
setDepositChannel(undefined);
|
||||
setDepositMeta(undefined);
|
||||
setDepositing(false);
|
||||
onDepositPayId(payId);
|
||||
}}>
|
||||
{depositing ? t('depositing') : t('common::confirm')}
|
||||
</Button>
|
||||
</div>
|
||||
</Popup>
|
||||
</div>);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
.container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.info {
|
||||
height: 300px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.grid {
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
|
||||
.label {
|
||||
font-size: 14px;
|
||||
color: var(--oak-color-primary);
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: 14px;
|
||||
color: var(--oak-color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.fortify {
|
||||
.label {
|
||||
font-size: x-large;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: x-large;
|
||||
font-weight: bolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: flex;
|
||||
align-self: stretch;
|
||||
|
||||
.item {
|
||||
flex: 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,18 @@ export default function Render(props: WebComponentProps<EntityDict, 'account', f
|
|||
depositMax: number;
|
||||
unfinishedPayId?: string;
|
||||
onDepositPayId: (payId: string) => void;
|
||||
depositOpen: boolean;
|
||||
ufOpen: boolean;
|
||||
depPrice: number | null;
|
||||
depositChannel: string | undefined;
|
||||
depositMeta: any;
|
||||
depositing: boolean;
|
||||
}, {
|
||||
createDepositPay: (price: number, channel: string, meta: any) => Promise<string>;
|
||||
setDepositOpen: (v: boolean) => void;
|
||||
setUfOpen: (v: boolean) => void;
|
||||
setDepPrice: (v: number | null) => void;
|
||||
setDepositChannel: (v: string | undefined) => void;
|
||||
setDepositMeta: (v: any) => void;
|
||||
setDepositing: (v: boolean) => void;
|
||||
}>): React.JSX.Element | null;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import React, { useState } from 'react';
|
||||
import React from 'react';
|
||||
import { Button, Modal, Card, Flex, Divider, Typography } from 'antd';
|
||||
import Styles from './web.pc.module.less';
|
||||
import { CentToString } from 'oak-domain/lib/utils/money';
|
||||
|
|
@ -7,19 +7,13 @@ import AccountDeposit from '../deposit';
|
|||
import AccountOperList from '../../accountOper/pure/List.pc';
|
||||
import { AccountBookOutlined, ScheduleOutlined } from '@ant-design/icons';
|
||||
export default function Render(props) {
|
||||
const { account, depositMax, unfinishedPayId, onDepositPayId } = props.data;
|
||||
const { t, createDepositPay, setMessage } = props.methods;
|
||||
const [depositOpen, setDepositOpen] = useState(false);
|
||||
const [ufOpen, setUfOpen] = useState(false);
|
||||
const [depPrice, setDepPrice] = useState(null);
|
||||
const [depositChannel, setDepositChannel] = useState();
|
||||
const [depositMeta, setDepositMeta] = useState();
|
||||
const [depositing, setDepositing] = useState(false);
|
||||
const { account, depositMax, unfinishedPayId, onDepositPayId, depositOpen, ufOpen, depPrice, depositChannel, depositMeta, depositing } = props.data;
|
||||
const { t, createDepositPay, setMessage, setDepositOpen, setUfOpen, setDepPrice, setDepositChannel, setDepositMeta, setDepositing } = props.methods;
|
||||
if (account) {
|
||||
const { total, avail, '#oakLegalActions': legalActions, accountOper$account: opers } = account;
|
||||
return (<>
|
||||
<Card className={Styles.card} title={<span><AccountBookOutlined /> {t('title')}</span>} extra={<Flex gap="middle">
|
||||
{legalActions?.includes('deposit') && <Button type="primary" onClick={() => {
|
||||
{legalActions?.includes('deposit') && <Button type="primary" disabled={ufOpen || depositOpen} onClick={() => {
|
||||
if (unfinishedPayId) {
|
||||
setUfOpen(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import { Card, Tag, List, Button, Modal, Form, Selector, TextArea } from 'antd-m
|
|||
import { QRCode, Alert } from 'antd';
|
||||
import Styles from './web.mobile.module.less';
|
||||
import * as dayJs from 'dayjs';
|
||||
import duration from 'dayjs/plugin/duration';
|
||||
dayJs.extend(duration);
|
||||
import { CentToString } from 'oak-domain/lib/utils/money';
|
||||
import { PAY_CHANNEL_OFFLINE_NAME, PAY_CHANNEL_WECHAT_APP_NAME, PAY_CHANNEL_WECHAT_H5_NAME, PAY_CHANNEL_WECHAT_JS_NAME, PAY_CHANNEL_WECHAT_MP_NAME, PAY_CHANNEL_WECHAT_NATIVE_NAME } from '../../../types/PayConfig';
|
||||
import { PayCircleOutline, GlobalOutline } from 'antd-mobile-icons';
|
||||
|
|
|
|||
|
|
@ -89,6 +89,32 @@ export default OakComponent({
|
|||
]);
|
||||
|
||||
return payId;
|
||||
},
|
||||
setDepositMeta(depositMeta: any) {
|
||||
this.setState({ depositMeta });
|
||||
},
|
||||
setDepositOpen(depositOpen: boolean) {
|
||||
this.setState({ depositOpen });
|
||||
},
|
||||
setUfOpen(ufOpen: boolean) {
|
||||
this.setState({ ufOpen });
|
||||
},
|
||||
setDepPrice(depPrice: null | number) {
|
||||
this.setState({ depPrice });
|
||||
},
|
||||
setDepositChannel(depositChannel: string | undefined) {
|
||||
this.setState({ depositChannel });
|
||||
},
|
||||
setDepositing(depositing: boolean) {
|
||||
this.setState({ depositing });
|
||||
}
|
||||
},
|
||||
data: {
|
||||
depositOpen: false,
|
||||
ufOpen: false,
|
||||
depPrice: null as null | number,
|
||||
depositChannel: undefined as string | undefined,
|
||||
depositMeta: undefined as any,
|
||||
depositing: false,
|
||||
}
|
||||
})
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
.container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.info {
|
||||
height: 300px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.grid {
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
|
||||
.label {
|
||||
font-size: 14px;
|
||||
color: var(--oak-color-primary);
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: 14px;
|
||||
color: var(--oak-color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.fortify {
|
||||
.label {
|
||||
font-size: x-large;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: x-large;
|
||||
font-weight: bolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: flex;
|
||||
align-self: stretch;
|
||||
|
||||
.item {
|
||||
flex: 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import React, { useState } from 'react';
|
||||
import React from 'react';
|
||||
import { Button, Modal, Card, Flex, Divider, Typography } from 'antd';
|
||||
import { RowWithActions, WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from '@project/oak-app-domain';
|
||||
|
|
@ -15,19 +15,28 @@ export default function Render(props: WebComponentProps<EntityDict, 'account', f
|
|||
depositMax: number;
|
||||
unfinishedPayId?: string;
|
||||
onDepositPayId: (payId: string) => void;
|
||||
depositOpen: boolean;
|
||||
ufOpen: boolean;
|
||||
depPrice: number | null;
|
||||
depositChannel: string | undefined;
|
||||
depositMeta: any;
|
||||
depositing: boolean;
|
||||
}, {
|
||||
createDepositPay: (price: number, channel: string, meta: any) => Promise<string>
|
||||
createDepositPay: (price: number, channel: string, meta: any) => Promise<string>;
|
||||
setDepositOpen: (v: boolean) => void;
|
||||
setUfOpen: (v: boolean) => void;
|
||||
setDepPrice: (v: number | null) => void;
|
||||
setDepositChannel: (v: string | undefined) => void;
|
||||
setDepositMeta: (v: any) => void;
|
||||
setDepositing: (v: boolean) => void;
|
||||
}>) {
|
||||
const { account, depositMax, unfinishedPayId, onDepositPayId } = props.data;
|
||||
const { t, createDepositPay, setMessage } = props.methods;
|
||||
const { account, depositMax, unfinishedPayId, onDepositPayId, depositOpen,
|
||||
ufOpen, depPrice, depositChannel, depositMeta, depositing
|
||||
} = props.data;
|
||||
const { t, createDepositPay, setMessage, setDepositOpen, setUfOpen,
|
||||
setDepPrice, setDepositChannel, setDepositMeta, setDepositing
|
||||
} = props.methods;
|
||||
|
||||
const [depositOpen, setDepositOpen] = useState(false);
|
||||
const [ufOpen, setUfOpen] = useState(false);
|
||||
const [depPrice, setDepPrice] = useState<null | number>(null);
|
||||
const [depositChannel, setDepositChannel] = useState<string | undefined>();
|
||||
const [depositMeta, setDepositMeta] = useState<any>();
|
||||
|
||||
const [depositing, setDepositing] = useState(false);
|
||||
if (account) {
|
||||
const { total, avail, '#oakLegalActions': legalActions, accountOper$account: opers } = account;
|
||||
|
||||
|
|
@ -40,6 +49,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'account', f
|
|||
<Flex gap="middle">
|
||||
{legalActions?.includes('deposit') && <Button
|
||||
type="primary"
|
||||
disabled={ufOpen || depositOpen}
|
||||
onClick={() => {
|
||||
if (unfinishedPayId) {
|
||||
setUfOpen(true);
|
||||
|
|
|
|||
|
|
@ -1,15 +1,131 @@
|
|||
import React, { useState } from 'react';
|
||||
import { Button, Row, Tabs } from 'antd';
|
||||
import { Button, Popup } from 'antd-mobile';
|
||||
import { RowWithActions, WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from '@project/oak-app-domain';
|
||||
import Styles from './web.pc.module.less';
|
||||
import { PAY_CHANNEL_WECHAT_JS_NAME, PAY_CHANNEL_WECHAT_H5_NAME,
|
||||
PAY_CHANNEL_WECHAT_MP_NAME, PAY_CHANNEL_WECHAT_NATIVE_NAME } from '../../../types/PayConfig';
|
||||
import { generateNewId } from 'oak-domain/lib/utils/uuid';
|
||||
|
||||
import Styles from './web.mobile.module.less';
|
||||
import classNames from 'classnames';
|
||||
import { CentToString } from 'oak-domain/lib/utils/money';
|
||||
import AccountDeposit from '../deposit';
|
||||
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'account', false, {
|
||||
account: RowWithActions<EntityDict, 'account'>;
|
||||
depositMax: number;
|
||||
unfinishedPayId?: string;
|
||||
onDepositPayId: (payId: string) => void;
|
||||
depositOpen: boolean;
|
||||
ufOpen: boolean;
|
||||
depPrice: number | null;
|
||||
depositChannel: string | undefined;
|
||||
depositMeta: any;
|
||||
depositing: boolean;
|
||||
}, {
|
||||
createDepositPay: (price: number, channel: string, meta: any) => Promise<string>;
|
||||
setDepositOpen: (v: boolean) => void;
|
||||
setUfOpen: (v: boolean) => void;
|
||||
setDepPrice: (v: number | null) => void;
|
||||
setDepositChannel: (v: string | undefined) => void;
|
||||
setDepositMeta: (v: any) => void;
|
||||
setDepositing: (v: boolean) => void;
|
||||
}>) {
|
||||
return <div>account/detail</div>;
|
||||
const { account, depositMax, unfinishedPayId, onDepositPayId, depositOpen,
|
||||
ufOpen, depPrice, depositChannel, depositMeta, depositing
|
||||
} = props.data;
|
||||
const { t, createDepositPay, setMessage, setDepositOpen, setUfOpen,
|
||||
setDepPrice, setDepositChannel, setDepositMeta, setDepositing
|
||||
} = props.methods;
|
||||
|
||||
if (account) {
|
||||
const { total, avail, '#oakLegalActions': legalActions, accountOper$account: opers } = account;
|
||||
|
||||
return (
|
||||
<div className={Styles.container}>
|
||||
<div className={Styles.info}>
|
||||
<div className={classNames(Styles.grid, Styles.fortify)}>
|
||||
<span className={Styles.label}>{t('avail')}:</span>
|
||||
<span className={Styles.value}>{t('common::pay.symbol')} {CentToString(avail!, 2)}</span>
|
||||
</div>
|
||||
<div className={Styles.grid}>
|
||||
<span className={Styles.label}>{t('total')}:</span>
|
||||
<span className={Styles.value}>{t('common::pay.symbol')} {CentToString(total!, 2)}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ flex: 1 }} />
|
||||
<div className={Styles.btn}>
|
||||
{legalActions?.includes('deposit') && <div className={Styles.item}>
|
||||
<Button
|
||||
block
|
||||
color="primary"
|
||||
disabled={ufOpen || depositOpen}
|
||||
onClick={() => {
|
||||
if (unfinishedPayId) {
|
||||
setUfOpen(true);
|
||||
}
|
||||
else {
|
||||
setDepositOpen(true);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{t('account:action.deposit')}
|
||||
</Button>
|
||||
</div>}
|
||||
{legalActions?.includes('withdraw') && <div className={Styles.item}>
|
||||
<Button
|
||||
block
|
||||
onClick={() => setMessage({
|
||||
type: 'warning',
|
||||
content: '尚未实现'
|
||||
})}
|
||||
>
|
||||
{t('account:action.withdraw')}
|
||||
</Button>
|
||||
</div>}
|
||||
</div>
|
||||
<Popup
|
||||
visible={depositOpen}
|
||||
onMaskClick={() => {
|
||||
setDepositOpen(false);
|
||||
setDepPrice(null);
|
||||
setDepositChannel(undefined);
|
||||
setDepositMeta(undefined);
|
||||
}}
|
||||
onClose={() => {
|
||||
setDepositOpen(false);
|
||||
setDepPrice(null);
|
||||
setDepositChannel(undefined);
|
||||
setDepositMeta(undefined);
|
||||
}}
|
||||
>
|
||||
<div style={{ padding: 12, marginBottom: 6 }}>
|
||||
<AccountDeposit
|
||||
depositMax={depositMax}
|
||||
price={depPrice}
|
||||
channel={depositChannel}
|
||||
meta={depositMeta}
|
||||
onSetPrice={(price) => setDepPrice(price)}
|
||||
onSetChannel={(channel) => setDepositChannel(channel)}
|
||||
onSetMeta={(meta) => setDepositMeta(meta)}
|
||||
/>
|
||||
<Button
|
||||
block
|
||||
loading={depositing}
|
||||
color="primary"
|
||||
disabled={!depPrice || !depositChannel || depositing}
|
||||
onClick={async () => {
|
||||
setDepositing(true);
|
||||
const payId = await createDepositPay(depPrice!, depositChannel!, depositMeta || {});
|
||||
setDepPrice(null);
|
||||
setDepositChannel(undefined);
|
||||
setDepositMeta(undefined);
|
||||
setDepositing(false);
|
||||
onDepositPayId(payId);
|
||||
}}
|
||||
>
|
||||
{depositing ? t('depositing') : t('common::confirm')}
|
||||
</Button>
|
||||
</div>
|
||||
</Popup>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -5,6 +5,8 @@ import { RowWithActions, WebComponentProps } from 'oak-frontend-base';
|
|||
import { EntityDict } from '@project/oak-app-domain';
|
||||
import Styles from './web.mobile.module.less';
|
||||
import * as dayJs from 'dayjs';
|
||||
import duration from 'dayjs/plugin/duration';
|
||||
dayJs.extend(duration);
|
||||
import { CentToString } from 'oak-domain/lib/utils/money';
|
||||
import {
|
||||
OfflinePayConfig,
|
||||
|
|
|
|||
Loading…
Reference in New Issue