Files
chongdun-mianya/pages/result/result.vue
2026-11-13 09:37:34 +08:00

121 lines
2.4 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="page">
<credit-header title="信用免押金"></credit-header>
<view class="result">
<view class="success-icon">
<view class="success-check"></view>
</view>
<view class="result-title">成功</view>
<view class="result-desc">免押申请成功</view>
<view v-if="pollDone && !confirmed" class="result-hint">订单状态确认中,稍后可在支付宝订单中查看</view>
</view>
<view class="bottom-bar">
<button class="btn-primary" @tap="handleDone">知道了</button>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { onLoad, onUnload } from '@dcloudio/uni-app'
import { getOrder } from '@/api/order'
const orderId = ref('')
const confirmed = ref(false)
const pollDone = ref(false)
let pollTimes = 0
let pollTimer = null
onLoad((query) => {
orderId.value = (query && query.orderId) || ''
loadOrder()
})
onUnload(() => {
if (pollTimer) clearTimeout(pollTimer)
})
async function loadOrder() {
if (!orderId.value) return
try {
const order = await getOrder(orderId.value)
confirmed.value = !!order && order.status === 'ACTIVE'
} catch (error) {
// 查询失败不打断展示,状态可在支付宝订单详情中查看
}
if (confirmed.value) return
if (pollTimes < 6) {
pollTimes += 1
pollTimer = setTimeout(loadOrder, 1200)
} else {
pollDone.value = true
}
}
// 免押流程到此结束,回到首页
function handleDone() {
uni.reLaunch({ url: '/pages/index/index' })
}
</script>
<style>
.page {
min-height: 100vh;
padding-bottom: 220rpx;
background: #ffffff;
}
.result {
display: flex;
flex-direction: column;
align-items: center;
padding-top: 120rpx;
}
.success-icon {
display: flex;
align-items: center;
justify-content: center;
width: 160rpx;
height: 160rpx;
border-radius: 50%;
background: linear-gradient(180deg, #4a90ff 0%, #1e6bff 100%);
box-shadow: 0 16rpx 40rpx rgba(30, 107, 255, 0.28);
}
.success-check {
width: 62rpx;
height: 34rpx;
margin-top: -10rpx;
border-left: 8rpx solid #ffffff;
border-bottom: 8rpx solid #ffffff;
transform: rotate(-45deg);
}
.result-title {
margin-top: 48rpx;
font-size: 40rpx;
font-weight: 600;
color: #1a1a1a;
}
.result-desc {
margin-top: 16rpx;
font-size: 28rpx;
color: #666666;
}
.result-hint {
margin-top: 24rpx;
padding: 0 64rpx;
text-align: center;
font-size: 24rpx;
line-height: 1.6;
color: #999999;
}
</style>