634 lines
16 KiB
Vue
Raw Normal View History

<template>
<view class="page">
<!-- <view style="position: fixed;left:0px;z-index: 100;" :style="{'top': statusBaeHeight + 58 + 'px'}">
<view class="search-box" style="background: #F2F2F2;">
<input type="text" disabled placeholder="搜索酒款/酒厂" @click="toSearch">
</view>
</view> -->
<view v-if="showJoinImg && bannerJoin" class="join-box" @click="toJoin">
<image :src="bannerJoin.bannerUrl" class="img"></image>
</view>
<!-- 轮播 -->
<swiper v-else class="join-box" circular :autoplay="true" :indicator-dots="true">
<swiper-item v-for="(item,index) in homeBanner" :key="index">
<image :src="item.bannerUrl" class="img"></image>
</swiper-item>
</swiper>
<!-- 快捷导航 -->
<view class="bg-white"
style="border-radius: 30rpx 30rpx 12rpx 12rpx;padding-top:8rpx;position: relative;margin-top:-20rpx">
<view class="search-box">
<!-- <text class="cuIcon-search" style="font-size: 40rpx;color: #A2A2A2;margin-right: 24rpx;"></text>
<input type="text" disabled placeholder="搜索酒款/酒厂" @click="toSearch"> -->
<input style="flex:1;margin-left: 20rpx;" v-model="keyword" type="text" placeholder="搜索酒款/酒厂" @confirm="search" @input="changeSearch">
<view class="searchs" @click="search" style="">
<uni-icons type="search" size="30" color="#fff"></uni-icons>
</view>
</view>
<view class="flex justify-between bg-white" style="padding: 20rpx 36rpx;">
<view class="nav-item" @click="toGo(1)">
<view class="flex justify-center align-center img-box">
<image src="/static/nav-1.png" style="width: 48rpx;height: 48rpx;"></image>
</view>
<text class="text-bold">新酒上市</text>
</view>
<view class="nav-item" @click="toGo(2)">
<view class="flex justify-center align-center img-box">
<image src="/static/nav-2.png" style="width: 48rpx;height: 48rpx;"></image>
</view>
<text class="text-bold">生成酒单</text>
</view>
<view class="nav-item" @click="toGo(3)">
<view class="flex justify-center align-center img-box">
<image src="/static/nav-3.png" style="width: 48rpx;height: 48rpx;"></image>
</view>
<text class="text-bold">酒币换购</text>
</view>
<view class="nav-item" @click="toGo(4)">
<view class="flex justify-center align-center img-box">
<image src="/static/nav-4.png" style="width: 48rpx;height: 48rpx;"></image>
</view>
<text class="text-bold">关注厂牌</text>
</view>
</view>
</view>
<!-- <commonTitle title="热门活动招募"></commonTitle> -->
<view style="margin:46rpx 0 16rpx 24rpx;font-size: 40rpx;font-weight:bold;color: #030303;">
<text >热门活动招募</text></view>
<!-- 专辑列表 -->
<!-- <view v-for="(item,i) in featurePageList" :key="i" class="bg-white">
<view class="flex justify-between align-center title-box" @click="toFeaturePage(item)">
<view class="flex-1 flex flex-col">
<text class="title">{{ item.pageName }}</text>
<text class="sub">{{ item.subTitle}}</text>
</view>
<image src="@/static/arrow-right.png" style="width: 48rpx;height: 48rpx;"></image>
</view>
<rowBeer :beers="item.beers" />
</view> -->
<view class="flex-1 list-container" style="padding:0 24rpx 24rpx">
<scroll-view style="height: 100%;" scroll-y="true" @scrolltolower="changePage">
<view class="activity-item flex" v-for="(it, index) in featurePageList" :key="index" @click="toDetail(it)">
<view class="left flex flex-col justify-between align-center">
<image :src="it.brandLogo" style="width: 140rpx;height: 140rpx;">
</image>
<text >活动状态</text>
<view v-if="it.stage == 0">未开始</view>
<view v-if="it.stage == 2">已结束</view>
<view v-if="it.stage == 3">已结束</view>
<view v-if="it.stage == 4">活动停止</view>
<view v-if="it.stage == 1" class="margin-bottom-xs" style="color: #9E9E9E;font-size: 24rpx;">招募即将结束</view>
<view v-if="it.stage == 1">
<text style="font-size: 72rpx; color: #DE3C4B;">{{it.remainingDays}}</text>
</view>
</view>
<view class="right">
<view class="title">{{ it.breweryName }}焦糖</view>
<!-- <view class="title">{{ it.activityName }}</view> -->
<view class="sub">时间首次扫码开始累计 <text style="color:#DE3C4B">{{it.duration?it.duration:0}}天内</text></view>
<view class="sub">目标全系列酒款累积扫码 {{ it.activityTarget?it.activityTarget:0}}</view>
<scroll-view v-if="it.beers" scroll-x="true" class="scroll-img">
<view class="beer-box" v-for="(it, index) in it.beers" :key="index" @click="toReview(it)">
<image v-if="it.cover" :src="it.cover" class="cover"></image>
</view>
</scroll-view>
<view class="flex align-center" style="height:40rpx;">
<text class="zeng"></text>
<text style="color: #030303;font-size: 28rpx;">焦糖肉桂红柿子*3L*1</text>
</view>
<!-- <view class="flex align-center">
<text v-if="it.activityRewardType == 2 || (it.activityRewardType == 1 && it.activityRewardGoods)" class="zeng"></text>
<text v-if="it.activityRewardType == 1 && it.activityRewardGoods" style="color: #0B0E26;font-size: 24rpx;">{{it.activityRewardGoods.goodsName}} * {{it.activityRewardCount}}</text>
<text v-if="it.activityRewardType == 2" style="color: #0B0E26;font-size: 24rpx;">啤酒币 * {{it.activityRewardCount}}</text>
</view> -->
</view>
</view>
<view class="cu-load" style="height: 88rpx;"></view>
<view class="more-btn-box" @click="moreClick">
<view class="more-btn">更多热门活动招募</view>
</view>
</scroll-view>
</view>
<!-- <view class="weixin-box zixuns">
<text>入驻助理在线服务1对1咨询使用指南~</text>
<view class="btn" @click="toAddAiad">立即添加</view>
</view> -->
<!-- <view class="weixin-box zixuns">
<text>账户正在审核中请稍等~</text>
<view class="btn" @click="toAddAiad">立即添加</view>
</view> -->
<loginPopup ref="loginRef" @loginSuccess="loginSuccess"></loginPopup>
<!-- 开屏广告 -->
<uni-popup ref="ADRef" type="center" :is-mask-click="false" maskBackgroundColor="rgba(0,0,0,0.7)">
<view class="flex flex-col align-center justify-center" style="width: 630rpx;height: 61vh;">
<swiper class="swiper" style="width: 630rpx;height: 58vh;" circular :autoplay="true"
:indicator-dots="true">
<swiper-item v-for="(item,index) in ADList" :key="index">
<image :src="item.bannerUrl" style="width: 630rpx;height: 50vh;border-radius: 30rpx;"
@click="handleAD(item)">
</image>
</swiper-item>
</swiper>
<text class="cuIcon-roundclose text-white" style="font-size: 68rpx !important;" @click="closeAd"></text>
</view>
</uni-popup>
</view>
</template>
<script>
import {
getBannerList
} from '@/api/bar.js'
import {
listFeaturePage
} from '@/api/platform.js'
import commonTitle from '@/components/commonTitle.vue'
import loginPopup from '@/components/loginPopup.vue';
import rowBeer from '@/components/rowBeer.vue'
export default {
components: {
commonTitle,
loginPopup,
rowBeer
},
data() {
return {
statusBaeHeight: 0,
curTag: 0,
ADList: [], // 广告弹窗
bannerJoin: null, // 入驻banner
showJoinImg: false, // 是否显示入驻图片
userInfo: null,
featurePageList: [], // 专辑页列表
homeBanner: [], //首页banner
};
},
onLoad() {
// setTimeout(() => {
// uni.setNavigationBarColor({
// frontColor: '#ffffff',
// backgroundColor: '#FFFFFF',
// animation: {
// duration: 400,
// timingFunc: 'easeIn'
// }
// })
// }, 500)
this.statusBaeHeight = uni.getWindowInfo.statusBarHeight
this.getBannerListFun() // 广告轮播图
uni.showShareMenu({
menus: ['shareAppMessage', 'shareTimeline']
})
},
onShow() {
this.userInfo = uni.getStorageSync('userInfo')
if (this.userInfo == null || this.userInfo.userType == '09') { // 没登录或者没入驻
this.showJoinImg = true
}else {
this.showJoinImg = false
}
this.getFeaturePageListFun() // 专辑页列表
},
// onPullDownRefresh(){
// this.getFeaturePageListFun() // 专辑页列表
// },
methods: {
loginSuccess() {
this.userInfo = uni.getStorageSync('userInfo')
if (this.userInfo == null || this.userInfo.userType == '09') { // 没登录或者没入驻
console.log('登录')
this.showJoinImg = true
}else {
this.showJoinImg = false
}
},
toAddAiad() {
uni.navigateTo({
url: '/pagesMy/addAiad'
})
},
// 搜索
toSearch() {
// uni.navigateTo({
// url: '/pages/index/searchBeer'
// })
uni.navigateTo({
url: '/pagesActivity/homeSearch'
})
},
changeTag(index) {
this.curTag = index
},
// 查询广告弹窗 banner列表
getBannerListFun() {
this.ADList = []
this.homeBanner = []
this.bannerJoin = null
getBannerList().then(res => {
res.data.forEach(it => {
if (it.bannerType == 'homeAD') { // 开屏广告
this.ADList.push(it)
} else if (it.bannerType == 'homeJoin') { // 入驻
this.bannerJoin = it
} else if (it.bannerType == 'homeBanner') { // 首页banner
this.homeBanner.push(it)
}
})
let showHomeAD = uni.getStorageSync('showHomeAD')
if (!showHomeAD) {
this.$refs.ADRef.open()
}
})
},
// 关闭广告
closeAd() {
uni.setStorageSync('showHomeAD', true)
uni.setTabBarStyle({
backgroundColor: '#ffffff'
})
this.$refs.ADRef.close()
},
handleAD(item) {
this.closeAd()
if (item.bannerLink) {
uni.navigateTo({
url: item.bannerLink,
})
}
},
// 立即入驻
toJoin() {
if (!this.bannerJoin) return
uni.navigateTo({
url: this.bannerJoin.bannerLink,
})
},
// 跳转专辑页
toFeaturePage(item) {
uni.navigateTo({
url: `/pages/index/featureInfo?id=${item.id}`
})
},
// 查询专辑页列表
getFeaturePageListFun() {
listFeaturePage().then(res => {
this.featurePageList = res.data
})
},
// 跳转酒评页
toReview(it) {
uni.navigateTo({
url: "/pages/index/review?beerId=" + it.id
})
},
toGo(key) {
switch (key) {
case 1: // 新酒上市
uni.navigateTo({
url: "/pages/index/newBeer"
})
break;
case 2: // 生成酒单
if (!uni.getStorageSync('token')) {
this.$refs.loginRef.open()
return
}
uni.navigateTo({
url: "/pagesActivity/winelist"
})
break;
case 3: //酒币换购
if (!uni.getStorageSync('token')) {
this.$refs.loginRef.open()
return
}
uni.navigateTo({
url: "/pagesCoin/beerCoin"
})
break;
case 4: // 关注酒厂
if (!uni.getStorageSync('token')) {
this.$refs.loginRef.open()
return
}
uni.navigateTo({
url: '/pagesMy/myAttention'
})
break;
}
},
moreClick() {
uni.navigateTo({
url: "/pages/activityList/activityList"
})
}
}
}
</script>
<style lang="scss" scoped>
/deep/.uni-popup {
z-index: 1025;
}
.page {
// background: #FDFDFD;
height: 100vh;
overflow-y: auto;
font-family: Roboto;
// padding-bottom: calc(110rpx + constant(safe-area-inset-bottom));
// padding-bottom: calc(110rpx + env(safe-area-inset-bottom));
}
.search-box {
border-radius: 24rpx;
width: 700rpx;
height: 80rpx;
background-color: rgba(243, 243, 243, 0.8);
display: flex;
align-items: center;
padding: 32rpx 0;
margin: 26rpx auto;
box-sizing: border-box;
.searchs{
background: #D42E78;
width: 80rpx;
height: 80rpx;
border-radius: 0 24rpx 24rpx 0;
display: flex;
justify-content: center;
align-items: center;
}
}
.list-container {
// margin-top: -300rpx;
// padding-top: 5rpx;
overflow-y: auto;
// padding-bottom: calc(110rpx + constant(safe-area-inset-bottom));
// padding-bottom: calc(110rpx + env(safe-area-inset-bottom));
.card {
border-radius: 40rpx;
}
.avatar {
width: 160rpx;
height: 160rpx;
border-radius: 8rpx;
}
// 累积活动
.activity-item {
border-radius: 20rpx;
background: #FDFDFD;
box-sizing: border-box;
border: 1px solid #F2F2F2;
width: 702rpx;
margin-top: 5rpx;
margin-bottom: 35rpx;
.left {
padding: 24rpx 16rpx;
border-radius: 20rpx;
background: #FFFFFF;
box-sizing: border-box;
border: 1px solid #EFEDE9;
width: 180rpx;
margin-top: -10rpx;
margin-bottom: -10rpx;
// height: 428rpx;
}
.right {
padding: 24rpx 0 22rpx 16rpx;
flex:1;
.title {
font-size: 32rpx;
font-weight: bold;
line-height: 48rpx;
color: #0B0E26;
margin-bottom: 16rpx;
height: 48rpx;
}
.sub {
font-size: 28rpx;
font-weight: 500;
line-height: 40rpx;
color: #0B0E26;
margin-bottom: 16rpx;
}
.scroll-img {
width: 500rpx;
display: flex;
flex-direction: row;
white-space: nowrap;
height: 144rpx;
margin-bottom: 18rpx;
.beer-box {
width: 100rpx;
background: #FFFFFF;
margin-right: 20rpx;
box-sizing: border-box;
display: inline-block;
// &:nth-child(1) {
// margin-left: 32rpx;
// }
.cover {
width: 100rpx;
height: 144rpx;
border-radius: 10rpx;
}
}
}
.zeng {
font-size: 20rpx;
font-weight: bold;
line-height: normal;
text-align: center;
color: #0B0E26;
padding: 8rpx 12rpx;
border-radius: 10rpx;
background: #FEE034;
margin-right: 20rpx;
}
}
}
}
.join-box {
// margin: 20rpx 0;
// border-radius: 30rpx;
box-sizing: border-box;
// border: 1.5px solid #F2F2F2;
// padding: 34rpx 26rpx;
// height: 450rpx;
// height: 1130rpx;
height: 562rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
.btn {
width: 582rpx;
height: 68rpx;
border-radius: 24rpx;
text-align: center;
line-height: 68rpx;
margin: 0 auto;
background: #D42E78;
}
.img {
width: 100%;
height: 100%;
}
}
.swiper {
margin-bottom: 20rpx;
height: 400rpx;
}
// 快捷导航
.nav-item {
text-align: center;
color: #0B0E26;
.img-box {
width: 146rpx;
height: 146rpx;
background: #F2F2F2;
border-radius: 50%;
margin-bottom: 18rpx;
}
}
.quickNav-box {
border-radius: 20rpx;
background: #FFFFFF;
width: 100%;
padding: 32rpx 24rpx;
height: 490rpx;
box-sizing: border-box;
.left {
height: 416rpx;
width: 352rpx;
// width: 47%;
border-radius: 20rpx;
margin-right: 22rpx;
}
.right {
height: 196rpx;
// width: 326rpx;
width: 100%;
margin-bottom: 22rpx;
border-radius: 20rpx;
}
}
.goods-box {
border-radius: 30rpx;
background: rgba(255, 255, 255, 0.2);
box-sizing: border-box;
border: 1px solid #F2F2F2;
box-shadow: 0px 5.47px 43.78px 0px rgba(0, 0, 0, 0.05);
display: flex;
padding: 16rpx 32rpx;
margin: 20rpx 32rpx 0;
.cover {
width: 208rpx;
height: 300rpx;
border-radius: 30rpx;
margin-right: 14rpx;
}
}
.tag {
background-color: transparent;
border-radius: 12rpx;
padding: 12rpx 20rpx;
border: 1px solid #9D9D9D;
;
margin-right: 24rpx;
margin-bottom: 50rpx;
}
.active-tag {
background-color: #FEE034;
font-weight: bold;
border: 1px solid #FEE034;
}
.title-box {
padding: 24rpx 32rpx;
margin-bottom: 28rpx;
box-sizing: border-box;
.title {
font-size: 32rpx;
font-weight: bold;
color: #1E2019;
line-height: 130%;
}
.sub {
font-size: 20rpx;
color: #9D9D9D;
}
}
.more-btn-box {
width: 92%;
height: 88rpx;
margin: 32rpx auto;
background: linear-gradient(135deg, #19367A, #2C4C99);
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4rpx 16rpx rgba(25, 54, 122, 0.2);
transition: all 0.3s ease;
&:active {
transform: scale(0.98);
box-shadow: 0 2rpx 8rpx rgba(25, 54, 122, 0.1);
}
.more-btn {
font-size: 32rpx;
font-weight: 400;
letter-spacing: 2rpx;
color: #FFFFFF;
}
}
.zixuns {
padding: 0 34rpx 0 20rpx;
background: rgba(0, 0, 0, 0.6);
}
</style>