From 507c43d87fe811c89fbeb9e459a5a06d44736de4 Mon Sep 17 00:00:00 2001 From: Xc Date: Thu, 30 May 2024 13:21:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E7=8E=B0=E4=B8=AD=E7=9A=84=E5=90=84?= =?UTF-8?q?=E7=A7=8D=E7=BB=86=E8=8A=82=E5=92=8C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es/components/withdraw/detail/index.js | 9 +-- es/components/withdraw/detail/web.d.ts | 2 +- es/components/withdraw/detail/web.js | 4 +- es/components/withdraw/detail/web.pc.d.ts | 2 +- es/components/withdraw/detail/web.pc.js | 4 +- es/components/withdraw/dry/Detail.mobile.d.ts | 4 +- es/components/withdraw/dry/Detail.mobile.js | 62 ++++++++-------- es/components/withdraw/dry/Detail.module.less | 7 +- es/components/withdraw/dry/Detail.pc.d.ts | 4 +- es/components/withdraw/dry/Detail.pc.js | 59 +++++++++------- .../withdraw/dry/Detail.pc.module.less | 13 ++-- es/components/withdraw/dry/locales/zh-CN.json | 12 ++-- es/configuration/attrUpdateMatrix.js | 14 ++++ es/data/i18n.js | 12 ++-- es/triggers/refund.js | 5 +- es/triggers/withdraw.js | 4 ++ .../payClazz/WechatPay/WechatPay.debug.js | 10 +-- lib/configuration/attrUpdateMatrix.js | 14 ++++ lib/data/i18n.js | 12 ++-- lib/triggers/refund.js | 5 +- lib/triggers/withdraw.js | 4 ++ .../payClazz/WechatPay/WechatPay.debug.js | 10 +-- src/components/withdraw/detail/index.ts | 10 +-- src/components/withdraw/detail/web.pc.tsx | 6 +- src/components/withdraw/detail/web.tsx | 6 +- src/components/withdraw/dry/Detail.mobile.tsx | 70 ++++++++++--------- .../withdraw/dry/Detail.module.less | 7 +- .../withdraw/dry/Detail.pc.module.less | 13 ++-- src/components/withdraw/dry/Detail.pc.tsx | 63 ++++++++++------- .../withdraw/dry/locales/zh-CN.json | 12 ++-- src/configuration/attrUpdateMatrix.ts | 14 ++++ src/data/i18n.ts | 12 ++-- src/triggers/refund.ts | 5 +- src/triggers/withdraw.ts | 4 ++ .../payClazz/WechatPay/WechatPay.debug.ts | 10 +-- 35 files changed, 308 insertions(+), 196 deletions(-) diff --git a/es/components/withdraw/detail/index.js b/es/components/withdraw/detail/index.js index 69ef5713..ae831a93 100644 --- a/es/components/withdraw/detail/index.js +++ b/es/components/withdraw/detail/index.js @@ -42,18 +42,19 @@ export default OakComponent({ priceYuan: ThousandCont(ToYuan(price), 2), lossYuan: ThousandCont(ToYuan(loss), 2), finalYuan: ThousandCont(ToYuan(price - loss), 2), - successAt: iState === 'refunded' && dayJs($$updateAt$$).format('YYYY-MM-DD HH:mm'), + updateAt: dayJs($$updateAt$$).format('YYYY-MM-DD HH:mm'), reason, }; }); - const withdrawExactPrice = ThousandCont(ToYuan(data ? data.price - data.loss : 0), 2); + const withdrawExactPrice = data ? ['successful', 'partiallySuccessful', 'failed'].includes(data.iState) ? data.dealPrice - data.dealLoss : data.price - data.loss : 0; return { createAtStr: data && dayJs(data.$$createAt$$).format('YYYY-MM-DD HH:mm'), - withdrawExactPrice, + withdrawExactPrice: ThousandCont(ToYuan(withdrawExactPrice), 2), refundData, withdrawMethod: refundData && refundData.length ? 'refund' : undefined, step: data?.iState === 'withdrawing' ? 1 : 2, - failed: data?.iState === 'failed', + // failed: data?.iState === 'failed', + iState: data?.iState, }; } }); diff --git a/es/components/withdraw/detail/web.d.ts b/es/components/withdraw/detail/web.d.ts index 9e2dcb7c..f670d66f 100644 --- a/es/components/withdraw/detail/web.d.ts +++ b/es/components/withdraw/detail/web.d.ts @@ -15,5 +15,5 @@ export default function render(props: WebComponentProps): React.JSX.Element | null; diff --git a/es/components/withdraw/detail/web.js b/es/components/withdraw/detail/web.js index 3a77ae83..397c06fb 100644 --- a/es/components/withdraw/detail/web.js +++ b/es/components/withdraw/detail/web.js @@ -2,11 +2,11 @@ import React from 'react'; import WithdrawDetail from '../dry/Detail.mobile'; import Styles from './web.module.less'; export default function render(props) { - const { withdrawExactPrice, withdrawMethod, refundData, createAtStr, step, failed } = props.data; + const { withdrawExactPrice, withdrawMethod, refundData, createAtStr, step, iState } = props.data; const { t } = props.methods; if (refundData) { return (
- +
); } return null; diff --git a/es/components/withdraw/detail/web.pc.d.ts b/es/components/withdraw/detail/web.pc.d.ts index 9e2dcb7c..f670d66f 100644 --- a/es/components/withdraw/detail/web.pc.d.ts +++ b/es/components/withdraw/detail/web.pc.d.ts @@ -15,5 +15,5 @@ export default function render(props: WebComponentProps): React.JSX.Element | null; diff --git a/es/components/withdraw/detail/web.pc.js b/es/components/withdraw/detail/web.pc.js index 21d36c94..37bcde81 100644 --- a/es/components/withdraw/detail/web.pc.js +++ b/es/components/withdraw/detail/web.pc.js @@ -2,11 +2,11 @@ import React from 'react'; import WithdrawDetail from '../dry/Detail.pc'; import Styles from './web.pc.module.less'; export default function render(props) { - const { withdrawExactPrice, withdrawMethod, refundData, createAtStr, step, failed } = props.data; + const { withdrawExactPrice, withdrawMethod, refundData, createAtStr, step, iState } = props.data; const { t } = props.methods; if (refundData) { return (
- +
); } return null; diff --git a/es/components/withdraw/dry/Detail.mobile.d.ts b/es/components/withdraw/dry/Detail.mobile.d.ts index 6402dfc9..650013d1 100644 --- a/es/components/withdraw/dry/Detail.mobile.d.ts +++ b/es/components/withdraw/dry/Detail.mobile.d.ts @@ -11,11 +11,11 @@ export default function Detail(props: { finalYuan: string; iState?: EntityDict['refund']['OpSchema']['iState']; iStateColor?: string; - successAt?: string; + updateAt?: string; reason?: string; })[]; withdrawExactPrice: string; t: (k: string, p?: any) => string; step: 0 | 1 | 2; - failed?: boolean; + iState?: EntityDict['withdraw']['OpSchema']['iState']; }): import("react").JSX.Element; diff --git a/es/components/withdraw/dry/Detail.mobile.js b/es/components/withdraw/dry/Detail.mobile.js index 9b5c56b4..a13d987e 100644 --- a/es/components/withdraw/dry/Detail.mobile.js +++ b/es/components/withdraw/dry/Detail.mobile.js @@ -2,11 +2,11 @@ import { Tag, Steps } from 'antd-mobile'; import Styles from './Detail.module.less'; import classNames from 'classnames'; export default function Detail(props) { - const { withdrawExactPrice, withdrawMethod, refundData, t, step, createAt, failed } = props; + const { withdrawExactPrice, withdrawMethod, refundData, t, step, createAt, iState } = props; return (<>
- {t('header.label')} + {['successful', 'partiallySuccessful', 'failed'].includes(iState) ? t('header.label.end') : t('header.label.ing')}
{t('common::pay.symbol')} @@ -18,7 +18,7 @@ export default function Detail(props) { = 0 ? classNames(Styles.label, Styles.active) : Styles.label}>{t('steps.1.title')}} description={= 0 ? classNames(Styles.label, Styles.active) : Styles.label}>{createAt}} key="1"/> = 1 ? classNames(Styles.label, Styles.active) : Styles.label}>{t('steps.2.title')}} description={= 1 ? classNames(Styles.label, Styles.active) : Styles.label}>{t(`method.v.${withdrawMethod}`)}} key="2"/> - = 2 ? classNames(Styles.label, failed ? Styles.failed : Styles.success) : Styles.label}>{failed ? t('steps.3.failed') : t('steps.3.title')}} key="3"/> + = 2 ? classNames(Styles.label, iState === 'failed' ? Styles.failed : Styles.success) : Styles.label}>{iState === 'failed' ? t('steps.3.failed') : (iState === 'partiallySuccess' ? t('steps.3.partiallySuccess') : t('steps.3.success'))}} key="3"/>
{refundData.map((data, idx) => (
@@ -37,35 +37,37 @@ export default function Detail(props) { {data.priceYuan}
-
- {t('refund.label.1')} - - {t('common::pay.symbol')} - {data.finalYuan} - -
-
- {t('refund.label.2')} - - {t('common::pay.symbol')} - {data.lossYuan} - -
-
- {t('refund.label.3')} - {data.lossExp} -
-
- {t('refund.label.4')} - {data.channel} -
- {!!data.successAt &&
- {t('refund.label.successAt')} - {data.successAt} -
} + {iState !== 'failed' && <> +
+ {t('refund.label.1')} + + {t('common::pay.symbol')} + {data.finalYuan} + +
+
+ {t('refund.label.2')} + + {t('common::pay.symbol')} + {data.lossYuan} + +
+
+ {t('refund.label.3')} + {data.lossExp} +
+
+ {t('refund.label.4')} + {data.channel} +
+ } {!!data.reason &&
{t('refund.label.reason')} - {data.reason} + {data.reason} +
} + {!!data.updateAt &&
+ {t('refund.label.updateAt')} + {data.updateAt}
}
))} diff --git a/es/components/withdraw/dry/Detail.module.less b/es/components/withdraw/dry/Detail.module.less index ef3738ed..fb3f2461 100644 --- a/es/components/withdraw/dry/Detail.module.less +++ b/es/components/withdraw/dry/Detail.module.less @@ -61,7 +61,7 @@ margin-top: 4px; display: flex; flex-direction: row; - align-items: center; + // align-items: center; justify-content: space-between; .label { @@ -69,11 +69,16 @@ } .value { + max-width: 180px; color: var(--oak-text-color-primary); .symbol { margin-right: 4px; } } + + .reason { + color: var(--oak-color-error); + } } } \ No newline at end of file diff --git a/es/components/withdraw/dry/Detail.pc.d.ts b/es/components/withdraw/dry/Detail.pc.d.ts index 6402dfc9..650013d1 100644 --- a/es/components/withdraw/dry/Detail.pc.d.ts +++ b/es/components/withdraw/dry/Detail.pc.d.ts @@ -11,11 +11,11 @@ export default function Detail(props: { finalYuan: string; iState?: EntityDict['refund']['OpSchema']['iState']; iStateColor?: string; - successAt?: string; + updateAt?: string; reason?: string; })[]; withdrawExactPrice: string; t: (k: string, p?: any) => string; step: 0 | 1 | 2; - failed?: boolean; + iState?: EntityDict['withdraw']['OpSchema']['iState']; }): import("react").JSX.Element; diff --git a/es/components/withdraw/dry/Detail.pc.js b/es/components/withdraw/dry/Detail.pc.js index b6ddd03b..2e525f2a 100644 --- a/es/components/withdraw/dry/Detail.pc.js +++ b/es/components/withdraw/dry/Detail.pc.js @@ -1,12 +1,13 @@ import { Steps, Tag } from 'antd'; import { CloseCircleOutlined, FileAddOutlined, FieldTimeOutlined, CheckCircleOutlined } from '@ant-design/icons'; import Styles from './Detail.pc.module.less'; +import classNames from 'classnames'; export default function Detail(props) { - const { withdrawExactPrice, withdrawMethod, refundData, t, step, createAt, failed } = props; + const { withdrawExactPrice, withdrawMethod, refundData, t, step, createAt, iState } = props; const H = (<>
- {t('header.label')} + {['successful', 'partiallySuccessful', 'failed'].includes(iState) ? t('header.label.end') : t('header.label.ing')}
{t('common::pay.symbol')} @@ -26,8 +27,16 @@ export default function Detail(props) { description: t(`method.v.${withdrawMethod}`) }, { - title: failed ? {t('steps.3.failed')} : {t('steps.3.title')}, - icon: failed ? : + title: step === 2 + ? (iState === 'failed' + ? {t('steps.3.failed')} + : (iState === 'partiallySuccessful' + ? {t('steps.3.partiallySuccess')} + : {t('steps.3.success')})) + : t('steps.3.success'), + icon: step === 2 ? + (iState === 'failed' ? : ) + : } ]}/>
@@ -60,28 +69,30 @@ export default function Detail(props) { {data.finalYuan}
-
- {t('refund.label.2')} - - {t('common::pay.symbol')} - {data.lossYuan} - -
-
- {t('refund.label.3')} - {data.lossExp} -
-
- {t('refund.label.4')} - {data.channel} -
- {!!data.successAt &&
- {t('refund.label.successAt')} - {data.successAt} -
} + {data.iState !== 'failed' && <> +
+ {t('refund.label.2')} + + {t('common::pay.symbol')} + {data.lossYuan} + +
+
+ {t('refund.label.3')} + {data.lossExp} +
+
+ {t('refund.label.4')} + {data.channel} +
+ } {!!data.reason &&
{t('refund.label.reason')} - {data.reason} + {data.reason} +
} + {!!data.updateAt &&
+ {t('refund.label.updateAt')} + {data.updateAt}
} ))} diff --git a/es/components/withdraw/dry/Detail.pc.module.less b/es/components/withdraw/dry/Detail.pc.module.less index 94c7c641..1ec44e27 100644 --- a/es/components/withdraw/dry/Detail.pc.module.less +++ b/es/components/withdraw/dry/Detail.pc.module.less @@ -33,10 +33,6 @@ font-size: small; } - .active { - // color: var(--oak-color-primary); - } - :global { .ant-steps-item-content { margin-top: 0px !important; @@ -51,7 +47,7 @@ } .refundItem { - width: 188px; + width: 223px; margin: 12px; padding: 8px; font-size: small; @@ -62,7 +58,7 @@ margin-top: 4px; display: flex; flex-direction: row; - align-items: center; + // align-items: center; justify-content: space-between; .label { @@ -70,11 +66,16 @@ } .value { + max-width: 130px; color: var(--oak-text-color-primary); .symbol { margin-right: 4px; } } + + .reason { + color: var(--oak-color-error); + } } } \ No newline at end of file diff --git a/es/components/withdraw/dry/locales/zh-CN.json b/es/components/withdraw/dry/locales/zh-CN.json index b9e1bed9..c297711d 100644 --- a/es/components/withdraw/dry/locales/zh-CN.json +++ b/es/components/withdraw/dry/locales/zh-CN.json @@ -1,6 +1,9 @@ { "header": { - "label": "预计到帐金额" + "label": { + "end": "到帐金额", + "ing": "预计到帐金额" + } }, "steps": { "1": { @@ -10,7 +13,8 @@ "title": "处理中" }, "3": { - "title": "到帐成功", + "success": "到帐成功", + "partiallySuccess": "部分成功", "failed": "提现失败" } }, @@ -27,8 +31,8 @@ "1": "到帐金额", "2": "手续费", "3": "手续费率", - "4": "到帐通道", - "successAt": "到帐时间", + "4": "收款帐户", + "updateAt": "更新时间", "reason": "异常原因" } } diff --git a/es/configuration/attrUpdateMatrix.js b/es/configuration/attrUpdateMatrix.js index 8718c6a3..32f3e7b2 100644 --- a/es/configuration/attrUpdateMatrix.js +++ b/es/configuration/attrUpdateMatrix.js @@ -48,6 +48,20 @@ const attrUpdateMatrix = { reason: { actions: ['failRefunding', 'makeAbnormal'], } + }, + withdraw: { + dealLoss: { + actions: ['succeed', 'fail', 'succeedPartially'], + }, + dealPrice: { + actions: ['succeed', 'fail', 'succeedPartially'], + }, + reason: { + actions: ['succeed', 'fail', 'succeedPartially'], + }, + meta: { + actions: ['succeed', 'fail', 'succeedPartially'], + }, } }; export default attrUpdateMatrix; diff --git a/es/data/i18n.js b/es/data/i18n.js index 9898532b..2ffae9b1 100644 --- a/es/data/i18n.js +++ b/es/data/i18n.js @@ -318,7 +318,10 @@ const i18ns = [ position: "src/components/withdraw/dry", data: { "header": { - "label": "预计到帐金额" + "label": { + "end": "到帐金额", + "ing": "预计到帐金额" + } }, "steps": { "1": { @@ -328,7 +331,8 @@ const i18ns = [ "title": "处理中" }, "3": { - "title": "到帐成功", + "success": "到帐成功", + "partiallySuccess": "部分成功", "failed": "提现失败" } }, @@ -345,8 +349,8 @@ const i18ns = [ "1": "到帐金额", "2": "手续费", "3": "手续费率", - "4": "到帐通道", - "successAt": "到帐时间", + "4": "收款帐户", + "updateAt": "更新时间", "reason": "异常原因" } } diff --git a/es/triggers/refund.js b/es/triggers/refund.js index 6819b98b..2083fa5f 100644 --- a/es/triggers/refund.js +++ b/es/triggers/refund.js @@ -20,9 +20,6 @@ async function changeWithdrawStateByRefunds(context, refunds) { iState: 1, loss: 1, }, - filter: { - iState: 'refunded', - }, }, }, filter: { @@ -51,7 +48,7 @@ async function changeWithdrawStateByRefunds(context, refunds) { if (!allRefundsOver) { continue; } - const action = dealPrice === price ? 'succeed' : 'partiallySucceed'; + const action = dealPrice === 0 ? 'fail' : (dealPrice === price ? 'succeed' : 'succeedPartially'); await context.operate('withdraw', { id: await generateNewIdAsync(), action, diff --git a/es/triggers/withdraw.js b/es/triggers/withdraw.js index 0149f9cb..a4fadef5 100644 --- a/es/triggers/withdraw.js +++ b/es/triggers/withdraw.js @@ -97,6 +97,8 @@ const triggers = [ type: 'withdrawBack', totalPlus: price, availPlus: price, + entity: 'withdraw', + entityId: withdraw.id, }, }, {}); } @@ -133,6 +135,8 @@ const triggers = [ type: 'withdrawBack', totalPlus: price - dealPrice, availPlus: price - dealPrice, + entity: 'withdraw', + entityId: withdraw.id, }, }, {}); } diff --git a/es/utils/payClazz/WechatPay/WechatPay.debug.js b/es/utils/payClazz/WechatPay/WechatPay.debug.js index ac0b7ef9..69d198f0 100644 --- a/es/utils/payClazz/WechatPay/WechatPay.debug.js +++ b/es/utils/payClazz/WechatPay/WechatPay.debug.js @@ -19,10 +19,12 @@ export default class WechatPay { } async getRefundState(refund) { const r = Math.random(); - /* if (r < 0.3) { - return ['refunding', {}]; - } */ - return ['refunded', {}]; + if (r < 0.5) { + return ['refunded', undefined]; + } + return ['failed', { + reason: '微信觉得你长得太丑了,就不想给你退款,让你去深圳找马化腾', + }]; } decodePayNotification(params, body) { throw new Error("Method not implemented."); diff --git a/lib/configuration/attrUpdateMatrix.js b/lib/configuration/attrUpdateMatrix.js index c41ddcd7..a68f38af 100644 --- a/lib/configuration/attrUpdateMatrix.js +++ b/lib/configuration/attrUpdateMatrix.js @@ -50,6 +50,20 @@ const attrUpdateMatrix = { reason: { actions: ['failRefunding', 'makeAbnormal'], } + }, + withdraw: { + dealLoss: { + actions: ['succeed', 'fail', 'succeedPartially'], + }, + dealPrice: { + actions: ['succeed', 'fail', 'succeedPartially'], + }, + reason: { + actions: ['succeed', 'fail', 'succeedPartially'], + }, + meta: { + actions: ['succeed', 'fail', 'succeedPartially'], + }, } }; exports.default = attrUpdateMatrix; diff --git a/lib/data/i18n.js b/lib/data/i18n.js index 234515f3..a90ee200 100644 --- a/lib/data/i18n.js +++ b/lib/data/i18n.js @@ -320,7 +320,10 @@ const i18ns = [ position: "src/components/withdraw/dry", data: { "header": { - "label": "预计到帐金额" + "label": { + "end": "到帐金额", + "ing": "预计到帐金额" + } }, "steps": { "1": { @@ -330,7 +333,8 @@ const i18ns = [ "title": "处理中" }, "3": { - "title": "到帐成功", + "success": "到帐成功", + "partiallySuccess": "部分成功", "failed": "提现失败" } }, @@ -347,8 +351,8 @@ const i18ns = [ "1": "到帐金额", "2": "手续费", "3": "手续费率", - "4": "到帐通道", - "successAt": "到帐时间", + "4": "收款帐户", + "updateAt": "更新时间", "reason": "异常原因" } } diff --git a/lib/triggers/refund.js b/lib/triggers/refund.js index 3089550e..a145a781 100644 --- a/lib/triggers/refund.js +++ b/lib/triggers/refund.js @@ -23,9 +23,6 @@ async function changeWithdrawStateByRefunds(context, refunds) { iState: 1, loss: 1, }, - filter: { - iState: 'refunded', - }, }, }, filter: { @@ -54,7 +51,7 @@ async function changeWithdrawStateByRefunds(context, refunds) { if (!allRefundsOver) { continue; } - const action = dealPrice === price ? 'succeed' : 'partiallySucceed'; + const action = dealPrice === 0 ? 'fail' : (dealPrice === price ? 'succeed' : 'succeedPartially'); await context.operate('withdraw', { id: await (0, uuid_1.generateNewIdAsync)(), action, diff --git a/lib/triggers/withdraw.js b/lib/triggers/withdraw.js index 1145993d..36eb4016 100644 --- a/lib/triggers/withdraw.js +++ b/lib/triggers/withdraw.js @@ -100,6 +100,8 @@ const triggers = [ type: 'withdrawBack', totalPlus: price, availPlus: price, + entity: 'withdraw', + entityId: withdraw.id, }, }, {}); } @@ -136,6 +138,8 @@ const triggers = [ type: 'withdrawBack', totalPlus: price - dealPrice, availPlus: price - dealPrice, + entity: 'withdraw', + entityId: withdraw.id, }, }, {}); } diff --git a/lib/utils/payClazz/WechatPay/WechatPay.debug.js b/lib/utils/payClazz/WechatPay/WechatPay.debug.js index 9ac4e7f2..1607e867 100644 --- a/lib/utils/payClazz/WechatPay/WechatPay.debug.js +++ b/lib/utils/payClazz/WechatPay/WechatPay.debug.js @@ -23,10 +23,12 @@ class WechatPay { } async getRefundState(refund) { const r = Math.random(); - /* if (r < 0.3) { - return ['refunding', {}]; - } */ - return ['refunded', {}]; + if (r < 0.5) { + return ['refunded', undefined]; + } + return ['failed', { + reason: '微信觉得你长得太丑了,就不想给你退款,让你去深圳找马化腾', + }]; } decodePayNotification(params, body) { throw new Error("Method not implemented."); diff --git a/src/components/withdraw/detail/index.ts b/src/components/withdraw/detail/index.ts index e5dc0161..ae29d325 100644 --- a/src/components/withdraw/detail/index.ts +++ b/src/components/withdraw/detail/index.ts @@ -46,19 +46,21 @@ export default OakComponent({ priceYuan: ThousandCont(ToYuan(price!), 2), lossYuan: ThousandCont(ToYuan(loss!), 2), finalYuan: ThousandCont(ToYuan(price! - loss!), 2), - successAt: iState === 'refunded' && dayJs($$updateAt$$).format('YYYY-MM-DD HH:mm'), + updateAt: dayJs($$updateAt$$).format('YYYY-MM-DD HH:mm'), reason, }; } ); - const withdrawExactPrice = ThousandCont(ToYuan(data ? data.price! - data.loss! : 0), 2); + const withdrawExactPrice = data ? ['successful', 'partiallySuccessful', 'failed'].includes(data.iState!) ? data.dealPrice! -data.dealLoss! : data.price! - data.loss! : 0; + return { createAtStr: data && dayJs(data.$$createAt$$).format('YYYY-MM-DD HH:mm'), - withdrawExactPrice, + withdrawExactPrice: ThousandCont(ToYuan(withdrawExactPrice), 2), refundData, withdrawMethod: refundData && refundData.length ? 'refund' : undefined, step: data?.iState === 'withdrawing' ? 1 : 2, - failed: data?.iState === 'failed', + // failed: data?.iState === 'failed', + iState: data?.iState, }; } }); diff --git a/src/components/withdraw/detail/web.pc.tsx b/src/components/withdraw/detail/web.pc.tsx index bdb6084a..bcf06dcf 100644 --- a/src/components/withdraw/detail/web.pc.tsx +++ b/src/components/withdraw/detail/web.pc.tsx @@ -18,9 +18,9 @@ export default function render(props: WebComponentProps) { - const { withdrawExactPrice, withdrawMethod, refundData, createAtStr, step, failed } = props.data; + const { withdrawExactPrice, withdrawMethod, refundData, createAtStr, step, iState } = props.data; const { t } = props.methods; if (refundData) { @@ -33,7 +33,7 @@ export default function render(props: WebComponentProps ); diff --git a/src/components/withdraw/detail/web.tsx b/src/components/withdraw/detail/web.tsx index a32c99b5..310829b4 100644 --- a/src/components/withdraw/detail/web.tsx +++ b/src/components/withdraw/detail/web.tsx @@ -18,9 +18,9 @@ export default function render(props: WebComponentProps) { - const { withdrawExactPrice, withdrawMethod, refundData, createAtStr, step, failed } = props.data; + const { withdrawExactPrice, withdrawMethod, refundData, createAtStr, step, iState } = props.data; const { t } = props.methods; if (refundData) { @@ -33,7 +33,7 @@ export default function render(props: WebComponentProps ); diff --git a/src/components/withdraw/dry/Detail.mobile.tsx b/src/components/withdraw/dry/Detail.mobile.tsx index b274e7ac..f8fb8b66 100644 --- a/src/components/withdraw/dry/Detail.mobile.tsx +++ b/src/components/withdraw/dry/Detail.mobile.tsx @@ -15,20 +15,20 @@ export default function Detail(props: { finalYuan: string; iState?: EntityDict['refund']['OpSchema']['iState']; iStateColor?: string; - successAt?: string; + updateAt?: string; reason?: string; })[]; withdrawExactPrice: string; t: (k: string, p?: any) => string; step: 0 | 1 | 2; - failed?: boolean; + iState?: EntityDict['withdraw']['OpSchema']['iState']; }) { - const { withdrawExactPrice, withdrawMethod, refundData, t, step, createAt, failed } = props; + const { withdrawExactPrice, withdrawMethod, refundData, t, step, createAt, iState } = props; return ( <>
- {t('header.label')} + {['successful', 'partiallySuccessful', 'failed'].includes(iState!) ? t('header.label.end') : t('header.label.ing')}
{t('common::pay.symbol')} @@ -48,7 +48,7 @@ export default function Detail(props: { }>{createAt}} key="1" /> = 1 ? classNames(Styles.label, Styles.active) : Styles.label + step >= 1 ? classNames(Styles.label, Styles.active) : Styles.label }>{t('steps.2.title')} } description={ = 2 ? classNames(Styles.label, failed ? Styles.failed : Styles.success) : Styles.label - }>{failed ? t('steps.3.failed') :t('steps.3.title')} + step >= 2 ? classNames(Styles.label, iState === 'failed' ? Styles.failed : Styles.success) : Styles.label + }>{iState === 'failed' ? t('steps.3.failed') : (iState === 'partiallySuccessful' ? t('steps.3.partiallySuccess') : t('steps.3.success'))} } key="3" />
@@ -81,35 +81,37 @@ export default function Detail(props: { {data.priceYuan}
-
- {t('refund.label.1')} - - {t('common::pay.symbol')} - {data.finalYuan} - -
-
- {t('refund.label.2')} - - {t('common::pay.symbol')} - {data.lossYuan} - -
-
- {t('refund.label.3')} - {data.lossExp} -
-
- {t('refund.label.4')} - {data.channel} -
- {!!data.successAt &&
- {t('refund.label.successAt')} - {data.successAt} -
} + {iState !== 'failed' && <> +
+ {t('refund.label.1')} + + {t('common::pay.symbol')} + {data.finalYuan} + +
+
+ {t('refund.label.2')} + + {t('common::pay.symbol')} + {data.lossYuan} + +
+
+ {t('refund.label.3')} + {data.lossExp} +
+
+ {t('refund.label.4')} + {data.channel} +
+ } {!!data.reason &&
{t('refund.label.reason')} - {data.reason} + {data.reason} +
} + {!!data.updateAt &&
+ {t('refund.label.updateAt')} + {data.updateAt}
} ) diff --git a/src/components/withdraw/dry/Detail.module.less b/src/components/withdraw/dry/Detail.module.less index ef3738ed..fb3f2461 100644 --- a/src/components/withdraw/dry/Detail.module.less +++ b/src/components/withdraw/dry/Detail.module.less @@ -61,7 +61,7 @@ margin-top: 4px; display: flex; flex-direction: row; - align-items: center; + // align-items: center; justify-content: space-between; .label { @@ -69,11 +69,16 @@ } .value { + max-width: 180px; color: var(--oak-text-color-primary); .symbol { margin-right: 4px; } } + + .reason { + color: var(--oak-color-error); + } } } \ No newline at end of file diff --git a/src/components/withdraw/dry/Detail.pc.module.less b/src/components/withdraw/dry/Detail.pc.module.less index 94c7c641..1ec44e27 100644 --- a/src/components/withdraw/dry/Detail.pc.module.less +++ b/src/components/withdraw/dry/Detail.pc.module.less @@ -33,10 +33,6 @@ font-size: small; } - .active { - // color: var(--oak-color-primary); - } - :global { .ant-steps-item-content { margin-top: 0px !important; @@ -51,7 +47,7 @@ } .refundItem { - width: 188px; + width: 223px; margin: 12px; padding: 8px; font-size: small; @@ -62,7 +58,7 @@ margin-top: 4px; display: flex; flex-direction: row; - align-items: center; + // align-items: center; justify-content: space-between; .label { @@ -70,11 +66,16 @@ } .value { + max-width: 130px; color: var(--oak-text-color-primary); .symbol { margin-right: 4px; } } + + .reason { + color: var(--oak-color-error); + } } } \ No newline at end of file diff --git a/src/components/withdraw/dry/Detail.pc.tsx b/src/components/withdraw/dry/Detail.pc.tsx index b0b2935d..b50fda48 100644 --- a/src/components/withdraw/dry/Detail.pc.tsx +++ b/src/components/withdraw/dry/Detail.pc.tsx @@ -15,20 +15,20 @@ export default function Detail(props: { finalYuan: string; iState?: EntityDict['refund']['OpSchema']['iState']; iStateColor?: string; - successAt?: string; + updateAt?: string; reason?: string; })[]; withdrawExactPrice: string; t: (k: string, p?: any) => string; step: 0 | 1 | 2; - failed?: boolean; + iState?: EntityDict['withdraw']['OpSchema']['iState']; }) { - const { withdrawExactPrice, withdrawMethod, refundData, t, step, createAt, failed } = props; + const { withdrawExactPrice, withdrawMethod, refundData, t, step, createAt, iState } = props; const H = ( <>
- {t('header.label')} + {['successful', 'partiallySuccessful', 'failed'].includes(iState!) ? t('header.label.end') : t('header.label.ing')}
{t('common::pay.symbol')} @@ -51,8 +51,17 @@ export default function Detail(props: { description: t(`method.v.${withdrawMethod}`) }, { - title: failed ? {t('steps.3.failed')} : {t('steps.3.title')}, - icon: failed ? : + title: step === 2 + ? (iState === 'failed' + ? {t('steps.3.failed')} + : (iState === 'partiallySuccessful' + ? {t('steps.3.partiallySuccess')} + : {t('steps.3.success')}) + ) + : t('steps.3.success'), + icon: step === 2 ? + (iState === 'failed' ? : ) + : } ]} /> @@ -91,28 +100,30 @@ export default function Detail(props: { {data.finalYuan}
-
- {t('refund.label.2')} - - {t('common::pay.symbol')} - {data.lossYuan} - -
-
- {t('refund.label.3')} - {data.lossExp} -
-
- {t('refund.label.4')} - {data.channel} -
- {!!data.successAt &&
- {t('refund.label.successAt')} - {data.successAt} -
} + {data.iState !== 'failed' && <> +
+ {t('refund.label.2')} + + {t('common::pay.symbol')} + {data.lossYuan} + +
+
+ {t('refund.label.3')} + {data.lossExp} +
+
+ {t('refund.label.4')} + {data.channel} +
+ } {!!data.reason &&
{t('refund.label.reason')} - {data.reason} + {data.reason} +
} + {!!data.updateAt &&
+ {t('refund.label.updateAt')} + {data.updateAt}
}
) diff --git a/src/components/withdraw/dry/locales/zh-CN.json b/src/components/withdraw/dry/locales/zh-CN.json index a1361587..4fc0a2f9 100644 --- a/src/components/withdraw/dry/locales/zh-CN.json +++ b/src/components/withdraw/dry/locales/zh-CN.json @@ -1,7 +1,10 @@ { "header": { - "label": "预计到帐金额" + "label": { + "end": "到帐金额", + "ing": "预计到帐金额" + } }, "steps": { "1": { @@ -11,7 +14,8 @@ "title": "处理中" }, "3": { - "title": "到帐成功", + "success": "到帐成功", + "partiallySuccess": "部分成功", "failed": "提现失败" } }, @@ -28,8 +32,8 @@ "1": "到帐金额", "2": "手续费", "3": "手续费率", - "4": "到帐通道", - "successAt": "到帐时间", + "4": "收款帐户", + "updateAt": "更新时间", "reason": "异常原因" } } diff --git a/src/configuration/attrUpdateMatrix.ts b/src/configuration/attrUpdateMatrix.ts index 2f00aebc..b1952007 100644 --- a/src/configuration/attrUpdateMatrix.ts +++ b/src/configuration/attrUpdateMatrix.ts @@ -52,6 +52,20 @@ const attrUpdateMatrix: AttrUpdateMatrix = { reason: { actions: ['failRefunding', 'makeAbnormal'], } + }, + withdraw: { + dealLoss: { + actions: ['succeed', 'fail', 'succeedPartially'], + }, + dealPrice: { + actions: ['succeed', 'fail', 'succeedPartially'], + }, + reason: { + actions: ['succeed', 'fail', 'succeedPartially'], + }, + meta: { + actions: ['succeed', 'fail', 'succeedPartially'], + }, } }; diff --git a/src/data/i18n.ts b/src/data/i18n.ts index 39bad433..50005fc9 100644 --- a/src/data/i18n.ts +++ b/src/data/i18n.ts @@ -320,7 +320,10 @@ const i18ns: I18n[] = [ position: "src/components/withdraw/dry", data: { "header": { - "label": "预计到帐金额" + "label": { + "end": "到帐金额", + "ing": "预计到帐金额" + } }, "steps": { "1": { @@ -330,7 +333,8 @@ const i18ns: I18n[] = [ "title": "处理中" }, "3": { - "title": "到帐成功", + "success": "到帐成功", + "partiallySuccess": "部分成功", "failed": "提现失败" } }, @@ -347,8 +351,8 @@ const i18ns: I18n[] = [ "1": "到帐金额", "2": "手续费", "3": "手续费率", - "4": "到帐通道", - "successAt": "到帐时间", + "4": "收款帐户", + "updateAt": "更新时间", "reason": "异常原因" } } diff --git a/src/triggers/refund.ts b/src/triggers/refund.ts index 4fc1fdd5..f7bc3bbb 100644 --- a/src/triggers/refund.ts +++ b/src/triggers/refund.ts @@ -24,9 +24,6 @@ async function changeWithdrawStateByRefunds(context: BRC, refunds: Partial[] = [ type: 'withdrawBack', totalPlus: price!, availPlus: price!, + entity: 'withdraw', + entityId: withdraw.id, }, }, {}); } @@ -148,6 +150,8 @@ const triggers: Trigger[] = [ type: 'withdrawBack', totalPlus: price! - dealPrice!, availPlus: price! - dealPrice!, + entity: 'withdraw', + entityId: withdraw.id, }, }, {}); } diff --git a/src/utils/payClazz/WechatPay/WechatPay.debug.ts b/src/utils/payClazz/WechatPay/WechatPay.debug.ts index eec8fe69..6951664c 100644 --- a/src/utils/payClazz/WechatPay/WechatPay.debug.ts +++ b/src/utils/payClazz/WechatPay/WechatPay.debug.ts @@ -29,11 +29,13 @@ export default class WechatPay implements PayClazz { } async getRefundState(refund: Refund): Promise<[string | null | undefined, PayUpdateData | undefined]> { const r = Math.random(); - /* if (r < 0.3) { - return ['refunding', {}]; - } */ + if (r < 0.5) { + return ['refunded', undefined]; + } - return ['refunded', {}]; + return ['failed', { + reason: '微信觉得你长得太丑了,就不想给你退款,让你去深圳找马化腾', + }]; } decodePayNotification(params: Record, body: any): Promise<{ payId: string; iState: string | null | undefined; extra?: PayUpdateData | undefined; }> { throw new Error("Method not implemented.");