更改了购物车逻辑,增加了地址管理
This commit is contained in:
@@ -64,6 +64,36 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 商品列表 -->
|
||||
<div class="items-section" v-if="paymentData.items && paymentData.items.length > 0">
|
||||
<h3 class="section-title">商品清单 ({{ paymentData.items.length }})</h3>
|
||||
<div class="items-list">
|
||||
<div
|
||||
v-for="item in paymentData.items"
|
||||
:key="item.id || item.productId"
|
||||
class="item-card"
|
||||
>
|
||||
<div class="item-image">
|
||||
<img :src="item.image || '/imgs/productdetail/商品主图.png'" :alt="item.name" />
|
||||
</div>
|
||||
<div class="item-info">
|
||||
<div class="item-name">{{ item.name }}</div>
|
||||
<div class="item-details">
|
||||
<span v-if="item.category" class="item-category">{{ item.category }}</span>
|
||||
<span v-if="item.size" class="item-size">{{ item.size }}</span>
|
||||
</div>
|
||||
<div class="item-price">
|
||||
<el-icon><Coin /></el-icon>
|
||||
<span>{{ item.points || item.price }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-quantity">
|
||||
<span class="quantity-label">x{{ item.quantity }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 支付方式选择 -->
|
||||
<div class="payment-method-section">
|
||||
<h3 class="section-title">支付方式</h3>
|
||||
@@ -162,7 +192,8 @@ const paymentData = ref({
|
||||
totalAmount: 0,
|
||||
pointsAmount: 0,
|
||||
beansAmount: 0,
|
||||
cartId: null
|
||||
cartId: null,
|
||||
items: [] // 添加商品列表
|
||||
})
|
||||
|
||||
// 计算属性
|
||||
@@ -201,7 +232,8 @@ const fetchPaymentData = async () => {
|
||||
totalAmount: 0,
|
||||
pointsAmount: 0,
|
||||
beansAmount: 0,
|
||||
cartId: null
|
||||
cartId: null,
|
||||
items: []
|
||||
}
|
||||
timeLeft.value = 900 // 默认15分钟
|
||||
startCountdown()
|
||||
@@ -218,7 +250,8 @@ const fetchPaymentData = async () => {
|
||||
totalAmount: data.totalAmount || 0,
|
||||
pointsAmount: data.pointsAmount || 0,
|
||||
beansAmount: data.beansAmount || 0,
|
||||
cartId: cartId
|
||||
cartId: cartId,
|
||||
items: data.items || [] // 获取商品列表
|
||||
}
|
||||
|
||||
// 设置倒计时时间(从后端获取,单位:秒)
|
||||
@@ -245,8 +278,8 @@ const handleGoBack = async () => {
|
||||
'确认要放弃付款吗?',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '狠心离开',
|
||||
cancelButtonText: '继续付款',
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
@@ -447,6 +480,7 @@ onUnmounted(() => {
|
||||
}
|
||||
|
||||
.amount-section,
|
||||
.items-section,
|
||||
.payment-method-section {
|
||||
background: white;
|
||||
padding: 16px;
|
||||
@@ -460,6 +494,85 @@ onUnmounted(() => {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.items-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.item-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 12px;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 8px;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.item-image {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.item-image img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.item-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.item-name {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
margin-bottom: 4px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.item-details {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.item-category,
|
||||
.item-size {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
background: #f0f0f0;
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.item-price {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 14px;
|
||||
color: #ffae00;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.item-quantity {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.quantity-label {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.amount-display {
|
||||
text-align: center;
|
||||
padding: 20px 0;
|
||||
|
||||
Reference in New Issue
Block a user