商城增加了取消订单,/transfers的bar增加了“已取消“板块
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<div class="nav-left">
|
||||
<el-button
|
||||
type="text"
|
||||
@click="$router.go(-1)"
|
||||
@click="handleGoBack"
|
||||
class="back-btn"
|
||||
>
|
||||
<el-icon><ArrowLeft /></el-icon>
|
||||
@@ -15,6 +15,7 @@
|
||||
<h1 class="nav-title">确认支付</h1>
|
||||
</div>
|
||||
<div class="nav-right">
|
||||
<!-- 占位元素,保持标题居中 -->
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@@ -194,8 +195,17 @@ const fetchPaymentData = async () => {
|
||||
const cartId = route.query.cartId
|
||||
|
||||
if (!cartId) {
|
||||
ElMessage.error('缺少购物车信息')
|
||||
router.go(-1)
|
||||
// 允许直接访问,使用默认数据
|
||||
ElMessage.warning('未指定购物车信息,使用默认支付数据')
|
||||
paymentData.value = {
|
||||
totalAmount: 0,
|
||||
pointsAmount: 0,
|
||||
beansAmount: 0,
|
||||
cartId: null
|
||||
}
|
||||
timeLeft.value = 900 // 默认15分钟
|
||||
startCountdown()
|
||||
loading.value = false
|
||||
return
|
||||
}
|
||||
|
||||
@@ -227,6 +237,30 @@ const fetchPaymentData = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const handleGoBack = async () => {
|
||||
// 如果倒计时还在进行中,显示确认弹窗
|
||||
if (timeLeft.value > 0) {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
'确认要放弃付款吗?',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '狠心离开',
|
||||
cancelButtonText: '继续付款',
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
// 用户确认放弃付款,跳转到PayFailed页面
|
||||
router.push('/payfailed')
|
||||
} catch {
|
||||
// 用户取消,什么都不做,留在当前页面
|
||||
}
|
||||
} else {
|
||||
// 倒计时已结束,直接返回
|
||||
router.go(-1)
|
||||
}
|
||||
}
|
||||
|
||||
const confirmPayment = async () => {
|
||||
if (timeLeft.value <= 0) {
|
||||
ElMessage.error('支付超时,请重新下单')
|
||||
@@ -308,6 +342,20 @@ onUnmounted(() => {
|
||||
padding: 12px 16px;
|
||||
background: white;
|
||||
border-bottom: 1px solid #eee;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.nav-left,
|
||||
.nav-right {
|
||||
width: 48px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.nav-center {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.nav-title {
|
||||
|
||||
Reference in New Issue
Block a user