|
|
@@ -1,4 +1,5 @@
|
|
|
<script setup lang="ts">
|
|
|
+import type { OmsOrder } from '@/api/globals'
|
|
|
import router from '@/router'
|
|
|
|
|
|
definePage({
|
|
|
@@ -10,39 +11,57 @@ definePage({
|
|
|
},
|
|
|
})
|
|
|
|
|
|
-const loading = ref(true)
|
|
|
-const payStatus = ref(0)
|
|
|
+const orderNo = ref('')
|
|
|
+const orderInfo = ref<OmsOrder>()
|
|
|
+const countdownTime = ref(3000) // 3秒倒计时
|
|
|
|
|
|
-onLoad((options: any) => {
|
|
|
- if (options.payStatus) {
|
|
|
- payStatus.value = Number(options.payStatus)
|
|
|
+// 倒计时结束后查询订单
|
|
|
+async function handleCountdownFinish() {
|
|
|
+ if (!orderNo.value) {
|
|
|
+ goToOrderList()
|
|
|
+ return
|
|
|
}
|
|
|
- const outerOrderId = options.outerOrderId || ''
|
|
|
|
|
|
- // 延迟跳转,显示 loading 效果
|
|
|
- setTimeout(() => {
|
|
|
- loading.value = false
|
|
|
+ try {
|
|
|
+ const res = await Apis.general.get_smqjh_oms_api_v1_order_orderinfo({
|
|
|
+ params: { orderNo: orderNo.value },
|
|
|
+ })
|
|
|
+ orderInfo.value = res.data
|
|
|
|
|
|
- if (payStatus.value === 1) {
|
|
|
- // 支付成功,跳转支付成功页
|
|
|
+ // 有订单数据则跳转支付成功页
|
|
|
+ if (orderInfo.value?.orderNumber) {
|
|
|
router.replace({
|
|
|
name: 'paySuccess',
|
|
|
- params: { outerOrderId },
|
|
|
+ params: { outerOrderId: orderNo.value },
|
|
|
})
|
|
|
}
|
|
|
else {
|
|
|
- router.pushTab({ name: 'order' })
|
|
|
- useTabbar().setTabbarItemActive('order')
|
|
|
+ goToOrderList()
|
|
|
}
|
|
|
- }, 3000)
|
|
|
+ }
|
|
|
+ catch {
|
|
|
+ goToOrderList()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function goToOrderList() {
|
|
|
+ router.pushTab({ name: 'order' })
|
|
|
+ useTabbar().setTabbarItemActive('order')
|
|
|
+}
|
|
|
+
|
|
|
+onLoad((options: any) => {
|
|
|
+ orderNo.value = options.outerOrderId || ''
|
|
|
})
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<view class="min-h-100vh flex flex-col items-center justify-center bg-#f5f5f5">
|
|
|
- <wd-loading v-if="loading" size="64rpx" />
|
|
|
- <view v-if="loading" class="mt24rpx text-28rpx text-#999">
|
|
|
- 正在处理中... {{ payStatus }}
|
|
|
+ <view class="text-32rpx text-#333">
|
|
|
+ 正在处理中,请稍候...
|
|
|
+ </view>
|
|
|
+ <view class="mt24rpx flex items-center text-28rpx text-#999">
|
|
|
+ <wd-count-down :time="countdownTime" format="ss" @finish="handleCountdownFinish" />
|
|
|
+ <text>秒后跳转</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|