fix: 修复h5支付拉起微信或者支付宝客户端时,因支付结果页后 台提前预检测引起的支付单查询过早的问题

pull/8/head
ldh 2023-04-07 01:15:46 +08:00
parent 4d074d5964
commit 1fe14b9877
1 changed files with 38 additions and 12 deletions

View File

@ -41,11 +41,7 @@
> >
重新支付 重新支付
</button> </button>
<button <button class="check-btn ss-reset-button" v-if="payResult === 'success'" @tap="onOrder">
class="check-btn ss-reset-button"
v-if="payResult === 'success'"
@tap="sheep.$router.redirect('/pages/order/list')"
>
查看订单 查看订单
</button> </button>
<button <button
@ -74,9 +70,9 @@
</template> </template>
<script setup> <script setup>
import { onLoad } from '@dcloudio/uni-app'; import { onLoad, onHide, onShow } from '@dcloudio/uni-app';
import { reactive, computed } from 'vue'; import { reactive, computed } from 'vue';
import sheep from '@/sheep'; import { isEmpty } from 'lodash';
const state = reactive({ const state = reactive({
orderId: 0, orderId: 0,
@ -127,7 +123,7 @@
if (state.counter < 3 && state.result === 'unpaid') { if (state.counter < 3 && state.result === 'unpaid') {
setTimeout(() => { setTimeout(() => {
getOrderInfo(orderId); getOrderInfo(orderId);
}, 1000); }, 1500);
} }
// //
if (state.counter >= 3) { if (state.counter >= 3) {
@ -135,6 +131,14 @@
} }
} }
function onOrder() {
if ((state.orderType === 'recharge')) {
sheep.$router.redirect('/pages/pay/recharge-log');
} else {
sheep.$router.redirect('/pages/order/list');
}
}
// #ifdef MP // #ifdef MP
function subscribeMessage() { function subscribeMessage() {
let event = ['order_dispatched']; let event = ['order_dispatched'];
@ -152,21 +156,33 @@
if (options.orderSN) { if (options.orderSN) {
id = options.orderSN; id = options.orderSN;
} }
if (options.orderType === 'recharge') {
state.orderType = 'recharge';
}
if (options.id) { if (options.id) {
id = options.id; id = options.id;
} }
state.orderId = id; state.orderId = id;
if (options.orderType === 'recharge') {
state.orderType = 'recharge';
}
// //
if (options.payState === 'fail') { if (options.payState === 'fail') {
state.result = 'failed'; state.result = 'failed';
} else { } else {
// //
getOrderInfo(id); getOrderInfo(state.orderId);
} }
}); });
onShow(() => {
if(isEmpty(state.orderInfo)) return;
getOrderInfo(state.orderId);
})
onHide(() => {
state.result = 'unpaid';
state.counter = 0;
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -174,10 +190,12 @@
0% { 0% {
transform: rotate(0deg); transform: rotate(0deg);
} }
100% { 100% {
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
.score-img { .score-img {
width: 36rpx; width: 36rpx;
height: 36rpx; height: 36rpx;
@ -186,6 +204,7 @@
.pay-result-box { .pay-result-box {
padding: 60rpx 0; padding: 60rpx 0;
.pay-waiting { .pay-waiting {
margin-top: 20rpx; margin-top: 20rpx;
width: 60rpx; width: 60rpx;
@ -197,6 +216,7 @@
// -webkit-animation: rotation 1s linear infinite; // -webkit-animation: rotation 1s linear infinite;
animation: rotation 1s linear infinite; animation: rotation 1s linear infinite;
} }
.pay-img { .pay-img {
width: 130rpx; width: 130rpx;
height: 130rpx; height: 130rpx;
@ -214,8 +234,10 @@
color: #333333; color: #333333;
font-family: OPPOSANS; font-family: OPPOSANS;
} }
.btn-box { .btn-box {
width: 100%; width: 100%;
.back-btn { .back-btn {
width: 190rpx; width: 190rpx;
height: 70rpx; height: 70rpx;
@ -225,6 +247,7 @@
font-weight: 400; font-weight: 400;
color: #595959; color: #595959;
} }
.check-btn { .check-btn {
width: 190rpx; width: 190rpx;
height: 70rpx; height: 70rpx;
@ -236,17 +259,20 @@
margin-left: 32rpx; margin-left: 32rpx;
} }
} }
.subscribe-box { .subscribe-box {
.subscribe-img { .subscribe-img {
width: 44rpx; width: 44rpx;
height: 44rpx; height: 44rpx;
} }
.subscribe-title { .subscribe-title {
font-weight: 500; font-weight: 500;
font-size: 32rpx; font-size: 32rpx;
line-height: 36rpx; line-height: 36rpx;
color: #434343; color: #434343;
} }
.subscribe-start { .subscribe-start {
color: var(--ui-BG-Main); color: var(--ui-BG-Main);
font-weight: 700; font-weight: 700;