From bd03f9bd67d7acacc5df8b9618cd05ac64b25f40 Mon Sep 17 00:00:00 2001 From: Xc Date: Wed, 26 Jun 2024 20:04:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=AE=9E=E7=8E=B0=E4=BA=86sy?= =?UTF-8?q?sAccountMove?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es/checkers/offlineAccount.js | 5 +- es/components/offlineAccount/upsert/web.pc.js | 2 +- es/components/sysAccount/survey/web.pc.js | 9 +- .../sysAccount/transferList/index.d.ts | 3 + .../sysAccount/transferList/index.js | 52 ++++++ .../sysAccount/transferList/index.json | 1 + .../transferList/locales/zh-CN.json | 6 + .../sysAccount/transferList/web.pc.d.ts | 14 ++ .../sysAccount/transferList/web.pc.js | 45 +++++ .../withdrawTransfer/list/locales/zh-CN.json | 2 +- es/data/i18n.js | 18 +- es/locales/offlineAccount/zh-CN.json | 3 +- lib/checkers/offlineAccount.js | 5 +- lib/data/i18n.js | 18 +- lib/locales/offlineAccount/zh-CN.json | 3 +- src/checkers/offlineAccount.ts | 5 +- .../offlineAccount/upsert/web.pc.tsx | 1 + .../sysAccount/survey/locales/zh-CN.json | 3 +- src/components/sysAccount/survey/web.pc.tsx | 49 ++++- .../sysAccount/transferList/index.json | 1 + .../sysAccount/transferList/index.ts | 54 ++++++ .../transferList/locales/zh-CN.json | 6 + .../sysAccount/transferList/web.pc.tsx | 72 ++++++++ .../sysAccountMove/create/index.json | 1 + src/components/sysAccountMove/create/index.ts | 172 ++++++++++++++++++ .../sysAccountMove/create/locales/zh-CN.json | 6 + .../sysAccountMove/create/web.pc.tsx | 169 +++++++++++++++++ .../withdrawTransfer/list/locales/zh-CN.json | 2 +- src/components/wpAccount/upsert/web.pc.tsx | 2 +- src/data/i18n.ts | 34 +++- src/entities/SysAccountMove.ts | 39 ++++ src/entities/SysAccountOper.ts | 3 + src/locales/offlineAccount/zh-CN.json | 3 +- 33 files changed, 785 insertions(+), 23 deletions(-) create mode 100644 es/components/sysAccount/transferList/index.d.ts create mode 100644 es/components/sysAccount/transferList/index.js create mode 100644 es/components/sysAccount/transferList/index.json create mode 100644 es/components/sysAccount/transferList/locales/zh-CN.json create mode 100644 es/components/sysAccount/transferList/web.pc.d.ts create mode 100644 es/components/sysAccount/transferList/web.pc.js create mode 100644 src/components/sysAccount/transferList/index.json create mode 100644 src/components/sysAccount/transferList/index.ts create mode 100644 src/components/sysAccount/transferList/locales/zh-CN.json create mode 100644 src/components/sysAccount/transferList/web.pc.tsx create mode 100644 src/components/sysAccountMove/create/index.json create mode 100644 src/components/sysAccountMove/create/index.ts create mode 100644 src/components/sysAccountMove/create/locales/zh-CN.json create mode 100644 src/components/sysAccountMove/create/web.pc.tsx create mode 100644 src/entities/SysAccountMove.ts diff --git a/es/checkers/offlineAccount.js b/es/checkers/offlineAccount.js index dc10df25..3ec31547 100644 --- a/es/checkers/offlineAccount.js +++ b/es/checkers/offlineAccount.js @@ -27,13 +27,16 @@ function checkAttributes(data) { } } } - const { refundCompensateRatio, refundGapDays } = data; + const { refundCompensateRatio, refundGapDays, withdrawTransferLossRatio } = data; if (typeof refundGapDays !== 'number' || refundGapDays < 0) { throw new OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundGapDaysNotNegative'); } if (typeof refundCompensateRatio !== 'number' || refundCompensateRatio < 0 || refundCompensateRatio > 100) { throw new OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundCompensateIllegal'); } + if (typeof withdrawTransferLossRatio !== 'number' || withdrawTransferLossRatio < 0) { + throw new OakInputIllegalException('offlineAccount', ['withdrawTransferLossRatio'], 'offlineAccount::error.withdrawTransferLossRatioNotNegative'); + } } const checkers = [ { diff --git a/es/components/offlineAccount/upsert/web.pc.js b/es/components/offlineAccount/upsert/web.pc.js index 8ef0feb5..bae900c2 100644 --- a/es/components/offlineAccount/upsert/web.pc.js +++ b/es/components/offlineAccount/upsert/web.pc.js @@ -74,7 +74,7 @@ export default function render(props) { update({ allowWithdrawTransfer }); }}/> - + { const withdrawTransferLossRatio = value; update({ withdrawTransferLossRatio }); diff --git a/es/components/sysAccount/survey/web.pc.js b/es/components/sysAccount/survey/web.pc.js index 37ef8cc7..91629cdb 100644 --- a/es/components/sysAccount/survey/web.pc.js +++ b/es/components/sysAccount/survey/web.pc.js @@ -1,10 +1,11 @@ -import React from 'react'; +import React, { useState } from 'react'; import { Descriptions, Tag, Modal, Flex, Button, Divider, Alert } from 'antd'; import { AlipayOutlined, WechatOutlined } from '@ant-design/icons'; import Styles from './web.pc.module.less'; import { ThousandCont, ToYuan } from "oak-domain/lib/utils/money"; import { OfflineAccount as OADetail } from '../../offlineAccount/config/web.pc'; import { WpAccount as WADetail } from '../../wpAccount/config/web.pc'; +import TransferList from '../transferList'; function OfflineAccount(props) { const { data, t } = props; const { type, channel, color, name } = data; @@ -65,6 +66,7 @@ export default function render(props) { const { accounts, total, systemId, accountNum, accountTotalSum, accountAvailSum, refundCnt, refundPriceSum, transferCnt, transferPriceSum, orderCnt, orderPaidSum, orderRefundSum, } = props.data; const { t, setMessage } = props.methods; if (accounts && systemId) { + const [showTransferList, setShowTransferList] = useState(false); return (
{t('common::pay.symbol')} {ThousandCont(ToYuan(transferPriceSum || 0), 2)} - + setShowTransferList(false)} footer={null} closeIcon={null} width={800}> + +
) }, { diff --git a/es/components/sysAccount/transferList/index.d.ts b/es/components/sysAccount/transferList/index.d.ts new file mode 100644 index 00000000..a0335de1 --- /dev/null +++ b/es/components/sysAccount/transferList/index.d.ts @@ -0,0 +1,3 @@ +/// +declare const _default: (props: import("oak-frontend-base").ReactComponentProps) => React.ReactElement; +export default _default; diff --git a/es/components/sysAccount/transferList/index.js b/es/components/sysAccount/transferList/index.js new file mode 100644 index 00000000..476277f3 --- /dev/null +++ b/es/components/sysAccount/transferList/index.js @@ -0,0 +1,52 @@ +export default OakComponent({ + entity: 'withdrawTransfer', + isList: true, + projection: { + id: 1, + price: 1, + loss: 1, + externalId: 1, + iState: 1, + withdrawAccount: { + org: 1, + name: 1, + code: 1, + channel: { + entity: 1, + entityId: 1, + offlineAccount: { + id: 1, + type: 1, + } + }, + id: 1, + } + }, + filters: [ + { + filter() { + const systemId = this.features.application.getApplication().systemId; + return { + withdrawAccount: { + ofSystemId: systemId, + }, + iState: 'transferring', + }; + } + } + ], + formData({ data }) { + return { + transfers: data?.map((ele) => { + const { withdrawAccount, ...rest } = ele; + const { entity, offlineAccount } = withdrawAccount.channel; + const channel = entity === 'offlineAccount' ? this.t(`withdraw::channel.offlineAccount.${offlineAccount?.type}`) : this.t(`withdraw::channel.${entity}`); + return { + ...rest, + withdrawAccount, + channel, + }; + }), + }; + }, +}); diff --git a/es/components/sysAccount/transferList/index.json b/es/components/sysAccount/transferList/index.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/es/components/sysAccount/transferList/index.json @@ -0,0 +1 @@ +{} diff --git a/es/components/sysAccount/transferList/locales/zh-CN.json b/es/components/sysAccount/transferList/locales/zh-CN.json new file mode 100644 index 00000000..b2691130 --- /dev/null +++ b/es/components/sysAccount/transferList/locales/zh-CN.json @@ -0,0 +1,6 @@ +{ + "label": { + "channel": "转账渠道" + }, + "tips": "正在转账的金额不计入任何账户,请到\"提现转账管理\"菜单完成操作" +} diff --git a/es/components/sysAccount/transferList/web.pc.d.ts b/es/components/sysAccount/transferList/web.pc.d.ts new file mode 100644 index 00000000..5b8ebd2a --- /dev/null +++ b/es/components/sysAccount/transferList/web.pc.d.ts @@ -0,0 +1,14 @@ +import React from 'react'; +import { RowWithActions, WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../oak-app-domain'; +export default function Render(props: WebComponentProps & { + creatorName: string; + creatorMobile: string; + operatorName: string; + operatorMobile: string; + channel: string; + })[]; +}, { + setUpdateId: (id: string, action: string) => void; +}>): React.JSX.Element; diff --git a/es/components/sysAccount/transferList/web.pc.js b/es/components/sysAccount/transferList/web.pc.js new file mode 100644 index 00000000..221e7d3c --- /dev/null +++ b/es/components/sysAccount/transferList/web.pc.js @@ -0,0 +1,45 @@ +import React from 'react'; +import { Result, Alert } from 'antd'; +import ListPro from 'oak-frontend-base/es/components/listPro'; +import { ThousandCont, ToYuan } from 'oak-domain/lib/utils/money'; +export default function Render(props) { + const { transfers, oakFullpath, oakExecutable } = props.data; + const { t, updateItem, execute, clean, setMessage, setUpdateId } = props.methods; + if (transfers?.length) { + return (} attributes={[ + { + path: 'price', + label: t('withdrawTransfer:attr.price'), + width: 100, + render: (row) => { + return `${t('common::pay.symbol')} ${ThousandCont(ToYuan(row.price), 2)}`; + } + }, + { + path: 'loss', + label: t('withdrawTransfer:attr.loss'), + width: 100, + render: (row) => { + return `${t('common::pay.symbol')} ${ThousandCont(ToYuan(row.loss), 2)}`; + } + }, + { + path: '$$createAt$$', + label: t('common::$$createAt$$'), + width: 100, + }, + { + path: 'channel', + label: t('label.channel'), + type: 'string', + width: 100, + }, + { + path: 'externalId', + label: t('withdrawTransfer:attr.externalId'), + width: 120, + }, + ]} disabledOp={true}/>); + } + return (); +} diff --git a/es/components/withdrawTransfer/list/locales/zh-CN.json b/es/components/withdrawTransfer/list/locales/zh-CN.json index 81df3ff6..9acbd60a 100644 --- a/es/components/withdrawTransfer/list/locales/zh-CN.json +++ b/es/components/withdrawTransfer/list/locales/zh-CN.json @@ -1,6 +1,6 @@ { "label": { - "channel": "提现渠道", + "channel": "转账渠道", "transferActualPrice": "实际转账金额", "sysAccountAmount": "系统账户余额", "cn": "创建者", diff --git a/es/data/i18n.js b/es/data/i18n.js index 07753e27..3c334d41 100644 --- a/es/data/i18n.js +++ b/es/data/i18n.js @@ -409,6 +409,19 @@ const i18ns = [ "tips1": "总账户余额+退款总额+转账总额+订单总额应该等于系统账户总余额" } }, + { + id: "207fd2189d3697d15672176ae88f4175", + namespace: "oak-pay-business-c-sysAccount-transferList", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/sysAccount/transferList", + data: { + "label": { + "channel": "转账渠道" + }, + "tips": "正在转账的金额不计入任何账户,请到\"提现转账管理\"菜单完成操作" + } + }, { id: "79255be8c093dfef9765b3f367cab553", namespace: "oak-pay-business-c-wechatPay-upsert", @@ -583,7 +596,7 @@ const i18ns = [ position: "src/components/withdrawTransfer/list", data: { "label": { - "channel": "提现渠道", + "channel": "转账渠道", "transferActualPrice": "实际转账金额", "sysAccountAmount": "系统账户余额", "cn": "创建者", @@ -786,7 +799,8 @@ const i18ns = [ "error": { "nameQrCodeBothNull": "账号名和二维码不能同时为空", "refundGapDaysNotNegative": "允许退款天数不能为负数或空", - "refundCompensateIllegal": "退款补偿百分比必须在0到100之间" + "refundCompensateIllegal": "退款补偿百分比必须在0到100之间", + "withdrawTransferLossRatioNotNegative": "提现转账费率必须在0到100之间" } } }, diff --git a/es/locales/offlineAccount/zh-CN.json b/es/locales/offlineAccount/zh-CN.json index 501b73d9..9a3d7126 100644 --- a/es/locales/offlineAccount/zh-CN.json +++ b/es/locales/offlineAccount/zh-CN.json @@ -22,6 +22,7 @@ "error": { "nameQrCodeBothNull": "账号名和二维码不能同时为空", "refundGapDaysNotNegative": "允许退款天数不能为负数或空", - "refundCompensateIllegal": "退款补偿百分比必须在0到100之间" + "refundCompensateIllegal": "退款补偿百分比必须在0到100之间", + "withdrawTransferLossRatioNotNegative": "提现转账费率必须在0到100之间" } } diff --git a/lib/checkers/offlineAccount.js b/lib/checkers/offlineAccount.js index 0ad9bb9c..fc62f7ef 100644 --- a/lib/checkers/offlineAccount.js +++ b/lib/checkers/offlineAccount.js @@ -30,13 +30,16 @@ function checkAttributes(data) { } } } - const { refundCompensateRatio, refundGapDays } = data; + const { refundCompensateRatio, refundGapDays, withdrawTransferLossRatio } = data; if (typeof refundGapDays !== 'number' || refundGapDays < 0) { throw new types_1.OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundGapDaysNotNegative'); } if (typeof refundCompensateRatio !== 'number' || refundCompensateRatio < 0 || refundCompensateRatio > 100) { throw new types_1.OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundCompensateIllegal'); } + if (typeof withdrawTransferLossRatio !== 'number' || withdrawTransferLossRatio < 0) { + throw new types_1.OakInputIllegalException('offlineAccount', ['withdrawTransferLossRatio'], 'offlineAccount::error.withdrawTransferLossRatioNotNegative'); + } } const checkers = [ { diff --git a/lib/data/i18n.js b/lib/data/i18n.js index 2102d961..d599a98d 100644 --- a/lib/data/i18n.js +++ b/lib/data/i18n.js @@ -411,6 +411,19 @@ const i18ns = [ "tips1": "总账户余额+退款总额+转账总额+订单总额应该等于系统账户总余额" } }, + { + id: "207fd2189d3697d15672176ae88f4175", + namespace: "oak-pay-business-c-sysAccount-transferList", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/sysAccount/transferList", + data: { + "label": { + "channel": "转账渠道" + }, + "tips": "正在转账的金额不计入任何账户,请到\"提现转账管理\"菜单完成操作" + } + }, { id: "79255be8c093dfef9765b3f367cab553", namespace: "oak-pay-business-c-wechatPay-upsert", @@ -585,7 +598,7 @@ const i18ns = [ position: "src/components/withdrawTransfer/list", data: { "label": { - "channel": "提现渠道", + "channel": "转账渠道", "transferActualPrice": "实际转账金额", "sysAccountAmount": "系统账户余额", "cn": "创建者", @@ -788,7 +801,8 @@ const i18ns = [ "error": { "nameQrCodeBothNull": "账号名和二维码不能同时为空", "refundGapDaysNotNegative": "允许退款天数不能为负数或空", - "refundCompensateIllegal": "退款补偿百分比必须在0到100之间" + "refundCompensateIllegal": "退款补偿百分比必须在0到100之间", + "withdrawTransferLossRatioNotNegative": "提现转账费率必须在0到100之间" } } }, diff --git a/lib/locales/offlineAccount/zh-CN.json b/lib/locales/offlineAccount/zh-CN.json index 501b73d9..9a3d7126 100644 --- a/lib/locales/offlineAccount/zh-CN.json +++ b/lib/locales/offlineAccount/zh-CN.json @@ -22,6 +22,7 @@ "error": { "nameQrCodeBothNull": "账号名和二维码不能同时为空", "refundGapDaysNotNegative": "允许退款天数不能为负数或空", - "refundCompensateIllegal": "退款补偿百分比必须在0到100之间" + "refundCompensateIllegal": "退款补偿百分比必须在0到100之间", + "withdrawTransferLossRatioNotNegative": "提现转账费率必须在0到100之间" } } diff --git a/src/checkers/offlineAccount.ts b/src/checkers/offlineAccount.ts index ed89643d..1351ae9e 100644 --- a/src/checkers/offlineAccount.ts +++ b/src/checkers/offlineAccount.ts @@ -33,13 +33,16 @@ function checkAttributes(data: EntityDict['offlineAccount']['CreateSingle']['dat } } - const { refundCompensateRatio, refundGapDays } = data; + const { refundCompensateRatio, refundGapDays, withdrawTransferLossRatio } = data; if (typeof refundGapDays !== 'number' || refundGapDays < 0) { throw new OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundGapDaysNotNegative'); } if (typeof refundCompensateRatio !== 'number' || refundCompensateRatio < 0 || refundCompensateRatio > 100) { throw new OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundCompensateIllegal'); } + if (typeof withdrawTransferLossRatio !== 'number' || withdrawTransferLossRatio < 0) { + throw new OakInputIllegalException('offlineAccount', ['withdrawTransferLossRatio'], 'offlineAccount::error.withdrawTransferLossRatioNotNegative'); + } } const checkers: Checker[] = [ diff --git a/src/components/offlineAccount/upsert/web.pc.tsx b/src/components/offlineAccount/upsert/web.pc.tsx index c510d0c3..376465df 100644 --- a/src/components/offlineAccount/upsert/web.pc.tsx +++ b/src/components/offlineAccount/upsert/web.pc.tsx @@ -176,6 +176,7 @@ export default function render(props: WebComponentProps + + setShowMoveCreate(false)} + closeIcon={null} + width={800} + title={t('move')} + footer={null} + > + setShowMoveCreate(false)} + /> + + + } />
{ @@ -243,7 +273,7 @@ export default function render(props: WebComponentProps} + extra={} items={[ { label: t('accountTotalSum'), @@ -295,9 +325,22 @@ export default function render(props: WebComponentProps{t('common::pay.symbol')} {ThousandCont(ToYuan(transferPriceSum || 0), 2)} - + setShowTransferList(false)} + footer={null} + closeIcon={null} + width={800} + > + +
) }, diff --git a/src/components/sysAccount/transferList/index.json b/src/components/sysAccount/transferList/index.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/src/components/sysAccount/transferList/index.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/components/sysAccount/transferList/index.ts b/src/components/sysAccount/transferList/index.ts new file mode 100644 index 00000000..b1034794 --- /dev/null +++ b/src/components/sysAccount/transferList/index.ts @@ -0,0 +1,54 @@ +export default OakComponent({ + entity: 'withdrawTransfer', + isList: true, + projection: { + id: 1, + price: 1, + loss: 1, + externalId: 1, + iState: 1, + withdrawAccount: { + org: 1, + name: 1, + code: 1, + channel: { + entity: 1, + entityId: 1, + offlineAccount: { + id: 1, + type: 1, + } + }, + id: 1, + } + }, + filters: [ + { + filter() { + const systemId = this.features.application.getApplication()!.systemId; + return { + withdrawAccount: { + ofSystemId: systemId, + }, + iState: 'transferring', + }; + } + } + ], + formData({ data }) { + return { + transfers: data?.map( + (ele) => { + const { withdrawAccount, ...rest } = ele; + const { entity, offlineAccount } = withdrawAccount!.channel!; + const channel = entity === 'offlineAccount' ? this.t(`withdraw::channel.offlineAccount.${offlineAccount?.type}`) : this.t(`withdraw::channel.${entity}`); + return { + ...rest, + withdrawAccount, + channel, + }; + } + ), + }; + }, +}); \ No newline at end of file diff --git a/src/components/sysAccount/transferList/locales/zh-CN.json b/src/components/sysAccount/transferList/locales/zh-CN.json new file mode 100644 index 00000000..9e0503b1 --- /dev/null +++ b/src/components/sysAccount/transferList/locales/zh-CN.json @@ -0,0 +1,6 @@ +{ + "label": { + "channel": "转账渠道" + }, + "tips": "正在转账的金额不计入任何账户,请到\"提现转账管理\"菜单完成操作" +} \ No newline at end of file diff --git a/src/components/sysAccount/transferList/web.pc.tsx b/src/components/sysAccount/transferList/web.pc.tsx new file mode 100644 index 00000000..5705788b --- /dev/null +++ b/src/components/sysAccount/transferList/web.pc.tsx @@ -0,0 +1,72 @@ +import React, { useState } from 'react'; +import { Result, Alert } from 'antd'; +import { RowWithActions, WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../oak-app-domain'; +import ListPro from 'oak-frontend-base/es/components/listPro'; +import { ThousandCont, ToYuan } from 'oak-domain/lib/utils/money'; + +export default function Render(props: WebComponentProps & { + creatorName: string; + creatorMobile: string; + operatorName: string; + operatorMobile: string; + channel: string; + })[]; +}>) { + const { transfers, oakFullpath, oakExecutable } = props.data; + const { t } = props.methods; + + if (transfers?.length) { + return ( + + } + attributes={[ + { + path: 'price', + label: t('withdrawTransfer:attr.price'), + width: 100, + render: (row) => { + return `${t('common::pay.symbol')} ${ThousandCont(ToYuan(row!.price), 2)}` + } + }, + { + path: 'loss', + label: t('withdrawTransfer:attr.loss'), + width: 100, + render: (row) => { + return `${t('common::pay.symbol')} ${ThousandCont(ToYuan(row!.loss), 2)}` + } + }, + { + path: '$$createAt$$', + label: t('common::$$createAt$$'), + width: 100, + }, + { + path: 'channel', + label: t('label.channel'), + type: 'string', + width: 100, + }, + { + path: 'externalId', + label: t('withdrawTransfer:attr.externalId'), + width: 120, + }, + ]} + disabledOp={true} + /> + ) + } + return ( + + ); +} \ No newline at end of file diff --git a/src/components/sysAccountMove/create/index.json b/src/components/sysAccountMove/create/index.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/src/components/sysAccountMove/create/index.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/components/sysAccountMove/create/index.ts b/src/components/sysAccountMove/create/index.ts new file mode 100644 index 00000000..12e8f043 --- /dev/null +++ b/src/components/sysAccountMove/create/index.ts @@ -0,0 +1,172 @@ +import { uniq } from "oak-domain/lib/utils/lodash"; +import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid'; +import { ThousandCont, ToCent, ToYuan } from 'oak-domain/lib/utils/money'; +import { EntityDict } from "../../../oak-app-domain"; + +export default OakComponent({ + properties: { + systemId: '', + entities: [] as string[], + onSuccess: (id: string) => undefined as void, + }, + data: { + accounts: [] as Array<{ + id: string; + entity: string; + price: number; + priceStr: string; + label: string; + name?: string; + }>, + fromEntity: '', + fromEntityId: '', + toEntity: '', + toEntityId: '', + price: 0, + externalId: '', + remark: '', + max: 0, + }, + lifetimes: { + ready() { + this.refreshSysAccount(); + } + }, + methods: { + async refreshSysAccount() { + const { entities, systemId } = this.props; + + + const accounts2 = await Promise.all( + uniq(['wpAccount', 'offlineAccount'].concat(entities || [])).map( + async (entity) => { + const { data: rows } = await this.features.cache.refresh(entity as 'offlineAccount', { + data: entity === 'offlineAccount' ? { + id: 1, + price: 1, + name: 1, + type: 1, + channel: 1, + } : { + id: 1, + price: 1, + }, + filter: { + systemId, + } + }); + + const accounts = rows.map( + (row) => { + const { id, price, name, type, channel } = row; + return { + id: id!, + entity: entity!, + priceStr: ThousandCont(ToYuan(price!))!, + price: price!, + label: entity === 'offlineAccount' ? `${this.t(`${entity}:name`)}-${this.t(`offlineAccount:v.type.${type}`)}` : this.t(`${entity}:name`), + name: name || undefined, + }; + } + ); + return accounts; + } + ) + ); + + this.setState({ + accounts: accounts2.flat(), + }); + }, + setFromId(id: string) { + const { accounts } = this.state; + const account = accounts!.find( + ele => ele.id === id + ); + + this.setState({ + fromEntity: account!.entity, + fromEntityId: account!.id, + max: ToYuan(account!.price!), + }); + }, + setToId(id: string) { + const { accounts } = this.state; + const account = accounts!.find( + ele => ele.id === id + ); + + this.setState({ + toEntity: account!.entity, + toEntityId: account!.id, + }); + }, + setPrice(price: number) { + this.setState({ + price, + }); + }, + setExternalId(externalId: string) { + this.setState({ + externalId, + }); + }, + setRemark(remark: string) { + this.setState({ + remark, + }); + }, + async createMove() { + const { fromEntity, fromEntityId, toEntity, toEntityId, price, remark, externalId} = this.state; + const userId = this.features.token.getUserId(); + const systemId = this.features.application.getApplication()!.systemId; + + const id = await generateNewIdAsync(); + const price2 = ToCent(price); + const { onSuccess } = this.props; + await this.execute(undefined, undefined, undefined, [ + { + entity: 'sysAccountMove', + operation: { + id: await generateNewIdAsync(), + action: 'create', + data: { + id, + price: price2, + externalId, + remark, + systemId, + operatorId: userId, + sysAccountOper$sysAccountMove: [ + { + id: await generateNewIdAsync(), + action: 'create', + data: { + id: await generateNewIdAsync(), + entity: fromEntity, + entityId: fromEntityId, + delta: -price2, + type: 'moveOut', + }, + }, + { + id: await generateNewIdAsync(), + action: 'create', + data: { + id: await generateNewIdAsync(), + entity: toEntity, + entityId: toEntityId, + delta: price2, + type: 'moveIn', + }, + }, + ] + } + } as EntityDict['sysAccountMove']['CreateSingle'], + } + ]); + + onSuccess && onSuccess(id); + } + } +}); diff --git a/src/components/sysAccountMove/create/locales/zh-CN.json b/src/components/sysAccountMove/create/locales/zh-CN.json new file mode 100644 index 00000000..772406c0 --- /dev/null +++ b/src/components/sysAccountMove/create/locales/zh-CN.json @@ -0,0 +1,6 @@ +{ + "label": { + "from": "从账户", + "to": "到账户" + } +} \ No newline at end of file diff --git a/src/components/sysAccountMove/create/web.pc.tsx b/src/components/sysAccountMove/create/web.pc.tsx new file mode 100644 index 00000000..d16d6a16 --- /dev/null +++ b/src/components/sysAccountMove/create/web.pc.tsx @@ -0,0 +1,169 @@ +import React, { useState } from 'react'; +import { Button, Alert, Form, Input, InputNumber, Radio, Space, Flex } from 'antd'; +import { RowWithActions, WebComponentProps } from 'oak-frontend-base'; +import { EntityDict } from '../../../oak-app-domain'; +import ListPro from 'oak-frontend-base/es/components/listPro'; +import { ThousandCont, ToYuan } from 'oak-domain/lib/utils/money'; + +export default function Render(props: WebComponentProps; +}, { + setFromId: (id: string) => void; + setToId: (id: string) => void; + setPrice: (price: number) => void; + setExternalId: (externalId: string) => void; + setRemark: (remark: string) => void; + createMove: () => Promise; +}>) { + const { price, externalId, max, remark, fromEntityId, toEntityId, accounts } = props.data; + const { t, setFromId, setToId, setPrice, setExternalId, setRemark, createMove } = props.methods; + + if (accounts.length) { + return ( + <> +
+ + { + setFromId(target.value); + }} value={fromEntityId}> + + { + accounts.filter( + ele => ele.price > 0 + ).map( + ele => { + const { id, label, price, priceStr } = ele; + return ( + + {`${label}: ${t('common::pay.symbol')}${priceStr}`} + + ); + } + ) + } + + + + { + fromEntityId && + { + setToId(target.value); + }} value={toEntityId}> + + { + accounts.filter( + ele => ele.id !== fromEntityId + ).map( + ele => { + const { id, label, price, priceStr } = ele; + return ( + + {`${label}: ${t('common::pay.symbol')}${priceStr}`} + + ); + } + ) + } + + + + } + { + fromEntityId && toEntityId && + { + const price = value as number; + setPrice(price) + }} + /> + + } + { + fromEntityId && toEntityId && + { + const externalId = currentTarget.value; + setExternalId(externalId); + }} + maxLength={64} + /> + + } + { + fromEntityId && toEntityId && + { + const remark = currentTarget.value; + setRemark(remark); + }} + rows={4} + /> + + } +
+ + + + + ); + } + + return null; +} \ No newline at end of file diff --git a/src/components/withdrawTransfer/list/locales/zh-CN.json b/src/components/withdrawTransfer/list/locales/zh-CN.json index 84ff04c8..331a2460 100644 --- a/src/components/withdrawTransfer/list/locales/zh-CN.json +++ b/src/components/withdrawTransfer/list/locales/zh-CN.json @@ -1,6 +1,6 @@ { "label": { - "channel": "提现渠道", + "channel": "转账渠道", "transferActualPrice": "实际转账金额", "sysAccountAmount": "系统账户余额", "cn": "创建者", diff --git a/src/components/wpAccount/upsert/web.pc.tsx b/src/components/wpAccount/upsert/web.pc.tsx index fee21932..ad57343a 100644 --- a/src/components/wpAccount/upsert/web.pc.tsx +++ b/src/components/wpAccount/upsert/web.pc.tsx @@ -27,7 +27,7 @@ export default function render(props: WebComponentProps} - {(wpAccount.wechatPayId && wechatPay?.$$createAt$$ !== 1) && ; + operator: User; + remark?: Text; + system: System; +}; + + +export const entityDesc: EntityDesc = { + locales: { + zh_CN: { + name: '系统资金移动', + attr: { + price: '金额', + externalId: '外部流水号', + operator: '操作者', + remark: '备注', + system: '所属系统' + }, + }, + }, + configuration: { + actionType: 'appendOnly', + } +} \ No newline at end of file diff --git a/src/entities/SysAccountOper.ts b/src/entities/SysAccountOper.ts index 1d090b32..5b237e3d 100644 --- a/src/entities/SysAccountOper.ts +++ b/src/entities/SysAccountOper.ts @@ -11,6 +11,7 @@ import { EntityDesc, ActionDef } from 'oak-domain/lib/types'; import { Schema as Pay } from './Pay'; import { Schema as Refund } from './Refund'; import { Schema as WithdrawTransfer } from './WithdrawTransfer'; +import { Schema as SysAccountMove} from './SysAccountMove'; export interface Schema extends EntityShape { delta: Price; @@ -20,6 +21,7 @@ export interface Schema extends EntityShape { pay?: Pay; refund?: Refund; withdrawTransfer?: WithdrawTransfer; + sysAccountMove?: SysAccountMove; }; export const entityDesc: EntityDesc