支付配置中增加了充值扣款比例

This commit is contained in:
Xu Chang 2024-05-17 15:54:00 +08:00
parent 65db56ea74
commit 2dd04c7cef
21 changed files with 200 additions and 33 deletions

View File

@ -48,6 +48,7 @@ declare const ListPro: <T extends keyof EntityDict>(props: {
size?: "small" | "middle" | "large" | undefined;
scroll?: any;
locale?: any;
opWidth?: number | undefined;
}) => React.ReactElement;
declare const Detail: <T extends keyof EntityDict>(props: ReactComponentProps<EntityDict, T, false, {
column?: number | Record<Breakpoint, number> | undefined;
@ -56,14 +57,14 @@ declare const Detail: <T extends keyof EntityDict>(props: ReactComponentProps<En
data: Partial<EntityDict[T]["Schema"]>;
title?: string | undefined;
bordered?: boolean | undefined;
layout?: "horizontal" | "vertical" | undefined;
layout?: "vertical" | "horizontal" | undefined;
}>) => React.ReactElement;
declare const Upsert: <T extends keyof EntityDict>(props: ReactComponentProps<EntityDict, T, false, {
helps: Record<string, string>;
entity: T;
attributes: OakAbsAttrUpsertDef<EntityDict, T, string | number>[];
data: EntityDict[T]["Schema"];
layout: "horizontal" | "vertical";
layout: "vertical" | "horizontal";
mode: "default" | "card";
}>) => React.ReactElement;
export { FilterPanel, List, ListPro, Detail, Upsert, ReactComponentProps, ColumnProps, RowWithActions, OakExtraActionProps, OakAbsAttrDef, onActionFnDef, };

View File

@ -1,5 +1,4 @@
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, boolean, {
tips: string;
depositMinCent: number;
depositMaxCent: number;
onSetPrice: (price: null | number) => void;

View File

@ -2,7 +2,6 @@ import { ToCent, ToYuan } from 'oak-domain/lib/utils/money';
import { PAY_CHANNEL_ACCOUNT_NAME, PAY_CHANNEL_OFFLINE_NAME } from '../../../types/PayConfig';
export default OakComponent({
properties: {
tips: '',
depositMinCent: 0,
depositMaxCent: 1000000,
onSetPrice: (price) => undefined,
@ -24,12 +23,15 @@ export default OakComponent({
}
}
const { depositMaxCent, depositMinCent } = this.props;
const depositLoss = accountConfig?.depositLoss;
const depositLossRatio = accountConfig?.depositLossRatio;
const tips = depositLoss ? depositLossRatio ? this.t('tips.depositLossRatio', { ratio: depositLossRatio }) : this.t('tips.depositLoss') : '';
return {
depositMax: ToYuan(depositMaxCent),
depositMin: ToYuan(depositMinCent),
account: data,
payConfig,
// accountConfig,
tips,
};
},
features: ['application'],

View File

@ -3,5 +3,9 @@
"label": {
"depPrice": "充值金额",
"channel": "充值渠道"
},
"tips": {
"depositLoss": "线上充值将按照充值渠道的扣款比例扣除相应费用一般是0.6%),敬请知晓",
"depositLossRatio": "线上充值将按照%{ratio}%的比例扣除相应费用,敬请知晓"
}
}

View File

@ -1,6 +1,24 @@
import React from 'react';
import { Alert } from 'antd';
import { Alert, Form, Switch, InputNumber } from 'antd';
export default function Account(props) {
const { t } = props;
return <Alert type='info' message={t('tips')}/>;
const { t, config, update } = props;
return (<Form labelCol={{ span: 6 }} wrapperCol={{ span: 12 }} layout="horizontal" style={{ minWidth: 600 }}>
<Alert type='info' message={t('tips')}/>
<Form.Item label={t('label.depositLoss')} help={t('placeholder.depositLoss')}>
<Switch value={config.depositLoss} onChange={(value) => {
config.depositLoss = value;
if (value === false) {
config.depositLossRatio = undefined;
}
update(config);
}}/>
</Form.Item>
{config.depositLoss &&
<Form.Item label={t('label.depositLossRatio')} help={t('placeholder.depositLossRatio')}>
<InputNumber value={config.depositLossRatio} max={5} min={0.01} addonAfter={"%"} step={0.01} precision={2} onChange={(value) => {
config.depositLossRatio = value;
update(config);
}}/>
</Form.Item>}
</Form>);
}

View File

@ -1,3 +1,11 @@
{
"tips": "无需配置。开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付等操作"
"tips": "开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付、提现等操作,请了解功能后再使用",
"label": {
"depositLossRatio": "充值损耗比例",
"depositLoss": "充值损耗"
},
"placeholder": {
"depositLossRatio": "若为空,则默认按收费途径的损耗扣除",
"depositLoss": "开启后用户充值有损耗"
}
}

View File

@ -1,5 +1,5 @@
import React from 'react';
import { Form, Input } from 'antd';
import { Form, Input, InputNumber } from 'antd';
export default function WechatPay(props) {
const { config, update, t } = props;
return (<Form labelCol={{ span: 6 }} wrapperCol={{ span: 12 }} layout="horizontal" style={{ minWidth: 600 }}>
@ -19,6 +19,12 @@ export default function WechatPay(props) {
<Input value={config.publicKeyFilePath} placeholder={t('placeholder.publicKeyFilePath')} onChange={({ currentTarget }) => {
config.publicKeyFilePath = currentTarget.value;
update(config);
}}/>
</Form.Item>
<Form.Item label={t('label.lossRatio')} help={t('placeholder.lossRatio')}>
<InputNumber value={config.lossRatio} max={5} min={0.01} addonAfter={"%"} step={0.01} precision={2} onChange={(value) => {
config.lossRatio = value;
update(config);
}}/>
</Form.Item>
</Form>);

View File

@ -1,10 +1,12 @@
{
"label": {
"privateKeyFilePath": "私钥文件路径",
"publicKeyFilePath": "公钥文件路径"
"publicKeyFilePath": "公钥文件路径",
"lossRatio": "手续费比例"
},
"placeholder": {
"privateKeyFilePath": "服务器上存放微信支付帐户私钥文件的路径,注意访问权限",
"publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限"
"publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限",
"lossRatio": "填百分比(0.6就代表千分之六)"
}
}

View File

@ -11,6 +11,10 @@ const i18ns = [
"label": {
"depPrice": "充值金额",
"channel": "充值渠道"
},
"tips": {
"depositLoss": "线上充值将按照充值渠道的扣款比例扣除相应费用一般是0.6%),敬请知晓",
"depositLossRatio": "线上充值将按照%{ratio}%的比例扣除相应费用,敬请知晓"
}
}
},
@ -166,7 +170,15 @@ const i18ns = [
module: "oak-pay-business",
position: "src/components/payConfig/upsert/account",
data: {
"tips": "无需配置。开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付等操作"
"tips": "开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付、提现等操作,请了解功能后再使用",
"label": {
"depositLossRatio": "充值损耗比例",
"depositLoss": "充值损耗"
},
"placeholder": {
"depositLossRatio": "若为空,则默认按收费途径的损耗扣除",
"depositLoss": "开启后用户充值有损耗"
}
}
},
{
@ -204,11 +216,13 @@ const i18ns = [
data: {
"label": {
"privateKeyFilePath": "私钥文件路径",
"publicKeyFilePath": "公钥文件路径"
"publicKeyFilePath": "公钥文件路径",
"lossRatio": "手续费比例"
},
"placeholder": {
"privateKeyFilePath": "服务器上存放微信支付帐户私钥文件的路径,注意访问权限",
"publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限"
"publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限",
"lossRatio": "填百分比(0.6就代表千分之六)"
}
}
},

View File

@ -7,10 +7,13 @@ export type WechatPayConfig = {
mchId: string;
publicKeyFilePath: string;
privateKeyFilePath: string;
lossRatio: number;
};
export type AccountPayChannel = 'ACCOUNT';
export type AccountPayConfig = {
channel: AccountPayChannel;
depositLoss: boolean;
depositLossRatio?: number;
};
export type OfflinePayChannel = 'OFFLINE';
export type OfflinePayConfig = {

View File

@ -13,6 +13,10 @@ const i18ns = [
"label": {
"depPrice": "充值金额",
"channel": "充值渠道"
},
"tips": {
"depositLoss": "线上充值将按照充值渠道的扣款比例扣除相应费用一般是0.6%),敬请知晓",
"depositLossRatio": "线上充值将按照%{ratio}%的比例扣除相应费用,敬请知晓"
}
}
},
@ -168,7 +172,15 @@ const i18ns = [
module: "oak-pay-business",
position: "src/components/payConfig/upsert/account",
data: {
"tips": "无需配置。开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付等操作"
"tips": "开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付、提现等操作,请了解功能后再使用",
"label": {
"depositLossRatio": "充值损耗比例",
"depositLoss": "充值损耗"
},
"placeholder": {
"depositLossRatio": "若为空,则默认按收费途径的损耗扣除",
"depositLoss": "开启后用户充值有损耗"
}
}
},
{
@ -206,11 +218,13 @@ const i18ns = [
data: {
"label": {
"privateKeyFilePath": "私钥文件路径",
"publicKeyFilePath": "公钥文件路径"
"publicKeyFilePath": "公钥文件路径",
"lossRatio": "手续费比例"
},
"placeholder": {
"privateKeyFilePath": "服务器上存放微信支付帐户私钥文件的路径,注意访问权限",
"publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限"
"publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限",
"lossRatio": "填百分比(0.6就代表千分之六)"
}
}
},

View File

@ -7,10 +7,13 @@ export type WechatPayConfig = {
mchId: string;
publicKeyFilePath: string;
privateKeyFilePath: string;
lossRatio: number;
};
export type AccountPayChannel = 'ACCOUNT';
export type AccountPayConfig = {
channel: AccountPayChannel;
depositLoss: boolean;
depositLossRatio?: number;
};
export type OfflinePayChannel = 'OFFLINE';
export type OfflinePayConfig = {

View File

@ -3,7 +3,6 @@ import { AccountPayConfig, OfflinePayConfig,
PAY_CHANNEL_ACCOUNT_NAME, PAY_CHANNEL_OFFLINE_NAME } from '../../../types/PayConfig';
export default OakComponent({
properties: {
tips: '',
depositMinCent: 0,
depositMaxCent: 1000000,
onSetPrice: (price: null | number) => undefined as void,
@ -24,13 +23,17 @@ export default OakComponent({
payConfig.push(config);
}
}
const { depositMaxCent, depositMinCent } = this.props;
const { depositMaxCent, depositMinCent } = this.props;
const depositLoss = accountConfig?.depositLoss;
const depositLossRatio = accountConfig?.depositLossRatio;
const tips = depositLoss ? depositLossRatio ? this.t('tips.depositLossRatio', { ratio: depositLossRatio }) : this.t('tips.depositLoss') : '';
return {
depositMax: ToYuan(depositMaxCent!),
depositMin: ToYuan(depositMinCent!),
account: data,
payConfig,
// accountConfig,
tips,
};
},
features: ['application'],

View File

@ -3,5 +3,9 @@
"label": {
"depPrice": "充值金额",
"channel": "充值渠道"
},
"tips": {
"depositLoss": "线上充值将按照充值渠道的扣款比例扣除相应费用一般是0.6%),敬请知晓",
"depositLossRatio": "线上充值将按照%{ratio}%的比例扣除相应费用,敬请知晓"
}
}

View File

@ -1,12 +1,54 @@
import { AccountPayConfig } from '@project/types/PayConfig';
import React from 'react';
import { Alert } from 'antd';
import { Alert, Form, Switch, InputNumber } from 'antd';
export default function Account(props: {
config: AccountPayConfig;
update: (config: AccountPayConfig) => void;
t: (k: string) => string;
}) {
const { t } = props;
return <Alert type='info' message={t('tips')} />;
const { t, config, update } = props;
return (
<Form
labelCol={{ span: 6 }}
wrapperCol={{ span: 12 }}
layout="horizontal"
style={{ minWidth: 600 }}
>
<Alert type='info' message={t('tips')} />
<Form.Item
label={t('label.depositLoss')}
help={t('placeholder.depositLoss')}
>
<Switch
value={config.depositLoss}
onChange={(value) => {
config.depositLoss = value;
if (value === false) {
config.depositLossRatio = undefined;
}
update(config);
}}
/>
</Form.Item>
{config.depositLoss &&
<Form.Item
label={t('label.depositLossRatio')}
help={t('placeholder.depositLossRatio')}
>
<InputNumber
value={config.depositLossRatio}
max={5}
min={0.01}
addonAfter={"%"}
step={0.01}
precision={2}
onChange={(value) => {
config.depositLossRatio = value as number;
update(config);
}}
/>
</Form.Item>}
</Form>
);
}

View File

@ -1,3 +1,11 @@
{
"tips": "无需配置。开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付等操作"
"tips": "开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付、提现等操作,请了解功能后再使用",
"label": {
"depositLossRatio": "充值损耗比例",
"depositLoss": "充值损耗"
},
"placeholder": {
"depositLossRatio": "若为空,则默认按收费途径的损耗扣除",
"depositLoss": "开启后用户充值有损耗"
}
}

View File

@ -136,13 +136,13 @@ export default function Upsert(props: {
if (config) {
config.push({
channel: value,
});
} as any);
update(config);
}
else {
update([{
channel: value,
}]);
} as any]);
}
setOpen(false);
}}

View File

@ -1,6 +1,6 @@
import { WechatPayConfig } from '@project/types/PayConfig';
import React from 'react';
import { Form, Input } from 'antd';
import { Form, Input, InputNumber } from 'antd';
export default function WechatPay(props: {
config: WechatPayConfig;
@ -44,6 +44,23 @@ export default function WechatPay(props: {
}}
/>
</Form.Item>
<Form.Item
label={t('label.lossRatio')}
help={t('placeholder.lossRatio')}
>
<InputNumber
value={config.lossRatio}
max={5}
min={0.01}
addonAfter={"%"}
step={0.01}
precision={2}
onChange={(value) => {
config.lossRatio = value as number;
update(config);
}}
/>
</Form.Item>
</Form>
);
}

View File

@ -1,10 +1,12 @@
{
"label": {
"privateKeyFilePath": "私钥文件路径",
"publicKeyFilePath": "公钥文件路径"
"publicKeyFilePath": "公钥文件路径",
"lossRatio": "手续费比例"
},
"placeholder": {
"privateKeyFilePath": "服务器上存放微信支付帐户私钥文件的路径,注意访问权限",
"publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限"
"publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限",
"lossRatio": "填百分比(0.6就代表千分之六)"
}
}

View File

@ -13,6 +13,10 @@ const i18ns: I18n[] = [
"label": {
"depPrice": "充值金额",
"channel": "充值渠道"
},
"tips": {
"depositLoss": "线上充值将按照充值渠道的扣款比例扣除相应费用一般是0.6%),敬请知晓",
"depositLossRatio": "线上充值将按照%{ratio}%的比例扣除相应费用,敬请知晓"
}
}
},
@ -168,7 +172,15 @@ const i18ns: I18n[] = [
module: "oak-pay-business",
position: "src/components/payConfig/upsert/account",
data: {
"tips": "无需配置。开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付等操作"
"tips": "开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付、提现等操作,请了解功能后再使用",
"label": {
"depositLossRatio": "充值损耗比例",
"depositLoss": "充值损耗"
},
"placeholder": {
"depositLossRatio": "若为空,则默认按收费途径的损耗扣除",
"depositLoss": "开启后用户充值有损耗"
}
}
},
{
@ -206,11 +218,13 @@ const i18ns: I18n[] = [
data: {
"label": {
"privateKeyFilePath": "私钥文件路径",
"publicKeyFilePath": "公钥文件路径"
"publicKeyFilePath": "公钥文件路径",
"lossRatio": "手续费比例"
},
"placeholder": {
"privateKeyFilePath": "服务器上存放微信支付帐户私钥文件的路径,注意访问权限",
"publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限"
"publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限",
"lossRatio": "填百分比(0.6就代表千分之六)"
}
}
},

View File

@ -9,11 +9,14 @@ export type WechatPayConfig = {
mchId: string;
publicKeyFilePath: string;
privateKeyFilePath: string;
lossRatio: number; // 损耗比例,百分数
};
export type AccountPayChannel = 'ACCOUNT';
export type AccountPayConfig = {
channel: AccountPayChannel;
depositLoss: boolean;
depositLossRatio?: number; // 充值损耗额度,百分数,不设置则按充值途径的损耗扣
};
export type OfflinePayChannel = 'OFFLINE';