From 2dd04c7ceffcf9800432c4c7d3678a302038c0a5 Mon Sep 17 00:00:00 2001 From: Xc Date: Fri, 17 May 2024 15:54:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E9=85=8D=E7=BD=AE=E4=B8=AD?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=85=85=E5=80=BC=E6=89=A3=E6=AC=BE?= =?UTF-8?q?=E6=AF=94=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es/components/AbstractComponents.d.ts | 5 +- es/components/account/deposit/index.d.ts | 1 - es/components/account/deposit/index.js | 6 ++- .../account/deposit/locales/zh-CN.json | 4 ++ .../payConfig/upsert/account/index.js | 24 ++++++++-- .../upsert/account/locales/zh-CN.json | 10 +++- .../payConfig/upsert/wechatPay/index.js | 8 +++- .../upsert/wechatPay/locales/zh-CN.json | 6 ++- es/data/i18n.js | 20 ++++++-- es/types/PayConfig.d.ts | 3 ++ lib/data/i18n.js | 20 ++++++-- lib/types/PayConfig.d.ts | 3 ++ src/components/account/deposit/index.ts | 9 ++-- .../account/deposit/locales/zh-CN.json | 4 ++ .../payConfig/upsert/account/index.tsx | 48 +++++++++++++++++-- .../upsert/account/locales/zh-CN.json | 10 +++- src/components/payConfig/upsert/index.tsx | 4 +- .../payConfig/upsert/wechatPay/index.tsx | 19 +++++++- .../upsert/wechatPay/locales/zh-CN.json | 6 ++- src/data/i18n.ts | 20 ++++++-- src/types/PayConfig.ts | 3 ++ 21 files changed, 200 insertions(+), 33 deletions(-) diff --git a/es/components/AbstractComponents.d.ts b/es/components/AbstractComponents.d.ts index ee7121a6..3794714f 100644 --- a/es/components/AbstractComponents.d.ts +++ b/es/components/AbstractComponents.d.ts @@ -48,6 +48,7 @@ declare const ListPro: (props: { size?: "small" | "middle" | "large" | undefined; scroll?: any; locale?: any; + opWidth?: number | undefined; }) => React.ReactElement; declare const Detail: (props: ReactComponentProps | undefined; @@ -56,14 +57,14 @@ declare const Detail: (props: ReactComponentProps; title?: string | undefined; bordered?: boolean | undefined; - layout?: "horizontal" | "vertical" | undefined; + layout?: "vertical" | "horizontal" | undefined; }>) => React.ReactElement; declare const Upsert: (props: ReactComponentProps; entity: T; attributes: OakAbsAttrUpsertDef[]; 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, }; diff --git a/es/components/account/deposit/index.d.ts b/es/components/account/deposit/index.d.ts index b0dd6f93..ef42a4b3 100644 --- a/es/components/account/deposit/index.d.ts +++ b/es/components/account/deposit/index.d.ts @@ -1,5 +1,4 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps void; diff --git a/es/components/account/deposit/index.js b/es/components/account/deposit/index.js index ba0e98b5..759a2a20 100644 --- a/es/components/account/deposit/index.js +++ b/es/components/account/deposit/index.js @@ -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'], diff --git a/es/components/account/deposit/locales/zh-CN.json b/es/components/account/deposit/locales/zh-CN.json index d589130c..6be2f71d 100644 --- a/es/components/account/deposit/locales/zh-CN.json +++ b/es/components/account/deposit/locales/zh-CN.json @@ -3,5 +3,9 @@ "label": { "depPrice": "充值金额", "channel": "充值渠道" + }, + "tips": { + "depositLoss": "线上充值将按照充值渠道的扣款比例扣除相应费用(一般是0.6%),敬请知晓", + "depositLossRatio": "线上充值将按照%{ratio}%的比例扣除相应费用,敬请知晓" } } diff --git a/es/components/payConfig/upsert/account/index.js b/es/components/payConfig/upsert/account/index.js index 2a1e85a8..90f4629a 100644 --- a/es/components/payConfig/upsert/account/index.js +++ b/es/components/payConfig/upsert/account/index.js @@ -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 ; + const { t, config, update } = props; + return (
+ + + { + config.depositLoss = value; + if (value === false) { + config.depositLossRatio = undefined; + } + update(config); + }}/> + + {config.depositLoss && + + { + config.depositLossRatio = value; + update(config); + }}/> + } + ); } diff --git a/es/components/payConfig/upsert/account/locales/zh-CN.json b/es/components/payConfig/upsert/account/locales/zh-CN.json index 2a472ac7..78c9c4e6 100644 --- a/es/components/payConfig/upsert/account/locales/zh-CN.json +++ b/es/components/payConfig/upsert/account/locales/zh-CN.json @@ -1,3 +1,11 @@ { - "tips": "无需配置。开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付等操作" + "tips": "开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付、提现等操作,请了解功能后再使用", + "label": { + "depositLossRatio": "充值损耗比例", + "depositLoss": "充值损耗" + }, + "placeholder": { + "depositLossRatio": "若为空,则默认按收费途径的损耗扣除", + "depositLoss": "开启后用户充值有损耗" + } } diff --git a/es/components/payConfig/upsert/wechatPay/index.js b/es/components/payConfig/upsert/wechatPay/index.js index a5a97be7..645590e3 100644 --- a/es/components/payConfig/upsert/wechatPay/index.js +++ b/es/components/payConfig/upsert/wechatPay/index.js @@ -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 (
@@ -19,6 +19,12 @@ export default function WechatPay(props) { { config.publicKeyFilePath = currentTarget.value; update(config); + }}/> + + + { + config.lossRatio = value; + update(config); }}/>
); diff --git a/es/components/payConfig/upsert/wechatPay/locales/zh-CN.json b/es/components/payConfig/upsert/wechatPay/locales/zh-CN.json index e7810626..68d8aa5c 100644 --- a/es/components/payConfig/upsert/wechatPay/locales/zh-CN.json +++ b/es/components/payConfig/upsert/wechatPay/locales/zh-CN.json @@ -1,10 +1,12 @@ { "label": { "privateKeyFilePath": "私钥文件路径", - "publicKeyFilePath": "公钥文件路径" + "publicKeyFilePath": "公钥文件路径", + "lossRatio": "手续费比例" }, "placeholder": { "privateKeyFilePath": "服务器上存放微信支付帐户私钥文件的路径,注意访问权限", - "publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限" + "publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限", + "lossRatio": "填百分比(0.6就代表千分之六)" } } diff --git a/es/data/i18n.js b/es/data/i18n.js index 5896c2e2..b0ef0a4b 100644 --- a/es/data/i18n.js +++ b/es/data/i18n.js @@ -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就代表千分之六)" } } }, diff --git a/es/types/PayConfig.d.ts b/es/types/PayConfig.d.ts index 5beda3e6..26662847 100644 --- a/es/types/PayConfig.d.ts +++ b/es/types/PayConfig.d.ts @@ -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 = { diff --git a/lib/data/i18n.js b/lib/data/i18n.js index 3bd43efe..15a38f60 100644 --- a/lib/data/i18n.js +++ b/lib/data/i18n.js @@ -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就代表千分之六)" } } }, diff --git a/lib/types/PayConfig.d.ts b/lib/types/PayConfig.d.ts index 5beda3e6..26662847 100644 --- a/lib/types/PayConfig.d.ts +++ b/lib/types/PayConfig.d.ts @@ -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 = { diff --git a/src/components/account/deposit/index.ts b/src/components/account/deposit/index.ts index a3bd96ac..a0c423ca 100644 --- a/src/components/account/deposit/index.ts +++ b/src/components/account/deposit/index.ts @@ -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'], diff --git a/src/components/account/deposit/locales/zh-CN.json b/src/components/account/deposit/locales/zh-CN.json index 50b54731..79c6f17a 100644 --- a/src/components/account/deposit/locales/zh-CN.json +++ b/src/components/account/deposit/locales/zh-CN.json @@ -3,5 +3,9 @@ "label": { "depPrice": "充值金额", "channel": "充值渠道" + }, + "tips": { + "depositLoss": "线上充值将按照充值渠道的扣款比例扣除相应费用(一般是0.6%),敬请知晓", + "depositLossRatio": "线上充值将按照%{ratio}%的比例扣除相应费用,敬请知晓" } } \ No newline at end of file diff --git a/src/components/payConfig/upsert/account/index.tsx b/src/components/payConfig/upsert/account/index.tsx index a6c862c3..a994e05c 100644 --- a/src/components/payConfig/upsert/account/index.tsx +++ b/src/components/payConfig/upsert/account/index.tsx @@ -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 ; + const { t, config, update } = props; + return ( +
+ + + { + config.depositLoss = value; + if (value === false) { + config.depositLossRatio = undefined; + } + update(config); + }} + /> + + {config.depositLoss && + + { + config.depositLossRatio = value as number; + update(config); + }} + /> + } + + ); } \ No newline at end of file diff --git a/src/components/payConfig/upsert/account/locales/zh-CN.json b/src/components/payConfig/upsert/account/locales/zh-CN.json index a1cd4d5c..53f1640b 100644 --- a/src/components/payConfig/upsert/account/locales/zh-CN.json +++ b/src/components/payConfig/upsert/account/locales/zh-CN.json @@ -1,3 +1,11 @@ { - "tips": "无需配置。开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付等操作" + "tips": "开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付、提现等操作,请了解功能后再使用", + "label": { + "depositLossRatio": "充值损耗比例", + "depositLoss": "充值损耗" + }, + "placeholder": { + "depositLossRatio": "若为空,则默认按收费途径的损耗扣除", + "depositLoss": "开启后用户充值有损耗" + } } \ No newline at end of file diff --git a/src/components/payConfig/upsert/index.tsx b/src/components/payConfig/upsert/index.tsx index 4bbd2ced..4c3fe70d 100644 --- a/src/components/payConfig/upsert/index.tsx +++ b/src/components/payConfig/upsert/index.tsx @@ -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); }} diff --git a/src/components/payConfig/upsert/wechatPay/index.tsx b/src/components/payConfig/upsert/wechatPay/index.tsx index 2c7a2108..0237264b 100644 --- a/src/components/payConfig/upsert/wechatPay/index.tsx +++ b/src/components/payConfig/upsert/wechatPay/index.tsx @@ -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: { }} /> + + { + config.lossRatio = value as number; + update(config); + }} + /> + ); } \ No newline at end of file diff --git a/src/components/payConfig/upsert/wechatPay/locales/zh-CN.json b/src/components/payConfig/upsert/wechatPay/locales/zh-CN.json index 52da8f94..830d2c4b 100644 --- a/src/components/payConfig/upsert/wechatPay/locales/zh-CN.json +++ b/src/components/payConfig/upsert/wechatPay/locales/zh-CN.json @@ -1,10 +1,12 @@ { "label": { "privateKeyFilePath": "私钥文件路径", - "publicKeyFilePath": "公钥文件路径" + "publicKeyFilePath": "公钥文件路径", + "lossRatio": "手续费比例" }, "placeholder": { "privateKeyFilePath": "服务器上存放微信支付帐户私钥文件的路径,注意访问权限", - "publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限" + "publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限", + "lossRatio": "填百分比(0.6就代表千分之六)" } } \ No newline at end of file diff --git a/src/data/i18n.ts b/src/data/i18n.ts index 41fee7a8..0a3c1dc0 100644 --- a/src/data/i18n.ts +++ b/src/data/i18n.ts @@ -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就代表千分之六)" } } }, diff --git a/src/types/PayConfig.ts b/src/types/PayConfig.ts index 98bd6760..3df9f9c5 100644 --- a/src/types/PayConfig.ts +++ b/src/types/PayConfig.ts @@ -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';