 <template>
	<view>
		<view class="tui-alert-class tui-alert-box" :class="[show?'tui-alert-show':'tui-alert-hide']"  @touchmove.stop.prevent="discard">
            <view class="tui-alert-content clearfix">
                <view class="tui-alert-content-text">恭喜您!</view>
                <view class="tui-alert-content-bean">成功激活紫亚兰大会门票！</view>
                <view class="tui-alert-content-bean">到采美专区签到打卡，可领取超值礼包，更多惊喜和福利等你来解琐。</view>
                <view class="tui-alert-content-tips">
                    <view class="tips" @click.stop="handleClickCancel">知道了</view>
                </view>
            </view>
			<text class="iconfont icon-2guanbi" @click.stop="handleClickCancel"></text>
		</view>
	</view> 
</template>

<script>
	export default {
		name:'tuiAlert',
		props: {
			//控制显示
			show: {
				type: Boolean,
				default: false
			},
			//提示信息字体大小
			size: {
				type: Number,
				default: 30
			},
			//提示信息字体颜色
			color: {
				type: String,
				default: '#333'
			},
			//按钮字体颜色
			btnColor: {
				type: String,
				default: '#EB0909'
			},
			btnText:{
				type: String,
				default: ''
			},
			beansType:{//根据类型设置背景图片:1注册机构，2升级资质机构，3个人机构修改资料，4资质机构修改资料，5下单成功，6线上支付成功，7确认收货成功
				type: Number,
				default: 1
			},
			beanNumber:{//采美豆显示数量
				type:Number,
				default:100
			}
		},
		data() {
			return{
				bgImagePath:'https://static.caimei365.com/app/img/icon/bean-icon-2@2x.png',
			}
		},
		created() {
			this.handInitType(this.beansType)
		},
		methods: {
			handInitType(type){
				this.bgImagePath = `https://static.caimei365.com/app/img/icon/bean-icon-${type}@2x.png`
			},
			handleClick(e) {
				console.log(e)
				if (!this.show) return
				this.$emit('click',false)
			},
			handleClickCancel() {
				this.$emit('cancel',false)
			},
			discard(){
				//丢弃
			}
		}
	}
</script>

<style lang="scss">
	.tui-alert-box {
		width: 100%;
		height: 100%;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		position: fixed;
		left: 0;
		top: 100%;
		opacity: 0;
		background: rgba(51,51,51,0.7);
		z-index: 99999;
	}
	.tui-alert-show {
		top: 0;
		opacity: 1;
		// animation:rundtop 0.5s;
	}
	.tui-alert-hide{
		top: 100%;
		opacity: 0;
		// animation:rundbottom 0.5s;
	}
	.tui-alert-image{
		width: 626rpx;
		height: 532rpx;
		position: absolute;
		top: 0;
		left: 0;
		bottom: 0;
		right: 0;
		margin: auto;
		image{
			width: 626rpx;
			height: 532rpx;
			display: block;
		}
	}
	.tui-alert-content{
		width: 580rpx;
		height: 550rpx;
        border-radius: 40rpx;
		position: absolute;
		top: 0;
		left: 0;
		bottom: 0;
		right: 0;
		margin: auto;
		box-sizing: border-box;
        background-color: #FFFFFF;
        padding: 40rpx;
		.tui-alert-content-text{
			height: 100rpx;
			line-height: 100rpx;
			text-align: center;
			width: 100%;
			font-size: $font-size-36;
			color: #333333;
            font-weight: 600;
            float: left;
            letter-spacing: 2rpx;
		}
		.tui-alert-content-bean{
			height: auto;
			line-height: 60rpx;
			text-align: center;
			width: 100%;
			font-size: $font-size-30;
			color: #e10078;
            float: left;
		}
		.tui-alert-content-tips{
			width: 100%;
			height: 66rpx;
			line-height: 66rpx;
			margin-top: 60rpx;
			box-sizing: border-box;
            float: left;
			.tips{
				width: 240rpx;
				height: 70rpx;
				background-color: #e10078;
				border-radius: 36rpx;
				line-height: 70rpx;
				font-size: $font-size-30;
				color: #FFFFFF;
				text-align: center;
                margin: 0 auto;
			}
		}
	}
	.icon-2guanbi{
		display: block;
		width: 100rpx;
		height: 100rpx;
		line-height: 100rpx;
		text-align: center;
		color: #FFFFFF;
		position: absolute;
		bottom: 18%;
		left: 50%;
		font-size: 58rpx;
		margin-left: -50rpx;
	}
	.tui-alert-mask-show {
		visibility: visible;
		opacity: 1;
	}
	.tui-alert-btn {
		width: 100%;
		height: 90rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		background-color: #fff;
		box-sizing: border-box;
		position: relative;
		font-size: 32rpx;
		line-height: 32rpx;
	}
	.tui-alert-btn-hover {
		background-color: #f7f7f7;
	}
	.tui-alert-btn::before {
		width: 100%;
		content: "";
		position: absolute;
		border-top: 1rpx solid #E0E0E0;
		-webkit-transform: scaleY(0.5);
		transform: scaleY(0.5);
		left: 0;
		top: 0;
	}
	@keyframes rundtop{
		0%{top: 100%;opacity: 0;}
		100%{top:0;opacity: 1;}
	}
	@keyframes rundbottom{
		0%{top: 0;opacity: 1;}
		100%{top:100%;opacity: 0;}
	}
</style>