62 lines
3.6 KiB
JavaScript
62 lines
3.6 KiB
JavaScript
import React from 'react';
|
|
import { Form, Switch, Input, Select } from 'antd';
|
|
export default function render(props) {
|
|
const { offlineAccount } = props.data;
|
|
const { t, update } = props.methods;
|
|
if (offlineAccount) {
|
|
return (<Form labelCol={{ span: 6 }} wrapperCol={{ span: 12 }} layout="horizontal" style={{ minWidth: 600 }}>
|
|
<Form.Item label={t('offlineAccount:attr.type')} required>
|
|
<Select value={offlineAccount.type} options={['bank', 'alipay', 'wechat', 'shouqianba', 'others'].map(ele => ({
|
|
label: t(`offlineAccount:v.type.${ele}`),
|
|
value: ele,
|
|
}))} onSelect={(value) => update({ type: value })}/>
|
|
</Form.Item>
|
|
{['bank', 'others'].includes(offlineAccount.type) && <Form.Item label={t(`offlineAccount::label.channel.${offlineAccount.type}`)} required>
|
|
<Input value={offlineAccount.channel || ''} onChange={({ currentTarget }) => {
|
|
const { value } = currentTarget;
|
|
update({
|
|
channel: value,
|
|
});
|
|
}} placeholder={t(`placeholder.channel.${offlineAccount.type}`)}/>
|
|
</Form.Item>}
|
|
{!!offlineAccount.type && <Form.Item label={t(`offlineAccount::label.name.${offlineAccount.type}`)} required={['bank'].includes(offlineAccount.type)}>
|
|
<Input value={offlineAccount.name || ''} onChange={({ currentTarget }) => {
|
|
const { value } = currentTarget;
|
|
update({
|
|
name: value,
|
|
});
|
|
}} placeholder={t(`placeholder.name.${offlineAccount.type}`)}/>
|
|
</Form.Item>}
|
|
{!!offlineAccount.type && <Form.Item label={t(`offlineAccount::label.qrCode.${offlineAccount.type}`)} required={offlineAccount.type === 'bank'}>
|
|
{offlineAccount.type === 'bank' && <Input value={offlineAccount.qrCode || ''} onChange={({ currentTarget }) => {
|
|
const { value } = currentTarget;
|
|
update({
|
|
qrCode: value,
|
|
});
|
|
}} placeholder={t(`placeholder.qrCode.${offlineAccount.type}`)}/>}
|
|
{offlineAccount.type !== 'bank' && <Input.TextArea rows={8} value={offlineAccount.qrCode || ''} onChange={({ currentTarget }) => {
|
|
const { value } = currentTarget;
|
|
update({
|
|
qrCode: value,
|
|
});
|
|
}} placeholder={t(`placeholder.qrCode.${offlineAccount.type}`)}/>}
|
|
</Form.Item>}
|
|
{!!offlineAccount.type && <Form.Item label={t('offlineAccount:attr.allowDeposit')} required help={t('help.allowDeposit')}>
|
|
<Switch value={offlineAccount.allowDeposit} onChange={(allowDeposit) => {
|
|
update({ allowDeposit });
|
|
}}/>
|
|
</Form.Item>}
|
|
{!!offlineAccount.type && <Form.Item label={t('offlineAccount:attr.allowPay')} required help={t('help.allowPay')}>
|
|
<Switch value={offlineAccount.allowPay} onChange={(allowPay) => {
|
|
update({ allowPay });
|
|
}}/>
|
|
</Form.Item>}
|
|
<Form.Item label={t('offlineAccount:attr.enabled')} required>
|
|
<Switch value={offlineAccount.enabled} onChange={(enabled) => {
|
|
update({ enabled });
|
|
}}/>
|
|
</Form.Item>
|
|
</Form>);
|
|
}
|
|
}
|