< template >
< view class = "bg" >
< image v-if ="headImg" :src="showImg(headImg)" class="topImg" mode="widthFix" > < / image >
< view class = "main-container" >
< image class = "title-image" src = "https://static.ticket.sz-trip.com/uploads/20250815/36ddcb32b78b28ee6f6991ae9af8c52f.png" > < / image >
< view class = "coupon-box" >
< view class = "rule" @click ="goRule(1)" > 活动规则 < / view >
< view class = "coupon-tip" > 消费券领取后3天内未使用自动失效 < br > 失效后可再次领取 < / view >
< view class = "flex-between" style = "flex-wrap: wrap;margin-top: 26rpx;" >
< image class = "coupon-img" v -for = " ( item , i ) in couponList " :key ="i"
: src = "item.img" @ click = "getCoupon(item)" mode = "aspectFill" > < / image >
< / view >
< / view >
<!-- < image class = "adv-image" mode = "aspectFill" @click ="gotoPath('/subPackages/activity/agriculturalProdNH')"
src = "https://static.ticket.sz-trip.com/uploads/20250902/fbb790d1c51d067d30cef50b34f06286.png" > < / image >
-- >
< image class = "title-image" style = "margin:57rpx auto 30rpx;" src = "https://static.ticket.sz-trip.com/uploads/20250821/e45546af63bafab92ac2e8783d7b079c.png" > < / image >
< view class = "row-product" v -for = " ( item , index ) in list.slice ( 0 , viewNum ) "
: key = "index" @ click = "gotoDetailByType(item)" >
< image class = "img" :src ="showImg(item.headimg)" mode = "aspectFill" > < / image >
< view class = "content flex-column" >
< view class = "title text-overflowRows" > { { item . title } } < / view >
< view class = "tags" v-if ="item.display_tags" >
< view class = "tag" v-for ="(tag,tagI) in item.display_tags.split(',')" :key ="tagI" > {{ tag }} < / view >
< / view >
< view class = "flex-between" >
< view class = "price" > { { item . price / 100 } } < / view >
< view class = "btn" > 立即购买 < / view >
< / view >
< / view >
< / view >
< view class = "view-more" v-if ="list.length>0&&viewNum<=3" @click="viewNum=999" > 查看更多 < / view >
< view class = "type-container" >
< view :class ="['type-item',typeIndex==i?'active':'']" @click ="typeIndex=i"
v - for = "(item,i) in typeList" : key = "i" > { { item . title } } < / view >
< / view >
< view class = "flex-between" style = "flex-wrap: wrap;" >
< view class = "column-product" @click ="gotoDetailByType(item)" :key ="index"
v - for = "(item,index) in typeList[typeIndex].list.slice(0,typeList[typeIndex].viewNum)" >
< image class = "img" :src ="showImg(item.headimg)" mode = "aspectFill" > < / image >
< view class = "content flex-column" >
< view class = "title text-overflow" > { { item . title } } < / view >
< view class = "tags" v-if ="item.display_tags" >
< view class = "tag" v-for ="(tag,tagI) in item.display_tags.split(',')" :key ="tagI" > {{ tag }} < / view >
< / view >
< view class = "flex-between" >
< view class = "price" > { { item . price / 100 } } < / view >
< view class = "btn" > 购买 < / view >
< / view >
< / view >
< / view >
< / view >
< view class = "view-more" v-if ="typeList[typeIndex].list.length>0&&typeList[typeIndex].viewNum<=4" @click="typeList[typeIndex].viewNum=999" > 查看更多 < / view >
< image class = "bottom-img" src = "https://static.ticket.sz-trip.com/uploads/20250815/877b45bf01e0181fd489f0e1086c62fd.png" > < / image >
< image @click ="returnTop" v-show ="showGoTop" class="back-img" src="https://static.ticket.sz-trip.com/uploads/20250815/108583b6b888b0e5556393b140a7cb84.png" > < / image >
< / view >
< / view >
< / template >
< script >
export default {
data ( ) {
return {
list : [ ] ,
viewNum : 3 ,
headImg : '' ,
couponList : [
{ id : null , img : "https://static.ticket.sz-trip.com/uploads/20250815/f41aea639d47410e6e2fb23fbc7061a4.png" } ,
{ id : null , img : "https://static.ticket.sz-trip.com/uploads/20250815/1373e0b00e33d21f951d992f01a54ca6.png" } ,
{ id : null , img : "https://static.ticket.sz-trip.com/uploads/20250815/0a0574f43a008c57a4ac13ad2695260a.png" } ,
{ id : null , img : "https://static.ticket.sz-trip.com/uploads/20250815/b37ab2354e27a715760c3c963a5da90f.png" } ,
] ,
isReceive : true ,
typeIndex : 0 ,
typeList : [
{ id : 96 , title : "当季鲜享" , viewNum : 4 , list : [ ] } ,
{ id : 97 , title : "风味特产" , viewNum : 4 , list : [ ] } ,
{ id : 98 , title : "入秋养生" , viewNum : 4 , list : [ ] } ,
{ id : 99 , title : "啡尝美味" , viewNum : 4 , list : [ ] } ,
] ,
showGoTop : false ,
}
} ,
onLoad ( option ) {
} ,
onReady ( ) {
this . getHeadImg ( 2384 )
this . getGoods ( )
} ,
methods : {
getHeadImg ( id ) {
this . Post ( { id } , '/api/multimedia/detail' ) . then ( res => {
this . headImg = res . data . head_img
uni . setNavigationBarTitle ( {
title : res . data . title
} )
if ( res . data . company_name ) {
res . data . company_name . split ( ',' ) . forEach ( ( item , index ) => {
this . couponList [ index ] . id = item
} )
}
} ) ;
} ,
goRule ( id ) {
uni . navigateTo ( {
url : "/subPackages/activity/commonRule?id=" + id
} )
} ,
// 产品列表
getGoods ( ) {
this . Post ( {
tag_id : 95 ,
offset : 0 ,
limit : 999 ,
} , '/api/product/get_product_by_tag_subject' ) . then ( res => {
if ( res . data . length < this . viewNum ) {
this . viewNum = 999
}
this . list = res . data . list
} )
for ( let p of this . typeList ) {
this . Post ( {
tag_id : p . id ,
offset : 0 ,
limit : 999 ,
} , '/api/product/get_product_by_tag_subject' ) . then ( res => {
if ( res . data . list . length < p . viewNum ) {
p . viewNum = 999
}
p . list = res . data . list
console . log ( p )
} )
}
} ,
getCoupon ( item ) {
if ( ! this . isReceive ) {
uni . showToast ( {
title : "短时间内请勿重复点击!" ,
icon : 'none'
} )
return ;
}
this . isReceive = false
setTimeout ( ( ) => { this . isReceive = true } , 3000 )
this . Post ( {
ids : item . id ,
is_all : 1 ,
} , "/api/coupon/getNewCouponsByActivitiesIds" ) . then ( res => {
if ( res ) {
uni . showToast ( {
title : res . data ,
icon : 'none'
} )
}
} )
} ,
viewDetail ( item ) {
this . gotoDetailByType ( item )
} ,
returnTop ( ) {
uni . pageScrollTo ( {
scrollTop : 0 ,
duration : 200 ,
} )
} ,
} ,
onPageScroll ( res ) {
this . showGoTop = res . scrollTop > 200 ? true : false ;
}
}
< / script >
< style lang = "scss" scoped >
. bg {
width : 750 rpx ;
min - height : 100 vh ;
background : # E9F5EC ;
padding - bottom : 60 rpx ;
}
. topImg {
width : 100 % ;
}
. main - container {
width : 100 % ;
margin - top : - 10 rpx ;
padding : 0 26 rpx 60 rpx ;
. title - image {
width : 417.33 rpx ;
height : 66.67 rpx ;
margin : 0 auto ;
display : block ;
position : relative ;
z - index : 10 ;
}
. adv - image {
margin : 47 rpx 0 57 rpx ;
width : 100 % ;
height : 200 rpx ;
}
}
. coupon - box {
height : 529 rpx ;
background : # FFFFFF ;
border - radius : 13 rpx ;
border : 1 px solid # 629 FAE ;
position : relative ;
padding : 60 rpx 18 rpx 0 ;
margin - top : - 33 rpx ;
overflow : hidden ;
. rule {
width : 66 rpx ;
height : 64 rpx ;
background : # 4 C9BB4 ;
border - radius : 0 rpx 2 rpx 0 rpx 13 rpx ;
font - weight : 500 ;
font - size : 21 rpx ;
color : # FFFFFF ;
text - align : center ;
padding : 0 10 rpx ;
position : absolute ;
top : 0 ;
right : 0 ;
display : flex ;
align - items : center ;
justify - content : center ;
line - height : 1.2 ;
}
. coupon - tip {
font - weight : 500 ;
font - size : 24 rpx ;
color : # F13E35 ;
text - align : center ;
}
. coupon - img {
width : 323.33 rpx ;
height : 171.33 rpx ;
margin - bottom : 15 rpx ;
}
}
. row - product {
width : 100 % ;
height : 227 rpx ;
background : # FFFFFF ;
border - radius : 8 rpx ;
padding : 6 rpx ;
display : flex ;
margin - bottom : 22 rpx ;
. img {
width : 213 rpx ;
height : 100 % ;
border - radius : 7 rpx ;
flex - shrink : 0 ;
}
. content {
width : 100 rpx ;
flex : 1 ;
justify - content : space - between ;
padding : 6 rpx 0 6 rpx 22 rpx ;
}
. price {
font - weight : bold ;
font - size : 40 rpx ;
color : # F13E35 ;
& : : before {
content : "¥" ;
font - size : 24 rpx ;
}
& : : after {
content : "起" ;
font - size : 24 rpx ;
}
}
. btn {
width : 164 rpx ;
height : 50 rpx ;
background : # FF9838 ;
border - radius : 25 rpx ;
font - weight : bold ;
font - size : 27 rpx ;
color : # FFFFFF ;
line - height : 50 rpx ;
text - align : center ;
}
}
. title {
font - weight : bold ;
font - size : 29 rpx ;
color : # 000000 ;
}
. tags {
width : 100 % ;
display : flex ;
overflow : hidden ;
. tag {
font - weight : 500 ;
font - size : 24 rpx ;
height : 38 rpx ;
line - height : 38 rpx ;
color : # 4 C9BB4 ;
padding : 0 rpx 6 rpx ;
border - radius : 5 rpx ;
border : 1 px solid # 4 C9BB4 ;
margin - right : 13 rpx ;
}
}
. view - more {
width : 227 rpx ;
height : 49 rpx ;
border - radius : 8 rpx ;
border : 1 px solid # 4 C9BB4 ;
line - height : 49 rpx ;
font - weight : 500 ;
font - size : 25 rpx ;
color : # 4 C9BB4 ;
text - align : center ;
margin : 40 rpx auto 0 ;
}
. type - container {
display : flex ;
justify - content : space - between ;
margin : 52 rpx 0 30 rpx ;
. type - item {
width : 164 rpx ;
height : 66.67 rpx ;
text - align : center ;
line - height : 66.67 rpx ;
font - weight : bold ;
font - size : 31 rpx ;
color : # 4 C9BB4 ;
background - image : url ( "https://static.ticket.sz-trip.com/uploads/20250815/e165c4614ae82351d8b96f4dd0ab947c.png" ) ;
background - size : 100 % 100 % ;
& . active {
color : # FFFFFF ;
background - image : url ( "https://static.ticket.sz-trip.com/uploads/20250815/dba0ff60f303c031420958d67fa36614.png" ) ;
}
}
}
. column - product {
width : 340 rpx ;
height : 497 rpx ;
background : # FFFFFF ;
border - radius : 20 rpx ;
padding : 6 rpx ;
overflow : hidden ;
margin - bottom : 16 rpx ;
. img {
width : 327 rpx ;
height : 327 rpx ;
border - radius : 13 rpx 13 rpx 0 rpx 0 rpx ;
}
. content {
width : 100 % ;
flex : 1 ;
height : 150 rpx ;
justify - content : space - between ;
padding : 4 rpx 10 rpx ;
}
. price {
font - weight : bold ;
font - size : 28 rpx ;
color : # E62525 ;
& : : before {
content : "¥" ;
}
}
. btn {
width : 100 rpx ;
height : 40 rpx ;
background : # FF9838 ;
border - radius : 20 rpx ;
font - weight : bold ;
font - size : 27 rpx ;
color : # FFFFFF ;
line - height : 40 rpx ;
text - align : center ;
}
}
. bottom - img {
width : 174.67 rpx ;
height : 78 rpx ;
margin : 74 rpx auto 0 ;
display : block ;
}
. back - img {
position : fixed ;
width : 66 rpx ;
height : 66 rpx ;
bottom : 66 rpx ;
right : 26 rpx ;
}
< / style >