fix: 去支付直接跳转收银台扫码支付,超时显示超时,失败显示错误信息
This commit is contained in:
@@ -56,6 +56,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</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>
|
<div class="checkout-card loading" v-else>
|
||||||
<el-icon class="is-loading" :size="32"><Loading /></el-icon>
|
<el-icon class="is-loading" :size="32"><Loading /></el-icon>
|
||||||
<p>正在创建支付订单...</p>
|
<p>正在创建支付订单...</p>
|
||||||
@@ -67,7 +73,7 @@
|
|||||||
import { ref, onMounted, onUnmounted } from 'vue'
|
import { ref, onMounted, onUnmounted } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { ElMessage } from 'element-plus'
|
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 { orderApi } from '../../api'
|
||||||
import QRCode from 'qrcode'
|
import QRCode from 'qrcode'
|
||||||
|
|
||||||
@@ -75,6 +81,7 @@ const route = useRoute()
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const qrCanvas = ref<HTMLCanvasElement>()
|
const qrCanvas = ref<HTMLCanvasElement>()
|
||||||
const paymentInfo = ref<any>(null)
|
const paymentInfo = ref<any>(null)
|
||||||
|
const paymentError = ref('')
|
||||||
const remaining = ref(0)
|
const remaining = ref(0)
|
||||||
const totalTime = ref(0)
|
const totalTime = ref(0)
|
||||||
let pollTimer: any = null
|
let pollTimer: any = null
|
||||||
@@ -97,8 +104,7 @@ async function createPayment() {
|
|||||||
startCountdown()
|
startCountdown()
|
||||||
startPolling()
|
startPolling()
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
ElMessage.error(err.response?.data?.error || '创建支付失败')
|
paymentError.value = err.response?.data?.error || '创建支付失败'
|
||||||
router.push('/orders')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,5 +331,11 @@ onUnmounted(() => {
|
|||||||
color: rgba(255, 255, 255, 0.5);
|
color: rgba(255, 255, 255, 0.5);
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.error-text {
|
||||||
|
color: #f56c6c;
|
||||||
|
font-size: 15px;
|
||||||
|
margin: 16px 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -111,11 +111,7 @@ onMounted(async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function goPay() {
|
function goPay() {
|
||||||
if (order.value?.payment_method === 'bepusdt') {
|
router.push(`/checkout/${order.value.id}`)
|
||||||
router.push(`/checkout/${order.value.id}`)
|
|
||||||
} else {
|
|
||||||
ElMessage.info('请联系客服完成支付')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function applyRefund() {
|
async function applyRefund() {
|
||||||
|
|||||||
@@ -70,11 +70,7 @@ async function fetchOrders() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function goPay(row: any) {
|
function goPay(row: any) {
|
||||||
if (row.payment_method === 'bepusdt') {
|
router.push(`/checkout/${row.id}`)
|
||||||
router.push(`/checkout/${row.id}`)
|
|
||||||
} else {
|
|
||||||
ElMessage.info('请联系客服完成支付')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function cancelOrder(id: number) {
|
async function cancelOrder(id: number) {
|
||||||
|
|||||||
Reference in New Issue
Block a user