2024-04-05 18:30:57 +08:00
< template >
< view class = "content" v-show ="blindShow" >
< view class = "bg" >
< view class = "top" >
< / view >
< view class = "lucky-draw" >
< view class = "title" >
2024-04-10 14:26:10 +08:00
2024-04-05 18:30:57 +08:00
< / view >
< view class = "blind-box" >
2024-04-23 14:55:27 +08:00
< image src = "https://store.tropjoin.com/images/mh-item.png" @click ="openBlindBox(index)" :class ="actionIndex==index?'action':''" class = "box-item" v-for ="(item,index) in 6" >
2024-04-05 18:30:57 +08:00
< / view >
< view class = 'iconfont icon-guanbi3' @ click = 'closePop()' > < / view >
< / view >
< / view >
< view class = "coupon_popups" v-if ="popShow" >
< view class = "bg2" > < / view >
2024-04-10 14:26:10 +08:00
< view class = "con" v-if ="blind" >
2024-05-29 15:46:29 +08:00
< view class = "content" v-if ="!this.prize.name" >
2024-04-05 18:30:57 +08:00
< image :src ="drawInfo.img" mode = "" > < / image >
< view class = "text-black" > 恭喜您获得 < / view >
2024-05-29 15:46:29 +08:00
< view class = "text-red" > { { drawInfo . text } } 铸源星 < / view >
2024-04-10 14:26:10 +08:00
< view class = "btn" @click ="closePop()" > 开心收下 < / view >
< / view >
2024-05-29 15:46:29 +08:00
< view v-if ="this.prize.name" class="content" style="height: 660rpx;" >
< image style = "height: 300rpx;" :src ="this.prize.image" mode = "" > < / image >
< view class = "text-black" > 恭喜您获得 < / view >
< view class = "text-red" > { { this . prize . name } } < / view >
< view class = "btn" @click ="writeAddress()" > 填写地址 < / view >
< / view >
2024-04-10 14:26:10 +08:00
< / view >
< view class = "con" v-else >
< view class = "content" >
2024-04-23 14:55:27 +08:00
< image src = "https://store.tropjoin.com/images/notBlind.png" style = "width: 80px;height: 80px;" mode = "" > < / image >
2024-05-29 15:46:29 +08:00
< view class = "text-black" > 谢谢参与 < / view >
2024-04-10 14:26:10 +08:00
< view class = "text-red" > 期待您下次再来 < / view >
< view class = "btn" @click ="closePop()" > 我知道了 < / view >
2024-04-05 18:30:57 +08:00
< / view >
< / view >
< / view >
< / view >
< / template >
< script >
2024-05-19 11:52:22 +08:00
import { setBlind } from '@/api/user.js'
2024-04-05 18:30:57 +08:00
export default {
components : {
} ,
data ( ) {
return {
wheel : 0 ,
2024-04-10 14:26:10 +08:00
actionIndex : - 1 ,
2024-04-05 18:30:57 +08:00
popShow : false ,
blindShow : true ,
2024-04-10 14:26:10 +08:00
blind : true ,
2024-04-05 18:30:57 +08:00
defaultConfig : {
gutter : '5px' ,
speed : 60 ,
stopRange : '0.95'
} ,
popShow : false ,
list : [ ] ,
2024-05-29 15:46:29 +08:00
prize : {
name : '' ,
id : '' ,
image : ''
} ,
2024-04-05 18:30:57 +08:00
drawInfo : {
img : '' ,
text : '' ,
}
}
} ,
onLoad ( ) {
this . init ( )
} ,
methods : {
2024-05-19 11:52:22 +08:00
async openBlindBox ( val ) {
2024-04-10 14:26:10 +08:00
this . actionIndex = val ;
if ( val / 2 ) {
2024-05-29 15:46:29 +08:00
// this.popShow=true;
// this.blind=true;
2024-05-19 11:52:22 +08:00
await setBlind ( ) . then ( res => {
if ( res . status == 200 ) {
setTimeout ( ( ) => {
this . popShow = true ;
2024-05-29 15:46:29 +08:00
this . prize = res . data . prize || { name : '' , image : '' , id : '' , draw _time : '' }
2024-05-19 11:52:22 +08:00
this . drawInfo . text = res . data . integral ;
2024-05-29 15:46:29 +08:00
this . blind = ! ! res . data . integral || ! ! this . prize . name ;
2024-05-19 11:52:22 +08:00
} , 1500 )
} else {
return this . $util . Tips ( { title : err } )
}
} ) . catch ( err => {
// this.close();
2024-05-29 15:46:29 +08:00
return this . $util . Tips ( { title : err } )
// return this.$util.Tips({title:err.message})
2024-05-19 11:52:22 +08:00
} ) ;
2024-04-10 14:26:10 +08:00
} else {
setTimeout ( ( ) => {
this . popShow = true ;
} , 800 )
}
2024-04-05 18:30:57 +08:00
} ,
init ( ) {
} ,
2024-05-29 15:46:29 +08:00
writeAddress ( ) {
let { id , draw _time , image , name } = this . prize
uni . navigateTo ( {
url : ` /pages/users/winning_confirm/index?id= ${ id } &draw_time= ${ draw _time } &image= ${ image } &name= ${ name } ` ,
} ) ;
this . closePop ( )
} ,
2024-04-05 18:30:57 +08:00
closePop ( ) {
2024-04-10 14:26:10 +08:00
this . popShow = false ;
2024-04-05 18:30:57 +08:00
this . blindShow = false ;
2024-05-19 11:52:22 +08:00
this . $emit ( 'cloneblindBox' )
2024-04-05 18:30:57 +08:00
}
}
}
< / script >
< style lang = "less" scoped >
@ keyframes bounce {
2024-04-10 14:26:10 +08:00
from {
transform : scale3d ( 1 , 1 , 1 ) ;
}
30 % {
transform : scale3d ( 1.05 , 0.85 , 1 ) ;
}
40 % {
transform : scale3d ( 0.85 , 1.05 , 1 ) ;
}
50 % {
transform : scale3d ( 1.10 , 0.85 , 1 ) ;
}
65 % {
transform : scale3d ( 0.95 , 1.05 , 1 ) ;
}
75 % {
transform : scale3d ( 1.05 , 0.95 , 1 ) ;
}
to {
transform : scale3d ( 1 , 1 , 1 ) ;
}
2024-04-05 18:30:57 +08:00
}
. content {
width : 100 % ;
height : 100 vh ;
position : fixed ;
2024-04-10 14:26:10 +08:00
background - color : rgba ( 0 , 0 , 0 , .9 ) ;
2024-05-29 15:46:29 +08:00
z - index : 998 ;
2024-04-05 18:30:57 +08:00
top : 0 ;
display : flex ;
align - items : center ;
justify - content : center ;
. coupon _popups {
z - index : 999 ;
position : fixed ;
left : 0 ;
2024-04-10 14:26:10 +08:00
top : 120 rpx ;
2024-04-05 18:30:57 +08:00
width : 100 % ;
height : 100 % ;
text - align : center ;
. bg2 {
position : absolute ;
left : 0 ;
top : 0 ;
width : 100 % ;
height : 100 % ;
background - color : rgba ( 0 , 0 , 0 , .5 ) ;
}
. con {
position : absolute ;
left : 50 % ;
top : 50 % ;
transform : translate ( - 50 % , - 50 % ) ;
width : 680 rpx ;
height : 900 rpx ;
background - size : 100 % 700 rpx ;
background - repeat : no - repeat ;
display : flex ;
justify - content : center ;
. content {
width : 500 rpx ;
height : 520 rpx ;
border - radius : 20 rpx ;
margin : 0 auto ;
background - color : white ;
display : flex ;
flex - direction : column ;
justify - content : center ;
align - items : center ;
grid - gap : 40 rpx ;
image {
width : 300 rpx ;
height : 200 rpx ;
margin - top : 50 rpx ;
}
. text - black {
font - size : 32 rpx ;
font - weight : bold ;
}
. text - red {
font - size : 28 rpx ;
color : # FC3C70 ;
}
. btn {
color : white ;
margin - bottom : 40 rpx ;
width : 328 rpx ;
height : 68 rpx ;
line - height : 68 rpx ;
padding : 4 rpx 0 ;
border - radius : 60 rpx ;
2024-04-10 14:26:10 +08:00
background : linear - gradient ( 136 deg , # FFDF6A 0 % , # EF521F 100 % ) ;
2024-04-05 18:30:57 +08:00
}
}
. text {
width : 600 rpx ;
margin : 30 rpx auto 0 ;
font - size : 20 rpx ;
color : # ffffff ;
}
}
}
. bg {
width : 80 % ;
height : 80 vh ;
background - size : 100 % 100 % ;
position : relative ;
padding - bottom : 40 rpx ;
. rule {
width : 80 rpx ;
height : 120 rpx ;
2024-04-23 14:55:27 +08:00
background - image : url ( 'https://store.tropjoin.com/images/right-btn.png' ) ;
2024-04-05 18:30:57 +08:00
background - size : 100 % ;
background - repeat : no - repeat ;
position : absolute ;
right : 0 ;
top : 320 rpx ;
// text-align: center;
display : flex ;
align - items : center ;
justify - content : center ;
text {
width : 56 rpx ;
height : 80 rpx ;
font - family : PingFang SC ;
font - weight : 500 ;
font - size : 28 rpx ;
color : # DC3424 ;
line - height : 36 rpx ;
}
}
. top {
2024-04-10 14:26:10 +08:00
height : 180 rpx ;
2024-04-05 18:30:57 +08:00
}
. lucky - draw {
display : flex ;
flex - direction : column ;
align - items : center ;
justify - content : center ;
. title {
position : relative ;
bottom : 20 rpx ;
width : 80 % ;
2024-04-10 14:26:10 +08:00
height : 120 rpx ;
2024-04-05 18:30:57 +08:00
font - family : PingFang SC ;
font - weight : 400 ;
font - size : 32 rpx ;
color : # FFFFFF ;
margin : 20 rpx 0 ;
line - height : 54 rpx ;
text - align : center ;
2024-05-29 15:46:29 +08:00
// background: url('https://store.tropjoin.com/images/mh-title.png') no-repeat;
// background-size: 100% 100%;
// background-position: center;
2024-04-05 18:30:57 +08:00
}
. blind - box {
2024-04-08 19:01:38 +08:00
width : 100 % ;
height : 480 rpx ;
// background: #D753FC;
2024-04-23 14:55:27 +08:00
background - image : url ( 'https://store.tropjoin.com/images/mh-bg.png' ) ;
2024-04-08 19:01:38 +08:00
background - repeat : no - repeat ;
background - size : 100 % ;
2024-04-05 18:30:57 +08:00
display : flex ;
flex - wrap : wrap ;
padding : 40 rpx ;
2024-04-08 19:01:38 +08:00
padding - bottom : 80 rpx ;
2024-04-05 18:30:57 +08:00
grid - gap : 20 rpx ;
. box - item {
flex : 30 % ;
height : auto ;
}
. action {
2024-04-23 14:55:27 +08:00
background : url ( 'https://store.tropjoin.com/images/mh-item-bg.png' ) ;
2024-04-10 14:26:10 +08:00
background - repeat : no - repeat ;
background - size : 100 % 100 % ;
animation : bounce .8 s 1 ;
2024-04-05 18:30:57 +08:00
animation - direction : normal ;
2024-04-10 14:26:10 +08:00
2024-04-05 18:30:57 +08:00
}
}
}
. lucky - draw - info {
margin : 80 rpx auto ;
width : 680 rpx ;
height : 440 rpx ;
background - color : white ;
display : flex ;
flex - direction : column ;
border - radius : 32 rpx ;
. title {
text - align : center ;
font - size : 36 rpx ;
color : # FC3C70 ;
line - height : 72 rpx ;
}
. list {
flex : 1 ;
overflow : scroll ;
display : flex ;
flex - direction : column ;
grid - gap : 20 rpx ;
. item {
font - size : 32 rpx ;
font - weight : bold ;
padding : 10 rpx 20 rpx ;
width : 100 % ;
display : flex ;
justify - content : space - between ;
}
}
}
. icon - guanbi3 {
color : # ffffff ;
font - size : 50 rpx ;
margin - top : 50 rpx ;
}
}
}
< / style >