充值页跳转支付详情页修改

This commit is contained in:
lxy 2025-04-08 21:17:14 +08:00
parent 5f02a3b8cc
commit 784740ce86
6 changed files with 152 additions and 18 deletions

View File

@ -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() {

View File

@ -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",

View File

@ -28,9 +28,11 @@
</view>
</view>
<view style="height:30vh;" />
<view class="btn">
<view class="item">
<l-button
<block wx:if="{{payRefreshing}}">
<l-loading show="{{payRefreshing}}" type="circle" opacity="0.5">
<view class="btn">
<view class="item">
<l-button
size="long"
bind:lintap="onDepositClick"
bgColor="{{textColor}}"
@ -38,9 +40,9 @@
>
{{t('account:action.deposit')}}
</l-button>
</view>
<view class="item">
<l-button
</view>
<view class="item">
<l-button
size="long"
plain="{{true}}"
bind:lintap="onWithdrawClick"
@ -48,8 +50,34 @@
>
{{t('account:action.withdraw')}}
</l-button>
</view>
</view>
</l-loading>
</block>
<block wx:else>
<view class="btn">
<view class="item">
<l-button
size="long"
bind:lintap="onDepositClick"
bgColor="{{textColor}}"
l-class="my-button"
>
{{t('account:action.deposit')}}
</l-button>
</view>
<view class="item">
<l-button
size="long"
plain="{{true}}"
bind:lintap="onWithdrawClick"
l-class="withdrawBtn my-button"
>
{{t('account:action.withdraw')}}
</l-button>
</view>
</view>
</view>
</block>
<block wx:if="{{depositOpen}}">
<l-popup
show="{{depositOpen}}"

View File

@ -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",

View File

@ -127,6 +127,40 @@ export default OakComponent({
}
}
]);
this.setPayRefreshing(true);
const delay = 2000;
const wait = (ms: number) => 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() {

View File

@ -28,9 +28,11 @@
</view>
</view>
<view style="height:30vh;" />
<view class="btn">
<view class="item">
<l-button
<block wx:if="{{payRefreshing}}">
<l-loading show="{{payRefreshing}}" type="circle" opacity="0.5">
<view class="btn">
<view class="item">
<l-button
size="long"
bind:lintap="onDepositClick"
bgColor="{{textColor}}"
@ -38,9 +40,9 @@
>
{{t('account:action.deposit')}}
</l-button>
</view>
<view class="item">
<l-button
</view>
<view class="item">
<l-button
size="long"
plain="{{true}}"
bind:lintap="onWithdrawClick"
@ -48,8 +50,34 @@
>
{{t('account:action.withdraw')}}
</l-button>
</view>
</view>
</l-loading>
</block>
<block wx:else>
<view class="btn">
<view class="item">
<l-button
size="long"
bind:lintap="onDepositClick"
bgColor="{{textColor}}"
l-class="my-button"
>
{{t('account:action.deposit')}}
</l-button>
</view>
<view class="item">
<l-button
size="long"
plain="{{true}}"
bind:lintap="onWithdrawClick"
l-class="withdrawBtn my-button"
>
{{t('account:action.withdraw')}}
</l-button>
</view>
</view>
</view>
</block>
<block wx:if="{{depositOpen}}">
<l-popup
show="{{depositOpen}}"