33 lines
1.4 KiB
JavaScript
33 lines
1.4 KiB
JavaScript
import React from 'react';
|
|
import ChannelPicker from '../../pay/channelPicker';
|
|
import { Form, Input } from 'antd-mobile';
|
|
import { ToYuan, ToCent } from 'oak-domain/lib/utils/money';
|
|
export default function Render(props) {
|
|
const { depositMax, payConfig, price, channel, meta, onSetChannel, onSetMeta, onSetPrice } = props.data;
|
|
const { t } = props.methods;
|
|
if (payConfig) {
|
|
return (<Form layout="horizontal">
|
|
<Form.Item label={<span>{t("label.depPrice")}:</span>} extra={t('common::pay.symbol')}>
|
|
<Input type='number' placeholder={t('placeholder', { max: depositMax })} max={depositMax} min={1} value={typeof price == 'number' ? `${ToYuan(price)}` : undefined} onChange={(value) => {
|
|
if (value === '' || value === null) {
|
|
onSetPrice(null);
|
|
return;
|
|
}
|
|
const v = parseInt(value);
|
|
if (!isNaN(v)) {
|
|
onSetPrice(ToCent(v));
|
|
}
|
|
}}/>
|
|
</Form.Item>
|
|
{price > 0 && <Form.Item label={<span>
|
|
{t('label.channel')}:
|
|
</span>}>
|
|
<ChannelPicker payConfig={payConfig} onPick={(channel) => {
|
|
onSetChannel(channel);
|
|
}} channel={channel} meta={meta} onSetMeta={(meta) => onSetMeta(meta)}/>
|
|
</Form.Item>}
|
|
</Form>);
|
|
}
|
|
return null;
|
|
}
|