Huanyuyuehui/components/treasureBox/index.vue

302 lines
7.2 KiB
Vue
Raw Normal View History

2024-04-05 18:30:57 +08:00
<template>
<view class="content">
<view class="bg">
<view class="top">
2024-05-29 15:46:29 +08:00
<view class="iconfont icon-guanbi2" style="position: absolute;right: 20px;top:50px;font-size: 30px;color: white;" @click="close"></view>
2024-04-05 18:30:57 +08:00
</view>
2024-04-08 19:01:38 +08:00
<view class="lucky-draw">
2024-04-05 18:30:57 +08:00
2024-04-23 14:55:27 +08:00
<image src="https://store.tropjoin.com/images/box.png" mode="aspectFit" style="width: 220px;height: 220px;position: relative;top: 12px;right: 16px;" v-if="!gifShow&&!popShow"></image>
<image src="https://store.tropjoin.com/images/box.gif" mode="aspectFit" style="width: 350px;height: 350px;" v-else-if="gifShow"></image>
<image src="https://store.tropjoin.com/images/box2.png" mode="aspectFit" style="width: 350px;height: 350px;position: relative;top: 10px;right: 10px;" v-else-if="!gifShow&&popShow"></image>
2024-04-08 19:01:38 +08:00
</view>
<view class="btn" @click="openBox">
立刻开启
</view>
2024-04-05 18:30:57 +08:00
</view>
<view class="coupon_popups" v-if="popShow">
2024-04-11 17:18:42 +08:00
<view class="con" v-if="blind">
2024-04-10 20:06:38 +08:00
<view class="contents">
<image src="@/static/images/jf.png" style="width: 48px;height:48px;" mode=""></image>
2024-04-05 18:30:57 +08:00
<view class="text-black">恭喜您获得</view>
2024-05-08 17:48:33 +08:00
<view class="text-red">{{drawInfo.text}}铸源星</view>
2024-04-11 17:18:42 +08:00
<view class="btn" @click="confirm" v-if="!drawInfo.wheel">开心收下</view>
<view class="btn" @click="goBlind" v-else>继续开盲盒</view>
2024-04-05 18:30:57 +08:00
</view>
<view class='iconfont icon-guanbi3' @click="popShow = false"></view>
</view>
2024-04-11 17:18:42 +08:00
<view class="con" v-else>
2024-05-17 18:35:31 +08:00
<view class="contents">
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-11 17:18:42 +08:00
<view class="text-red">期待您下次再来</view>
2024-05-19 11:52:22 +08:00
<view class="btn" @click="confirm" v-if="!drawInfo.wheel">我知道了</view>
<view class="btn" @click="goBlind" v-else>继续开盲盒</view>
2024-04-11 17:18:42 +08:00
</view>
2024-05-29 15:46:29 +08:00
<view class='iconfont icon-guanbi3' @click="popShow = false"></view>
2024-04-11 17:18:42 +08:00
</view>
2024-04-05 18:30:57 +08:00
</view>
2024-05-19 11:52:22 +08:00
<blindBox v-if="blindShow" @cloneblindBox='close'></blindBox>
2024-04-05 18:30:57 +08:00
</view>
</template>
<script>
2024-04-10 14:26:10 +08:00
2024-05-17 18:35:31 +08:00
import {getWhellNumber,getWhellConfig,getWhellAction,getWhellList,setSignIntegral,setBlind} from '@/api/user.js';
2024-04-10 20:06:38 +08:00
import blindBox from '@/components/blindBox/blindBox.vue';
2024-04-05 18:30:57 +08:00
export default {
components: {
blindBox
},
data() {
return {
wheel:0,
popShow:false,
2024-04-08 19:01:38 +08:00
gifShow:false,
2024-04-10 20:06:38 +08:00
blindShow:false,
2024-04-10 14:26:10 +08:00
integral:'',
2024-04-05 18:30:57 +08:00
list:[],
2024-04-11 17:18:42 +08:00
blind:true,
2024-04-05 18:30:57 +08:00
drawInfo:{
img:'',
text:'',
2024-04-11 17:18:42 +08:00
wheel:0,
2024-04-05 18:30:57 +08:00
}
}
},
onLoad() {
},
methods: {
confirm(){
this.popShow = false;
2024-04-11 17:18:42 +08:00
this.blind=false;
2024-04-10 14:26:10 +08:00
this.close();
2024-04-05 18:30:57 +08:00
},
2024-05-29 15:46:29 +08:00
openBox(){ ;
setSignIntegral().then(res=>{
2024-04-10 14:26:10 +08:00
this.drawInfo.text = res.data.integral;
2024-04-11 17:18:42 +08:00
this.drawInfo.wheel=res.data.wheel;
2024-04-10 14:26:10 +08:00
this.gifShow=true;
2024-05-17 18:35:31 +08:00
this.blind=!!res.data.integral;
2024-04-10 14:26:10 +08:00
setTimeout(()=>{
this.gifShow=false;
this.popShow=true;
2024-04-10 20:06:38 +08:00
},1500)
2024-04-10 14:26:10 +08:00
}).catch(err=>{
2024-05-17 18:35:31 +08:00
// this.close();
2024-05-29 15:46:29 +08:00
return this.$util.Tips({title:err})
2024-04-10 14:26:10 +08:00
});
2024-04-05 18:30:57 +08:00
},
2024-04-11 17:18:42 +08:00
goBlind(){
this.blindShow=true;
2024-05-29 15:46:29 +08:00
this.popShow=false;
2024-04-11 17:18:42 +08:00
},
2024-04-08 19:01:38 +08:00
close(){
this.$emit('closeTreasureBox')
}
2024-04-05 18:30:57 +08:00
}
}
</script>
<style lang="less" scoped>
.content {
width: 100%;
height: 100vh;
position: fixed;
top: 0;
2024-05-29 15:46:29 +08:00
z-index: 996;
2024-04-08 19:01:38 +08:00
padding-top: 200rpx;
background-color: rgba(0,0,0,1);
2024-04-05 18:30:57 +08:00
.coupon_popups{
2024-05-29 15:46:29 +08:00
z-index: 997;
2024-04-05 18:30:57 +08:00
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
text-align: center;
.bg2{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
2024-04-08 19:01:38 +08:00
background-color: rgba(0,0,0,.8);
2024-04-05 18:30:57 +08:00
}
.con{
position: absolute;
left: 50%;
2024-05-29 15:46:29 +08:00
top: 48%;
2024-04-05 18:30:57 +08:00
transform: translate(-50%,-50%);
width: 680rpx;
height: 900rpx;
background-size: 100% 700rpx;
background-repeat: no-repeat;
display: flex;
justify-content: center;
2024-04-10 20:06:38 +08:00
.contents{
2024-04-05 18:30:57 +08:00
width: 500rpx;
height: 520rpx;
border-radius: 20rpx;
margin: 0 auto;
background-color: white;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
grid-gap: 40rpx;
2024-04-10 20:06:38 +08:00
// image{
// width: 860rpx;
// height: 200rpx;
// margin-top: 50rpx;
// }
2024-04-05 18:30:57 +08:00
.text-black{
font-size: 32rpx;
font-weight: bold;
}
.text-red{
font-size: 28rpx;
color: #FC3C70;
}
.btn{
color: white;
margin-bottom: 40rpx;
width: 328rpx;
height: 68rpx;
line-height: 68rpx;
padding: 4rpx 0;
border-radius: 60rpx;
background: linear-gradient(136deg, #D753FC 0%, #FC276C 53%, #FC3E8F 100%);
}
}
.text{
width: 600rpx;
margin: 30rpx auto 0;
font-size: 20rpx;
color: #ffffff;
}
.icon-guanbi3{
color: #ffffff;
font-size: 70rpx;
position: absolute;
bottom: 250rpx;
left: 310rpx;
}
}
}
.bg {
width: 100%;
2024-04-08 19:01:38 +08:00
// height: 100vh;
2024-04-05 18:30:57 +08:00
position: relative;
padding-bottom: 40rpx;
.rule {
width: 80rpx;
height: 120rpx;
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: 320rpx;
// text-align: center;
display: flex;
align-items: center;
justify-content: center;
text {
width: 56rpx;
height: 80rpx;
font-family: PingFang SC;
font-weight: 500;
font-size: 28rpx;
color: #DC3424;
line-height: 36rpx;
}
}
.top{
2024-04-08 19:01:38 +08:00
width: 488rpx;
height: 140rpx;
2024-05-29 15:46:29 +08:00
// background-image: url('https://store.tropjoin.com/images/box-title.png');
// background-size: 100% 100%;
2024-04-08 19:01:38 +08:00
margin: 0 auto;
2024-04-05 18:30:57 +08:00
}
.lucky-draw{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
2024-04-08 19:01:38 +08:00
width: 670rpx;
height: 670rpx;
margin: 0 auto;
// background-image: url('@/static/images/box.png');
background-size: 100% 100%;
2024-04-05 18:30:57 +08:00
.title{
position: relative;
bottom: 20rpx;
width:60%;
height: 50rpx;
font-family: PingFang SC;
font-weight: 400;
font-size: 32rpx;
color: #FFFFFF;
margin: 20rpx 0;
line-height: 54rpx;
text-align: center;
2024-04-23 14:55:27 +08:00
background: url('https://store.tropjoin.com/images/font-bg.png') no-repeat 100%;
2024-04-05 18:30:57 +08:00
background-position: center;
}
}
2024-04-08 19:01:38 +08:00
.btn{
width: 460rpx;
height: 100rpx;
background: linear-gradient(180deg, #FEFD65 0%, #F3C936 100%);
border-radius: 60rpx;
border: 4rpx solid #FFFFFF;
font-weight: 600;
font-size: 36rpx;
color: #530115;
line-height: 100rpx;
text-align: center;
margin: 0 auto;
position: relative;
top: 160rpx;
}
2024-04-05 18:30:57 +08:00
.lucky-draw-info{
margin: 80rpx auto;
width: 680rpx;
height: 440rpx;
background-color: white;
display: flex;
flex-direction: column;
border-radius: 32rpx;
.title{
text-align: center;
font-size: 36rpx;
color: #FC3C70;
line-height: 72rpx;
}
.list{
flex: 1;
overflow: scroll;
display: flex;
flex-direction: column;
grid-gap: 20rpx;
.item{
font-size: 32rpx;
font-weight: bold;
padding: 10rpx 20rpx;
width: 100%;
display: flex;
justify-content: space-between;
}
}
}
}
}
</style>