26 lines
1.3 KiB
JavaScript
26 lines
1.3 KiB
JavaScript
import React from 'react';
|
|
import { Form, InputNumber } from 'antd';
|
|
import ChannelPicker from '../../pay/channelPicker';
|
|
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 labelCol={{ span: 4 }} wrapperCol={{ span: 14 }} layout="horizontal" style={{ minWidth: 600 }} colon={false}>
|
|
<Form.Item label={<span>{t("label.depPrice")}:</span>}>
|
|
<InputNumber placeholder={t('placeholder', { max: depositMax })} max={depositMax} min={1} value={typeof price == 'number' ? ToYuan(price) : null} addonAfter={t('common::pay.symbol')} onChange={(value) => {
|
|
onSetPrice(ToCent(value || 0));
|
|
}}/>
|
|
</Form.Item>
|
|
{price > 0 ? <Form.Item label={<span style={{ marginTop: 10 }}>
|
|
{t('label.channel')}:
|
|
</span>}>
|
|
<ChannelPicker payConfig={payConfig} onPick={(channel) => {
|
|
onSetChannel(channel);
|
|
}} channel={channel} meta={meta} onSetMeta={(meta) => onSetMeta(meta)}/>
|
|
</Form.Item> : <div style={{ height: 120 }}/>}
|
|
</Form>);
|
|
}
|
|
return null;
|
|
}
|