291 lines
5.7 KiB
Plaintext
291 lines
5.7 KiB
Plaintext
<template>
|
|
<view class="favorites-page">
|
|
<!-- 沉浸式状态栏 -->
|
|
<view class="status-bar"></view>
|
|
|
|
<!-- 顶部导航栏 -->
|
|
<view class="nav-bar">
|
|
<image class="back-icon" src="/static/icons/back.svg" @click="goBack" mode="aspectFit" />
|
|
<text class="nav-title">我的收藏</text>
|
|
<view class="nav-placeholder"></view>
|
|
</view>
|
|
|
|
<!-- 收藏列表 -->
|
|
<view class="content">
|
|
<view v-if="favoritesList.length > 0" class="favorites-list">
|
|
<view
|
|
v-for="item in favoritesList"
|
|
:key="item.id"
|
|
class="shop-card"
|
|
@click="goToShop(item)"
|
|
>
|
|
<!-- 店铺图片 -->
|
|
<image class="shop-image" :src="item.shopImage" mode="aspectFill" />
|
|
|
|
<!-- 店铺信息 -->
|
|
<view class="shop-info">
|
|
<text class="shop-name">{{ item.shopName }}</text>
|
|
<view class="shop-meta">
|
|
<text class="ri-star-fill rating-icon"></text>
|
|
<text class="rating-text">{{ item.rating }}</text>
|
|
<text class="sales-text">月售{{ item.monthlySales }}</text>
|
|
</view>
|
|
<view class="shop-tags">
|
|
<text class="tag">{{ item.category }}</text>
|
|
<text class="tag">{{ item.distance }}</text>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 取消收藏按钮 -->
|
|
<view class="cancel-btn" @click.stop="cancelFavorite(item)">
|
|
<text class="ri-heart-fill cancel-icon"></text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 空状态 -->
|
|
<view v-else class="empty-state">
|
|
<text class="ri-heart-line empty-icon"></text>
|
|
<text class="empty-text">暂无收藏店铺</text>
|
|
<text class="empty-desc">去首页逛逛,收藏喜欢的店铺吧</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { onShow, onLoad, onReachBottom } from "@dcloudio/uni-app";
|
|
import { Service } from "@/Service/Service"
|
|
import { ref, computed } from "vue";
|
|
import { vpDiscountService } from "@/Service/vp/vpDiscountService"
|
|
|
|
|
|
let coupons = ref<Array<any>>([])
|
|
let status = ref<string>('loadmore')
|
|
let pageNo = ref<number>(1)
|
|
|
|
// 收藏列表数据
|
|
const favoritesList = ref([
|
|
{
|
|
id: 1,
|
|
shopName: '星巴克咖啡',
|
|
shopImage: 'https://picsum.photos/seed/shop1/200/200.jpg',
|
|
rating: 4.8,
|
|
monthlySales: 999,
|
|
category: '咖啡茶饮',
|
|
distance: '1.2km'
|
|
},
|
|
{
|
|
id: 2,
|
|
shopName: '海底捞火锅',
|
|
shopImage: 'https://picsum.photos/seed/shop2/200/200.jpg',
|
|
rating: 4.9,
|
|
monthlySales: 2000,
|
|
category: '火锅',
|
|
distance: '2.5km'
|
|
},
|
|
{
|
|
id: 3,
|
|
shopName: '喜茶 HEETEA',
|
|
shopImage: 'https://picsum.photos/seed/shop3/200/200.jpg',
|
|
rating: 4.7,
|
|
monthlySales: 1500,
|
|
category: '奶茶',
|
|
distance: '800m'
|
|
}
|
|
])
|
|
|
|
// 返回
|
|
const goBack = () => {
|
|
Service.GoPageBack()
|
|
}
|
|
|
|
// 跳转到店铺详情
|
|
const goToShop = (item) => {
|
|
uni.navigateTo({
|
|
url: `/pages/shop/shop?id=${item.id}`
|
|
})
|
|
}
|
|
|
|
// 取消收藏
|
|
const cancelFavorite = (item) => {
|
|
uni.showModal({
|
|
title: '取消收藏',
|
|
content: `确定取消收藏「${item.shopName}」吗?`,
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
// 从列表中移除
|
|
const index = favoritesList.value.findIndex(fav => fav.id === item.id)
|
|
if (index > -1) {
|
|
favoritesList.value.splice(index, 1)
|
|
uni.showToast({
|
|
title: '已取消收藏',
|
|
icon: 'success'
|
|
})
|
|
}
|
|
}
|
|
}
|
|
})
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.favorites-page {
|
|
min-height: 100vh;
|
|
background: #F5F5F5;
|
|
}
|
|
|
|
/* 状态栏 */
|
|
.status-bar {
|
|
background: linear-gradient(135deg, #FF6B00, #FF9500);
|
|
height: var(--status-bar-height);
|
|
width: 100%;
|
|
}
|
|
|
|
/* 导航栏 */
|
|
.nav-bar {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 60rpx 24rpx 20rpx 24rpx;
|
|
background: linear-gradient(135deg, #FF6B00, #FF9500);
|
|
}
|
|
|
|
.back-icon {
|
|
width: 48rpx;
|
|
height: 48rpx;
|
|
padding: 8rpx;
|
|
}
|
|
|
|
.nav-title {
|
|
font-size: 36rpx;
|
|
font-weight: 600;
|
|
color: #FFFFFF;
|
|
}
|
|
|
|
.nav-placeholder {
|
|
width: 48rpx;
|
|
}
|
|
|
|
/* 内容区域 */
|
|
.content {
|
|
padding: 20rpx;
|
|
}
|
|
|
|
/* 收藏列表 */
|
|
.favorites-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 16rpx;
|
|
}
|
|
|
|
.shop-card {
|
|
background: #FFFFFF;
|
|
border-radius: 16rpx;
|
|
padding: 20rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
|
|
position: relative;
|
|
}
|
|
|
|
.shop-image {
|
|
width: 160rpx;
|
|
height: 160rpx;
|
|
border-radius: 12rpx;
|
|
margin-right: 20rpx;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.shop-info {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 12rpx;
|
|
}
|
|
|
|
.shop-name {
|
|
font-size: 32rpx;
|
|
font-weight: 600;
|
|
color: #222222;
|
|
}
|
|
|
|
.shop-meta {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8rpx;
|
|
}
|
|
|
|
.rating-icon {
|
|
font-size: 24rpx;
|
|
color: #FFB800;
|
|
}
|
|
|
|
.rating-text {
|
|
font-size: 24rpx;
|
|
color: #FF6B00;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.sales-text {
|
|
font-size: 22rpx;
|
|
color: #999999;
|
|
}
|
|
|
|
.shop-tags {
|
|
display: flex;
|
|
gap: 12rpx;
|
|
}
|
|
|
|
.tag {
|
|
font-size: 20rpx;
|
|
color: #666666;
|
|
background: #F5F5F5;
|
|
padding: 4rpx 12rpx;
|
|
border-radius: 8rpx;
|
|
}
|
|
|
|
.cancel-btn {
|
|
width: 64rpx;
|
|
height: 64rpx;
|
|
background: #FFEBEE;
|
|
border-radius: 32rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-left: 16rpx;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.cancel-icon {
|
|
font-size: 32rpx;
|
|
color: #F44336;
|
|
}
|
|
|
|
/* 空状态 */
|
|
.empty-state {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 200rpx 0;
|
|
gap: 16rpx;
|
|
}
|
|
|
|
.empty-icon {
|
|
font-size: 120rpx;
|
|
color: #CCCCCC;
|
|
}
|
|
|
|
.empty-text {
|
|
font-size: 28rpx;
|
|
color: #999999;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.empty-desc {
|
|
font-size: 24rpx;
|
|
color: #CCCCCC;
|
|
}
|
|
</style>
|