继续完善购物逻辑闭环,consumer模块完成度80%
This commit is contained in:
@@ -127,6 +127,8 @@
|
||||
<text class="total-text">合计:</text>
|
||||
<text class="total-price">¥{{ totalPrice }}</text>
|
||||
</view>
|
||||
<!-- 结算按钮:即使在管理模式下,如果用户想结算也可以(或者在管理模式下隐藏结算,只显示删除) -->
|
||||
<!-- 需求:加购商品前面的按钮时;cart购物车页面顶部的管理点击能对加购商品进行批量删除 -->
|
||||
<button v-if="!isManageMode" class="checkout-btn" @click="goToCheckout">
|
||||
去结算({{ selectedCount }})
|
||||
</button>
|
||||
@@ -154,38 +156,58 @@ const mockRecommendProducts = [
|
||||
{
|
||||
id: 'rec_001',
|
||||
shopId: 'shop_rec_1',
|
||||
shopName: '极速运动专营店',
|
||||
shopName: '潮流运动旗舰店',
|
||||
name: '运动保温杯',
|
||||
price: 59,
|
||||
image: 'https://picsum.photos/100/100?random=11',
|
||||
specification: '黑色 500ml'
|
||||
specification: '颜色:星空黑 | 容量:500ml | 材质:304不锈钢',
|
||||
specDetails: {
|
||||
color: '星空黑',
|
||||
capacity: '500ml',
|
||||
material: '304不锈钢'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'rec_002',
|
||||
shopId: 'shop_rec_2',
|
||||
shopName: '品质生活居家',
|
||||
shopName: '智能家居生活馆',
|
||||
name: '声波电动牙刷',
|
||||
price: 129,
|
||||
image: 'https://picsum.photos/100/100?random=12',
|
||||
specification: '象牙白 配刷头'
|
||||
specification: '颜色:珍珠白 | 刷头:敏感型×2 | 续航:30天',
|
||||
specDetails: {
|
||||
color: '珍珠白',
|
||||
brushHead: '敏感型×2',
|
||||
batteryLife: '30天'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'rec_003',
|
||||
shopId: 'shop_rec_3',
|
||||
shopName: '健康护理大药房',
|
||||
shopName: '健康防护专家店',
|
||||
name: '医用护理口罩',
|
||||
price: 29.9,
|
||||
image: 'https://picsum.photos/100/100?random=13',
|
||||
specification: '独立包装 50只'
|
||||
specification: '规格:三层防护 | 数量:50只独立装 | 执行标准:YY0469',
|
||||
specDetails: {
|
||||
layers: '三层防护',
|
||||
quantity: '50只',
|
||||
standard: 'YY0469'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'rec_004',
|
||||
shopId: 'shop_rec_1',
|
||||
shopName: '极速运动专营店',
|
||||
shopId: 'shop_rec_4',
|
||||
shopName: '户外运动装备店',
|
||||
name: '专业护膝',
|
||||
price: 45,
|
||||
image: 'https://picsum.photos/100/100?random=14',
|
||||
specification: 'L码 单只装'
|
||||
specification: '尺码:L码 | 材质:记忆棉+弹力布 | 适用:篮球/跑步',
|
||||
specDetails: {
|
||||
size: 'L码',
|
||||
material: '记忆棉+弹力布',
|
||||
suitableFor: '篮球/跑步'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -442,7 +464,31 @@ const goToCheckout = () => {
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.navigateTo({ url: '/pages/mall/consumer/checkout' })
|
||||
|
||||
// 获取选中的商品
|
||||
const selectedItems = cartItems.value
|
||||
.filter(item => item.selected)
|
||||
.map(item => ({
|
||||
id: item.id,
|
||||
product_id: item.id, // 使用商品ID作为product_id
|
||||
sku_id: item.id, // 使用商品ID作为sku_id
|
||||
product_name: item.name,
|
||||
product_image: item.image,
|
||||
sku_specifications: item.spec,
|
||||
price: item.price,
|
||||
quantity: item.quantity
|
||||
}))
|
||||
|
||||
// 跳转到结算页面并传递数据
|
||||
uni.navigateTo({
|
||||
url: '/pages/mall/consumer/checkout',
|
||||
success: (res) => {
|
||||
// 通过eventChannel传递数据
|
||||
res.eventChannel.emit('acceptData', {
|
||||
selectedItems: selectedItems
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -792,17 +838,17 @@ const goToCheckout = () => {
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.recommend-name {
|
||||
font-size: 13px;
|
||||
color: #333;
|
||||
margin-bottom: 5px;
|
||||
line-height: 1.4;
|
||||
height: 36px;
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
.recommend-name {
|
||||
font-size: 13px;
|
||||
color: #333;
|
||||
margin-bottom: 5px;
|
||||
line-height: 1.4;
|
||||
height: 36px;
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.recommend-bottom {
|
||||
display: flex;
|
||||
@@ -1092,4 +1138,4 @@ const goToCheckout = () => {
|
||||
padding: 8px 25px;
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user