<template>
	<view class="content">
		<image @click="sheetClick" class="introduce-img" src="https://douhuo-storage.oss-cn-beijing.aliyuncs.com/images/2023/01/06/0754c34caabe9c5d316ced9f9b710335.jpg" mode="widthFix"></image>
		<!-- <img class="introduce-img" src="@/static/cs/1200.png">
		<view class="introduce-number">
			你有新的预约单
			<view class="number">
				3
			</view>
		</view>
		<view class="introduce-btn" @click="$Router.push({name: 'sheetIdcard'})">
			<view class="btn">
				立即咨询 ￥9.9
			</view>
		</view> -->
		
		<view class="tipsBack" v-if="generalShow"></view>
		<view class="tipsCont" v-if="generalShow">
			<view class="tipsWhite">
				<image class="tipsCont-img" src="@/static/imgs/general_back.png" mode="widthFix"></image>
				<view class="tipsWhite-top">
					<view class="tipsWhite-name">
						请您先关注抖火法律咨询公众号
					</view>
					<view class="tipsWhite-text">
						关注后，可立即下单
					</view>
				</view>
				<view class="tipsWhite-btn">
					<view class="tipsWhite-btn-go" @click="generalShow = false">
						稍后关注
					</view>
					<view class="tipsWhite-btn-go" @click="judgeGeneral">
						马上关注
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { judgeReal } from '@/apis/interfaces/user'
	import { authFollow } from '@/apis/interfaces/index'
	export default {
		data() {
			return {
				generalShow: false // 公众号
			}
		},
		onLoad() {
	
		},
		methods: {
			// 判断是否认证
			sheetClick() {
				judgeReal().then(res => {
					if(res.has_sign) {
						if(!res.has_subscribe) {
							// 弹出公众号
							this.generalShow = true
						} else {
							// 跳到咨询单
							this.$Router.replace({name: 'sheetCreate'})
						}
						return
					}
					// 跳到认证页面
					this.$Router.replace({name: 'sheetIdcard'})
				}).catch( err => {
					uni.showToast({
						title: err.message,
						icon: "none"
					})
				})
			},
			
			// 状态
			judgeGeneral(){
				// 获取微信授权信息
				authFollow({
					// url: 'https://web.douhuofalv.com/webview/webCode'
				    // url: 'https://web.douhuotest.douhuofalv.com/webview/webCode',
					url: 'https://rule.douhuofalv.com/webview/webCode'
				}).then(res => {
				    window.location.href = res
				}).catch(err => {
				    uni.showToast({
				        title: err.message,
				        icon: "none"
				    })
				})
				
				// 关闭公众号
				this.generalShow = false
			}
		}
	}
</script>

<style lang="scss" scoped>
	// page {
	// 	background-color: #446efe;
	// }
	.introduce-img {
		width: 100%;
		display: inline-block;
	}
	
	.introduce-number {
		position: fixed;
		right: $margin;
		bottom: 180rpx;
		z-index: 9;
		background-color: #ffffff;
		border-radius: $radius * 5;
		color: $mian-color;
		font-size: $title-size-m;
		padding: 0 $padding;
		line-height: 68rpx;
		display: inline-block;
		box-shadow: 0 2rpx 10rpx rgba(218, 43, 86, .3);
		.number {
			position: absolute;
			z-index: 10;
			top: -25rpx;
			right: 0;
			border-radius: 50%;
			text-align: center;
			background-color: $mian-color;
			color: #ffffff;
			width: 48rpx;
			height: 48rpx;
			line-height: 48rpx;
			font-size: $title-size-sm;
			text-align: center;
		}
	}
	
	.introduce-btn {
		position: fixed;
		width: 100%;
		left: 0;
		bottom: 0;
		text-align: center;
		padding: $padding;
		box-sizing: border-box;
		.btn {
			background-color: #ffffff;
			color: $mian-color;
			font-weight: 600;
			border-radius: $radius-sm;
			width: 100%;
			line-height: 90rpx;
			font-size: $title-size;
		}
	}
	
	// 关注
	.tipsBack {
		position: fixed;
		width: 100vw;
		height: 100vh;
		left: 0;
		top: 0;
		z-index: 9;
		background-color: rgba(0, 0, 0, .8);
	}
	.tipsCont {
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-box-pack: center;
		position: fixed;
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
		z-index: 10;
		padding: 0 10%;
		box-sizing: border-box;
	}
	
	.tipsWhite {
		background-color: #ffffff;
		border-radius: 20rpx;
		overflow: hidden;
	}
	
	.tipsWhite-top {
		padding: $padding;
		box-sizing: border-box;
		text-align: center;
	}
	
	.tipsCont-img {
		width: 100%;
	}
	
	.tipsWhite-name {
		text-align: center;
		color: #111111;
		font-size: 34rpx;
		font-weight: 600;
		margin-bottom: 15rpx;
	}
	
	.tipsWhite-text {
		font-size: 30rpx;
		color: #666666;
		line-height: 48rpx;
	}
	
	.tipsWhite-btn {
		display: flex;
		padding: $padding 10rpx;
		box-sizing: border-box;
		.tipsWhite-btn-go {
			flex: 2;
			color: #fff;
			margin: 0 15rpx;
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			border: 2rpx solid #F6F6F6;
			background-color: #007df5;
			border-radius: $radius-m;
			&:first-child {
				color: #333333;
				background-color: #ffffff;
				border: 2rpx solid #cccccc;
			}
		}
	}
</style>