<template>
	<view class="content">
		<image class="expandImg" src="https://cdn.douhuofalv.com/images/2023/04/19/df2ecf6ece3e59de1d51c4ad09aa68f3.jpg" mode="widthFix"></image>
		<view class="list">
			<view class="list-title">
				<view class="list-title-number">expand</view>
				<view class="list-title-name">法律服务拓展包</view>
				<view class="list-title-trim"></view>
			</view>
			<view class="list-item">
				<view class="list-label" v-for="(item, index) in entrustArr" :key="index" @click="seekClick(item.expand_id)">
					<view class="list-label-name">
						{{item.title}}
					</view>
					<view class="list-label-price"><rich-text :nodes="item.content"></rich-text></view>
					<view class="list-label-go">购买</view>
				</view>
			</view>
		</view>
		<image class="expandBttom" src="https://cdn.douhuofalv.com/images/2023/04/17/fc4cad00a630e3d69b3f486e9d2937e9.png" mode="widthFix"></image>
		
		<!-- 关注公众号 -->
		<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'
	import { expandsList } from '@/apis/interfaces/synthesis'
	export default {
		data() {
			return {
				entrustArr  : [],  //案件委托列表
				generalShow : false // 公众号
			}
		},
		
		created() {
			// 获取-案件委托-列表
			this.yearServe();
		},
		
		methods: {
			// 案件委托-列表
			yearServe(){
				expandsList().then(res => {
					this.entrustArr = res
				}).catch(err => {
					uni.showToast({
						title: err.message,
						icon : 'none'
					})
				})
			},
			
			// 立即咨询
			seekClick(entrustId) {
				// 判断是否认证
				judgeReal().then(res => {
					if(res.has_sign) {
						if(!res.has_subscribe) {
							// 弹出公众号
							this.generalShow = true
						} else {
							// 跳到咨询表单页
							this.$Router.push({
								name: 'ExpandWrite',
								params: {
									entrustId
								}
							})
						}
						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'
				}).then(res => {
				    window.location.href = res
				}).catch(err => {
				    uni.showToast({
				        title: err.message,
				        icon: "none"
				    })
				})
				
				// 关闭公众号
				this.generalShow = false
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		background-color: #121d4c;
	}
	
	.expandImg,
	.expandBttom{
		width: 100%;
		display: block;
	}
	
	.list {
		padding: 0 30rpx 30rpx;
		box-sizing: border-box;
		background-color: #121d4c;
		.list-title {
			font-size: 36rpx;
			margin-bottom: 40rpx;
			color: #ffffff;
			.list-title-trim {
				position: relative;
				left: 390rpx;
				bottom: 28rpx;
				background-color: #2f3aae;
				width: 35%;
				height: 4rpx;
				padding-left: 40rpx;
				box-sizing: border-box;
				&::after {
					position: absolute;
					content: '';
					left: -50rpx;
					top: -10rpx;
					width: 20rpx;
					height: 20rpx;
					transform:rotate(45deg);
					background-color: #2f3aae;
				}
			}
			.list-title-number {
				font-weight: 600;
				font-size: 58rpx;
				background-image: -webkit-linear-gradient(top,#ffffff 40%, transparent 70%);
				-webkit-background-clip:text; 
				-webkit-text-fill-color:transparent;
				text-transform: uppercase;
			}
			.list-title-name {
				font-size: 44rpx;
				margin-top: -20rpx;
				width: 390rpx;
			}
		}
		.list-item {
			position: relative;
			padding-left: 100rpx;
			box-sizing: border-box;
			&::after {
				position: absolute;
				content: '';
				left: 10rpx;
				top: 0;
				border-left: 4rpx dashed #3b46d6;
				width: 0;
				height: calc(100% - 64rpx);
			}
			.list-label {
				background-image: linear-gradient(to right,#3d48dd, #1f2a6f);
				padding: 15rpx 40rpx 15rpx 90rpx;
				box-sizing: border-box;
				border-radius: 80rpx 15rpx 15rpx 80rpx;
				margin-bottom: 30rpx;
				color: #ffffff;
				position: relative;
				&::before {
					position: absolute;
					content: '';
					left: -88rpx;
					top: calc(50% - 1rpx);
					border-bottom: 4rpx dashed #3b46d6;
					width: 60rpx;
					height: 0;
				}
				&::after {
					position: absolute;
					content: '';
					left: 40rpx;
					top: calc(50% - 9rpx);
					background-color: #091443;
					width: 18rpx;
					height: 18rpx;
					border-radius: 50%;
				}
				.list-label-name {
					margin-bottom: 5rpx;
				}
				.list-label-price {
					line-height: 48rpx;
				}
				.list-label-go {
					position: absolute;
					right: 30rpx;
					top: 35rpx;
					background-image: -webkit-linear-gradient(40deg,#f1c593, #fef9f2);
					color: #12053d;
					display: inline-block;
					line-height: 54rpx;
					padding: 0 35rpx;
					border-radius: 54rpx;
					font-size: 28rpx;
					font-weight: 600;
				}
			}
		}
	}
	
	
	// 关注
	.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>