Add payerName to provider.

This commit is contained in:
Gucheng Wang
2022-04-27 21:24:50 +08:00
parent 5597f99e3c
commit f5590c42f7
6 changed files with 34 additions and 13 deletions

View File

@ -30,6 +30,7 @@ class PaymentEditPage extends React.Component {
paymentName: props.match.params.paymentName,
payment: null,
isModalVisible: false,
isInvoiceLoading: false,
mode: props.location.mode !== undefined ? props.location.mode : "edit",
};
}
@ -69,20 +70,25 @@ class PaymentEditPage extends React.Component {
issueInvoice() {
this.setState({
isModalVisible: false,
isInvoiceLoading: true,
});
PaymentBackend.invoicePayment(this.state.payment.owner, this.state.paymentName)
.then((res) => {
this.setState({
isInvoiceLoading: false,
});
if (res.msg === "") {
Setting.showMessage("success", `Successfully invoiced`);
this.setState({
paymentName: this.state.payment.name,
});
window.location.reload();
} else {
Setting.showMessage("error", res.msg);
Setting.showMessage(res.msg.includes("成功") ? "info" : "error", res.msg);
}
})
.catch(error => {
this.setState({
isInvoiceLoading: false,
});
Setting.showMessage("error", `Failed to connect to server: ${error}`);
});
}

View File

@ -337,6 +337,8 @@ export function showMessage(type, text) {
message.success(text);
} else if (type === "error") {
message.error(text);
} else if (type === "info") {
message.info(text);
}
}