fix: 去支付直接跳转收银台扫码支付,超时显示超时,失败显示错误信息

This commit is contained in:
2026-05-27 10:14:15 +08:00
parent 5d3e045e12
commit 5ca5df3a50
3 changed files with 17 additions and 13 deletions
+15 -3
View File
@@ -56,6 +56,12 @@
</div>
</div>
<div class="checkout-card loading" v-else-if="paymentError">
<el-icon :size="40" color="#f56c6c"><CircleCloseFilled /></el-icon>
<p class="error-text">{{ paymentError }}</p>
<el-button @click="$router.push('/orders')">返回订单</el-button>
</div>
<div class="checkout-card loading" v-else>
<el-icon class="is-loading" :size="32"><Loading /></el-icon>
<p>正在创建支付订单...</p>
@@ -67,7 +73,7 @@
import { ref, onMounted, onUnmounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { Loading } from '@element-plus/icons-vue'
import { Loading, CircleCloseFilled } from '@element-plus/icons-vue'
import { orderApi } from '../../api'
import QRCode from 'qrcode'
@@ -75,6 +81,7 @@ const route = useRoute()
const router = useRouter()
const qrCanvas = ref<HTMLCanvasElement>()
const paymentInfo = ref<any>(null)
const paymentError = ref('')
const remaining = ref(0)
const totalTime = ref(0)
let pollTimer: any = null
@@ -97,8 +104,7 @@ async function createPayment() {
startCountdown()
startPolling()
} catch (err: any) {
ElMessage.error(err.response?.data?.error || '创建支付失败')
router.push('/orders')
paymentError.value = err.response?.data?.error || '创建支付失败'
}
}
@@ -325,5 +331,11 @@ onUnmounted(() => {
color: rgba(255, 255, 255, 0.5);
margin-top: 16px;
}
.error-text {
color: #f56c6c;
font-size: 15px;
margin: 16px 0;
}
}
</style>
+1 -5
View File
@@ -111,11 +111,7 @@ onMounted(async () => {
})
function goPay() {
if (order.value?.payment_method === 'bepusdt') {
router.push(`/checkout/${order.value.id}`)
} else {
ElMessage.info('请联系客服完成支付')
}
router.push(`/checkout/${order.value.id}`)
}
async function applyRefund() {
+1 -5
View File
@@ -70,11 +70,7 @@ async function fetchOrders() {
}
function goPay(row: any) {
if (row.payment_method === 'bepusdt') {
router.push(`/checkout/${row.id}`)
} else {
ElMessage.info('请联系客服完成支付')
}
router.push(`/checkout/${row.id}`)
}
async function cancelOrder(id: number) {