79 lines
4.3 KiB
JavaScript
79 lines
4.3 KiB
JavaScript
import React from 'react';
|
|
import { Form, Switch, InputNumber, Input, Radio, Divider } from 'antd';
|
|
import Styles from './web.pc.module.less';
|
|
import WechatPayUpsert from '../../wechatPay/upsert';
|
|
export default function render(props) {
|
|
const { wpAccount, wechatPay, oakFullpath, systemId } = props.data;
|
|
const { t, update } = props.methods;
|
|
if (wpAccount) {
|
|
return (<Form labelCol={{ span: 8 }} wrapperCol={{ span: 12 }} layout="horizontal" style={{ minWidth: 860 }}>
|
|
{(!wechatPay || wechatPay.$$createAt$$ === 1) && <WechatPayUpsert oakPath={`${oakFullpath}.wechatPay`} systemId={systemId} key="wpCreate"/>}
|
|
{wpAccount.wechatPayId && <WechatPayUpsert oakPath={`${oakFullpath}.wechatPay`} systemId={systemId} key="wpUpdate" oakId={wpAccount.wechatPayId}/>}
|
|
<Form.Item label="说明">
|
|
<div className={Styles.tips}>
|
|
{t('wechatPayIsShared')}
|
|
</div>
|
|
</Form.Item>
|
|
<Divider />
|
|
<Form.Item label={t('wpAccount:attr.mchId')}>
|
|
<Input maxLength={32} value={wpAccount.mchId} onChange={({ currentTarget }) => {
|
|
const mchId = currentTarget.value;
|
|
update({ mchId });
|
|
}}/>
|
|
</Form.Item>
|
|
<Form.Item label={t('wpAccount:attr.privateKeyFilePath')}>
|
|
<Input value={wpAccount.privateKeyFilePath} placeholder={t('placeholder.privateKeyFilePath')} onChange={({ currentTarget }) => {
|
|
const privateKeyFilePath = currentTarget.value;
|
|
update({ privateKeyFilePath });
|
|
}}/>
|
|
</Form.Item>
|
|
<Form.Item label={t('wpAccount:attr.publicKeyFilePath')}>
|
|
<Input value={wpAccount.publicKeyFilePath} placeholder={t('placeholder.publicKeyFilePath')} onChange={({ currentTarget }) => {
|
|
const publicKeyFilePath = currentTarget.value;
|
|
update({ publicKeyFilePath });
|
|
}}/>
|
|
</Form.Item>
|
|
<Form.Item label={t('wpAccount:attr.apiV3Key')}>
|
|
<Input value={wpAccount.apiV3Key} placeholder={t('placeholder.apiV3Key')} onChange={({ currentTarget }) => {
|
|
const apiV3Key = currentTarget.value;
|
|
update({ apiV3Key });
|
|
}}/>
|
|
</Form.Item>
|
|
<Form.Item label={t('wechatPay:attr.taxlossRatio')} help={t('placeholder.taxlossRatio')}>
|
|
<InputNumber value={wpAccount.taxlossRatio} max={5} min={0.01} addonAfter={"%"} step={0.01} precision={2} onChange={(value) => {
|
|
const taxlossRatio = value;
|
|
update({ taxlossRatio });
|
|
}}/>
|
|
</Form.Item>
|
|
<Form.Item label={t('wpAccount:attr.refundGapDays')} help={t('placeholder.refundGapDays')}>
|
|
<InputNumber value={wpAccount.refundGapDays} max={365} min={7} addonAfter={"天"} step={1} onChange={(value) => {
|
|
const refundGapDays = value;
|
|
update({ refundGapDays });
|
|
}}/>
|
|
</Form.Item>
|
|
<Form.Item label={t('wpAccount:attr.refundLossRatio')} help={t('placeholder.refundLossRatio')}>
|
|
<InputNumber value={wpAccount.refundLossRatio} max={5} min={0.01} addonAfter={"%"} step={0.01} precision={2} onChange={(value) => {
|
|
const refundLossRatio = value;
|
|
update({ refundLossRatio });
|
|
}}/>
|
|
</Form.Item>
|
|
<Form.Item label={t('wpAccount:attr.refundLossFloor')} help={t('placeholder.refundLossFloor')}>
|
|
<Radio.Group onChange={({ target }) => {
|
|
const { value } = target;
|
|
const refundLossFloor = value;
|
|
update({ refundLossFloor });
|
|
}} value={wpAccount.refundLossFloor}>
|
|
<Radio value={"jiao"}>角</Radio>
|
|
<Radio value={"yuan"}>元</Radio>
|
|
</Radio.Group>
|
|
</Form.Item>
|
|
<Form.Item label={t('wpAccount:attr.enabled')} required>
|
|
<Switch value={wpAccount.enabled} onChange={(enabled) => {
|
|
update({ enabled });
|
|
}}/>
|
|
</Form.Item>
|
|
</Form>);
|
|
}
|
|
return null;
|
|
}
|