<template>
	<!-- 是否有未开完的奖品 -->
	<popup-view v-model="isOpen" mode="center" border-radius="15" :mask-close-able="false" z-index="1000">
		<view class="log-out">
			<view class="log-out-tip">您有未开盲盒，去开奖！</view>
			<view class="log-out-footer">
				<view class="cancel" @click="goOpen">去开奖</view>
			</view>
		</view>
	</popup-view>
</template>

<script>
	import {
		noOpenListApi
	} from '@/API/index.js'
	export default{
		data(){
			return{
				list:[],
				isOpen:false
			}
		},
		props:{
			// isOpen:{
			// 	type:Boolean,
			// 	default:false
			// }
			
		},
		mounted() {
			if (uni.getStorageSync('box-token')) {
				this.getNoOpenList()
			}
			
		},
		methods:{
			// 获取是否有开奖记录
			getNoOpenList(){
				noOpenListApi().then(res => {
					console.log(res)
					if(res.code === 200){
						// this.list = res.data
						this.isOpen = res.data.length > 0 ? true : false
					}else{
						this.$api.msg(res.message)
					}
				}).catch(err => {
					
				})
			},
			goOpen(){
				uni.redirectTo({
					url:`/pages/index/draw?noOpen=noOpen`
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.log-out{
		width: 590rpx;
		height: 300rpx;
		background: #FFFFFF;
		border-radius: 16rpx;
		.log-out-tip{
			height: 200rpx;
			font-weight: 500;
			font-size: 32rpx;
			color: rgba(0,0,0,0.85);
			line-height: 200rpx;
			text-align: center;
		}
		.log-out-footer{
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-top: 2rpx solid rgba(0,0,0,0.06);
			height: 100rpx;
			.cancel{
				width: 100%;
				height: 100rpx;
				line-height: 100rpx;
				font-weight: 500;
				font-size: 32rpx;
				color: #E55353;
				text-align: center;
			}
			.log-out-submit{
				width: 294rpx;
				height: 100rpx;
				line-height: 100rpx;
				font-weight: 500;
				font-size: 32rpx;
				color: #E55353;
				text-align: center;
			}
		}
	}
</style>