first commit
This commit is contained in:
121
pages/result/result.vue
Normal file
121
pages/result/result.vue
Normal file
@@ -0,0 +1,121 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<credit-header title="信用免押金" :show-badge="true"></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="goAddDevice">前往添加设备</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { onLoad, onUnload } from '@dcloudio/uni-app'
|
||||
import { getOrder } from '@/api/order'
|
||||
import { openPetApp } from '@/utils/pet-app'
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
// 添加设备在宠物 App 内完成,小程序只做交接
|
||||
function goAddDevice() {
|
||||
openPetApp()
|
||||
}
|
||||
</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>
|
||||
Reference in New Issue
Block a user