diff --git a/es/components/account/detail/index.js b/es/components/account/detail/index.js
index 3cf3ebe4..149b3bca 100644
--- a/es/components/account/detail/index.js
+++ b/es/components/account/detail/index.js
@@ -123,6 +123,40 @@ export default OakComponent({
}
}
]);
+ this.setPayRefreshing(true);
+ const delay = 2000;
+ const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));
+ const pollUntilPaying = async () => {
+ while (true) {
+ const { data: [pay] } = await this.features.cache.refresh('pay', {
+ data: {
+ id: 1,
+ applicationId: 1,
+ price: 1,
+ meta: 1,
+ iState: 1,
+ paid: 1,
+ refunded: 1,
+ timeoutAt: 1,
+ forbidRefundAt: 1,
+ externalId: 1,
+ entity: 1,
+ entityId: 1,
+ creatorId: 1,
+ phantom3: 1,
+ },
+ filter: {
+ id: payId,
+ }
+ });
+ if (pay.iState === 'paying') {
+ this.setPayRefreshing(false);
+ return;
+ }
+ await wait(delay);
+ }
+ };
+ await pollUntilPaying();
this.setDepositing(false);
}
catch (err) {
@@ -133,6 +167,9 @@ export default OakComponent({
const { onGoToUnfinishedPay } = this.props;
onGoToUnfinishedPay && onGoToUnfinishedPay(payId);
},
+ setPayRefreshing(payRefreshing) {
+ this.setState({ payRefreshing });
+ },
setDepositOpen(depositOpen) {
this.setState({ depositOpen }, () => {
setTimeout(() => {
@@ -201,10 +238,10 @@ export default OakComponent({
onUfModalClose() {
this.setUfOpen(false);
},
- onUnfinishedDepositClick() {
+ async onUnfinishedDepositClick() {
const { onGoToUnfinishedPay } = this.props;
const { unfinishedDepositId } = this.state;
- const [pay] = this.features.cache.get('pay', {
+ const { data: [pay] } = await this.features.cache.refresh('pay', {
data: {
id: 1,
},
@@ -355,6 +392,7 @@ export default OakComponent({
setDepositChannelMp(depositChannel) { this.setDepositChannel(depositChannel); },
focus: false,
unsub: undefined,
+ payRefreshing: false,
},
lifetimes: {
async ready() {
diff --git a/es/components/account/detail/index.json b/es/components/account/detail/index.json
index 8e329a23..d2f79233 100644
--- a/es/components/account/detail/index.json
+++ b/es/components/account/detail/index.json
@@ -1,5 +1,6 @@
{
"usingComponents": {
+ "l-loading": "@oak-frontend-base/miniprogram_npm/lin-ui/loading/index",
"l-button": "@oak-frontend-base/miniprogram_npm/lin-ui/button/index",
"l-popup": "@oak-frontend-base/miniprogram_npm/lin-ui/popup/index",
"l-dialog": "@oak-frontend-base/miniprogram_npm/lin-ui/dialog/index",
diff --git a/es/components/account/detail/index.xml b/es/components/account/detail/index.xml
index b3ff96da..fb560b21 100644
--- a/es/components/account/detail/index.xml
+++ b/es/components/account/detail/index.xml
@@ -28,9 +28,11 @@
-
-
-
+
+
+
+
{{t('account:action.deposit')}}
-
-
-
+
+
{{t('account:action.withdraw')}}
+
+
+
+
+
+
+
+
+ {{t('account:action.deposit')}}
+
+
+
+
+ {{t('account:action.withdraw')}}
+
+
-
+
new Promise(resolve => setTimeout(resolve, ms));
+ const pollUntilPaying = async () => {
+ while (true) {
+ const { data: [pay] } = await this.features.cache.refresh('pay', {
+ data: {
+ id: 1,
+ applicationId: 1,
+ price: 1,
+ meta: 1,
+ iState: 1,
+ paid: 1,
+ refunded: 1,
+ timeoutAt: 1,
+ forbidRefundAt: 1,
+ externalId: 1,
+ entity: 1,
+ entityId: 1,
+ creatorId: 1,
+ phantom3: 1,
+ },
+ filter: {
+ id: payId,
+ }
+ })
+ if (pay.iState === 'paying') {
+ this.setPayRefreshing(false);
+ return;
+ }
+ await wait(delay);
+ }
+ };
+ await pollUntilPaying();
this.setDepositing(false);
}
catch (err: any) {
@@ -138,6 +172,9 @@ export default OakComponent({
const { onGoToUnfinishedPay } = this.props;
onGoToUnfinishedPay && onGoToUnfinishedPay(payId);
},
+ setPayRefreshing(payRefreshing: boolean) {
+ this.setState({ payRefreshing });
+ },
setDepositOpen(depositOpen: boolean) {
this.setState({ depositOpen }, () => {
setTimeout(() => {
@@ -207,10 +244,10 @@ export default OakComponent({
onUfModalClose() {
this.setUfOpen(false);
},
- onUnfinishedDepositClick() {
+ async onUnfinishedDepositClick() {
const { onGoToUnfinishedPay } = this.props;
const { unfinishedDepositId } = this.state;
- const [pay] = this.features.cache.get('pay', {
+ const { data: [pay] } = await this.features.cache.refresh('pay', {
data: {
id: 1,
},
@@ -361,6 +398,7 @@ export default OakComponent({
setDepositChannelMp(depositChannel: PayChannel | null) { this.setDepositChannel(depositChannel) },
focus: false,
unsub: undefined as undefined | (() => void),
+ payRefreshing: false,
},
lifetimes: {
async ready() {
diff --git a/src/components/account/detail/index.xml b/src/components/account/detail/index.xml
index b3ff96da..fb560b21 100644
--- a/src/components/account/detail/index.xml
+++ b/src/components/account/detail/index.xml
@@ -28,9 +28,11 @@
-
-
-
+
+
+
+
{{t('account:action.deposit')}}
-
-
-
+
+
{{t('account:action.withdraw')}}
+
+
+
+
+
+
+
+
+ {{t('account:action.deposit')}}
+
+
+
+
+ {{t('account:action.withdraw')}}
+
+
-
+