204 lines
5.0 KiB
Vue
Raw Normal View History

2025-03-29 16:01:43 +08:00
<template>
<view class="page flex flex-col">
<!-- <CustomNavBar title="风格选酒" :bgcolor="bgcolor"/> -->
<!-- <view class="" style="margin: 20rpx 0;font-size: 24rpx;color: #606060;padding-left: 32rpx;">
<view class="" >探索啤酒风味新边界</view>
</view> -->
<view class="container">
<scroll-view scroll-y style="height: 100%;width: 100%;">
<!-- 活动标题和描述 -->
<view class="activity-header">
<view class="activity-title">{{activityInfo.title || 'TasteRoom 风味屋 · 风味之旅系列'}}</view>
<view class="activity-desc">{{activityInfo.description || '探索啤酒风味新边界'}}</view>
2025-03-29 16:01:43 +08:00
</view>
<!-- 酒款列表 -->
<view class="beer-list">
<view class="beer-item" v-for="(item, index) in beerList" :key="index" @click="toBeer(item)">
<image class="beer-image" :src="item.cover" mode="aspectFill"></image>
<view class="beer-info">
<view class="beer-name">{{item.beerName}}</view>
<view class="beer-style">{{item.beerStyles}}</view>
<view class="beer-brand">{{item.brandName}}</view>
<view class="beer-rating">
<text>{{item.avgOverallRating || '4.9'}}</text>
<image src="@/static/vector.png" class="rating-icon"></image>
2025-03-29 16:01:43 +08:00
</view>
</view>
</view>
</view>
<view class="more-tip">更多新品发布信息敬请关注更新~</view>
2025-03-29 16:01:43 +08:00
</scroll-view>
</view>
<!-- <view class="flex align-center justify-between tip">
<text>开启新酒上枪通知第一时间获取新酒资讯</text>
<image src="@/static/add.png" style="width: 32rpx;height: 32rpx;"></image>
</view> -->
</view>
</template>
<script>
import {
getFeaturePage,
getBeerList
2025-03-29 16:01:43 +08:00
} from "@/api/platform.js"
export default {
components: {
},
data() {
return {
activityId: '',
activityInfo: {},
beerList: [],
2025-03-29 16:01:43 +08:00
queryForm: {
search: ''
2025-03-29 16:01:43 +08:00
},
bgcolor:'#19367A',
};
},
onLoad(options) {
if (options.id) {
this.activityId = options.id
this.getActivityDetail()
}
2025-03-29 16:01:43 +08:00
},
onShow(){
// uni.showTabBar()
},
methods: {
// 获取活动详情
async getActivityDetail() {
try {
const res = await getFeaturePage(this.activityId)
if (res.code === 200 && res.data) {
this.activityInfo = res.data
// 获取活动相关的酒款列表
this.getBeerList()
}
} catch (error) {
console.error('获取活动详情失败:', error)
uni.showToast({
title: '获取活动详情失败',
icon: 'none'
})
}
2025-03-29 16:01:43 +08:00
},
// 获取酒款列表
async getBeerList() {
try {
const res = await getBeerList(this.activityInfo.keyword || '')
if (res.code === 200 && res.data) {
this.beerList = res.data
}
} catch (error) {
console.error('获取酒款列表失败:', error)
uni.showToast({
title: '获取酒款列表失败',
icon: 'none'
})
}
2025-03-29 16:01:43 +08:00
},
// 跳转到酒款详情
2025-03-29 16:01:43 +08:00
toBeer(item) {
uni.navigateTo({
url: '/pages/index/review?beerId=' + item.id
})
},
showStyle() {
this.$refs.popup.open()
},
searchByStyle(item) {
this.queryForm.style = item.beerStyles
this.getNewBeerListByMonthFun()
this.$refs.popup.close()
},
// 获取新酒列表
getNewBeerListByMonthFun() {
getNewBeerListByMonth(this.queryForm).then(res => {
console.log(res)
this.currentMonth = res.data
})
},
clear() {
delete this.queryForm.style
this.$refs.popup.close()
this.getNewBeerListByMonthFun()
},
handleConfirm(v, selectedValue) {
console.log('当前项: ', v)
console.log('---------------')
console.log('全部项目(所有): ', selectedValue)
},
handleClose(v, callbackMenuList) {
// console.log('handleClose ==>', v, callbackMenuList)
},
handleOpen(v) {
// console.log('handleOpen ==>', v)
},
}
}
</script>
<style lang="scss" scoped>
.page {
height: 100vh;
background: #FFFFFF;
display: flex;
flex-direction: column;
font-family: Roboto;
.container {
height: calc(100vh - 102rpx);
margin-top: -24rpx;
border-radius: 12rpx;
padding: 24rpx;
// background: #F2F2F2;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
.style-btn {
border-radius: 12rpx;
background: #39E5B1;
font-family: Roboto;
font-size: 24rpx;
color: #0B0E26;
padding: 6rpx 10rpx;
}
.beerItem {
// padding-left: 18rpx;
// margin-left: 18rpx;
// border-left: 4rpx dashed #FFF;
.beerCard {
border-radius: 12rpx;
background: #FFFFFF;
padding: 24rpx 24rpx 20rpx;
margin-bottom: 24rpx;
}
}
}
.tip {
padding: 0 30rpx 0 48rpx;
border-radius: 12rpx;
background: rgba(254, 224, 52, 0.36);
height: 64rpx;
position: fixed;
bottom: env(safe-area-inset-bottom);
width: 100%;
color: #5E5F60;
font-size: 20rpx;
}
}
.active {
color: #FFC700;
}
.clearBtn {
font-size: 24rpx;
color: #5E5F60;
}
</style>