payDetail页面增加了一个disableClose的参数

This commit is contained in:
Xu Chang 2025-02-13 11:56:47 +08:00
parent c5cd9ac6d1
commit 58f01d86f7
9 changed files with 72 additions and 55 deletions

View File

@ -11,5 +11,6 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
closeWhenFailure: boolean;
mode: "frontend" | "backend";
autoSuccessAt: boolean;
disableClose: boolean;
}>) => React.ReactElement;
export default _default;

View File

@ -119,6 +119,7 @@ export default OakComponent({
closeWhenFailure: false,
mode: 'frontend',
autoSuccessAt: true,
disableClose: false,
},
data: {
showCloseConfirmMp: false,
@ -126,7 +127,7 @@ export default OakComponent({
unsub: undefined,
unsubShip: undefined,
},
formData({ data }) {
formData({ data, props }) {
const application = this.features.application.getApplication();
const iState = data?.iState;
let iStateStr = this.t(`pay:v.iState.${iState}`);
@ -163,7 +164,7 @@ export default OakComponent({
pay: data,
application,
iStateColor,
closable: !!(data?.["#oakLegalActions"]?.includes('close')),
closable: !props.disableClose && !!(data?.["#oakLegalActions"]?.includes('close')),
startPayable,
succeedable,
offline,

View File

@ -3,6 +3,7 @@
align-items: stretch;
flex-direction: column;
height: 100%;
min-width: 100%;
}
.meta {

View File

@ -195,7 +195,7 @@ export default function Render(props) {
}
}
return (<>
<Card title={t('title')} extra={<Space>
<Card className={Styles.card} title={t('title')} extra={<Space>
{succeedable ? <Button type="primary" onClick={() => {
if (autoSuccessAt) {
succeed(Date.now());

View File

@ -1,3 +1,7 @@
.card {
min-width: 100%;
}
.container {
display: flex;
align-items: center;

View File

@ -140,6 +140,7 @@ export default OakComponent({
closeWhenFailure: false,
mode: 'frontend' as 'frontend' | 'backend',
autoSuccessAt: true,
disableClose: false,
},
data: {
showCloseConfirmMp: false,
@ -147,7 +148,7 @@ export default OakComponent({
unsub: undefined as undefined | (() => void),
unsubShip: undefined as undefined | (() => void),
},
formData({ data }) {
formData({ data, props }) {
const application = this.features.application.getApplication();
const iState = data?.iState;
let iStateStr = this.t(`pay:v.iState.${iState}`);
@ -193,7 +194,7 @@ export default OakComponent({
pay: data,
application,
iStateColor,
closable: !!(data?.["#oakLegalActions"]?.includes('close')),
closable: !props.disableClose && !!(data?.["#oakLegalActions"]?.includes('close')),
startPayable,
succeedable,
offline,

View File

@ -3,6 +3,7 @@
align-items: stretch;
flex-direction: column;
height: 100%;
min-width: 100%;
}
.meta {

View File

@ -1,3 +1,7 @@
.card {
min-width: 100%;
}
.container {
display: flex;
align-items: center;

View File

@ -319,7 +319,25 @@ export default function Render(props: WebComponentProps<EntityDict, 'pay', false
const { iState, price, entity } = pay;
const BtnPart2: React.ReactElement[] = [];
if (startPayable) {
if (succeedable) {
BtnPart2.push(
<Button
type="primary"
onClick={() => {
if (autoSuccessAt) {
succeed(Date.now());
}
else {
setShowSa(true);
}
}}
>
{t('pay:action.succeedPaying')}
</Button>
);
}
else if (startPayable) {
BtnPart2.push(
<Button
style={{ backgroundColor: '#04BE02' }}
@ -345,63 +363,49 @@ export default function Render(props: WebComponentProps<EntityDict, 'pay', false
</Button>
);
}
else {
if (closable) {
BtnPart2.push(
<Button
danger
onClick={() => {
Modal.confirm({
title: t('cc.title'),
content: t('cc.content'),
onOk: async () => {
await execute('close');
onClose();
},
okText: t('common::confirm'),
cancelText: t('common::action.cancel'),
});
}}
>
{t('pay:action.close')}
</Button>
);
}
if (goBackable) {
BtnPart2.push(
<Button
type="link"
onClick={goBack}
>
{t('common::back')}
</Button>
);
}
if (closable) {
BtnPart2.push(
<Button
danger
onClick={() => {
Modal.confirm({
title: t('cc.title'),
content: t('cc.content'),
onOk: async () => {
await execute('close');
onClose();
},
okText: t('common::confirm'),
cancelText: t('common::action.cancel'),
});
}}
>
{t('pay:action.close')}
</Button>
);
}
if (goBackable) {
BtnPart2.push(
<Button
type="link"
onClick={goBack}
>
{t('common::back')}
</Button>
);
}
return (
<>
<Card
className={Styles.card}
title={t('title')}
extra={
<Space>
{
succeedable ? <Button
type="primary"
onClick={() => {
if (autoSuccessAt) {
succeed(Date.now());
}
else {
setShowSa(true);
}
}}
>
{t('pay:action.succeedPaying')}
</Button> : <Tag color={iStateColor}>
{t(`pay:v.iState.${iState}`)}
</Tag>
}
<Tag color={iStateColor}>
{t(`pay:v.iState.${iState}`)}
</Tag>
</Space>
}
>