oak-pay-business/es/components/wpAccount/upsert/web.pc.js

69 lines
3.8 KiB
JavaScript

import React from 'react';
import { Form, Switch, InputNumber, Input, 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: 6 }} wrapperCol={{ span: 16 }} layout="horizontal" style={{ minWidth: 860 }}>
{(!wechatPay || wechatPay.$$createAt$$ === 1) && <WechatPayUpsert oakPath={`${oakFullpath}.wechatPay`} systemId={systemId} key="wpCreate"/>}
{(wpAccount.wechatPayId && wpAccount?.$$createAt$$ !== 1) && <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('wpAccount: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.refundCompensateRatio')} help={t('placeholder.refundCompensateRatio')}>
<InputNumber value={wpAccount.refundCompensateRatio} max={100} min={1} addonAfter={"%"} step={1} onChange={(value) => {
const refundCompensateRatio = value;
update({ refundCompensateRatio });
}}/>
</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.enabled')} required>
<Switch value={wpAccount.enabled} onChange={(enabled) => {
update({ enabled });
}}/>
</Form.Item>
</Form>);
}
return null;
}