<template>
	<view class="page">
		<u-navbar title="客户服务" :border-bottom="false" :background="bgc" title-color='#fff' title-size='36'  back-icon-color='#fff'
			height='45'></u-navbar>
			<image class="backimg" src="https://lxnapi.ccttiot.com/bike/img/static/ukLK3qJWhi4m70KzlxAE" mode=""></image>
			<view class="tit">
				Hi 您好，我们为您提供更多帮助哦~
			</view>
			<view class="qscard">
				<view class="card_top">
					<view class="li"  v-for="(item,index) in classlist" :key="index" @click="changeitx(item,index)">
						<view class="txt">
							{{item.classifyName}}
						</view>
						<view class="bot_bor" v-if="tabindex==index"></view>
						<view class="bot_bor" v-if="tabindex!=index" style="background: #fff;"></view>
					</view>
					
				</view>
				<view class="qs_li" v-for="(item,index) in wordlist" :key="index" @click="topage(item)">
					<view class="qs_li_txt">
						{{item.title}}
					</view>
					<view class="iconfont icon-xiangyou1"></view>
				</view>
			</view>
		<view class="btn" @click="showkf=true">
			<image src="https://lxnapi.ccttiot.com/bike/img/static/uEM1RpP3J0K51qTjtnA5" mode=""></image>
			电话咨询
		</view>
		<u-mask :show="showkf" :z-index='100' />
		<view class="kfbox" v-if="showkf">
			<view class="tit">
				请选择您要联系的客服
			</view>
			<view class="words">
				我们根据选择为您提供服务
			</view>
			<!-- <view class="phone_box">
				<view class="img">
					<image src="https://lxnapi.ccttiot.com/bike/img/static/uwiRmed6Kz4OUJh00HBD" mode=""></image>
				</view>
				<view class="info">
					<view class="name">
						官方客服
					</view>
					<view class="phone">
						000-260-1559
					</view>
				</view>
			</view> -->
			<view class="phone_box" v-if="areaInfo.serviceName1!=''&&areaInfo.serviceName1&&areaInfo.servicePhone1!=''&&areaInfo.servicePhone1" @click="callPhone(areaInfo.servicePhone1)">
				<view class="img">
					<image src="https://lxnapi.ccttiot.com/bike/img/static/unsZOLTPuYrpQKF8MpFt" mode=""></image>
				</view>
				<view class="info">
					<view class="name">
						{{areaInfo.serviceName1}}
					</view>
					<view class="phone">
						{{areaInfo.servicePhone1}}
					</view>
				</view>
			</view>
			<view class="phone_box"  v-if="areaInfo.serviceName2!=''&&areaInfo.serviceName2&&areaInfo.servicePhone2!=''&&areaInfo.servicePhone2"  @click="callPhone(areaInfo.servicePhone2)">
				<view class="img">
					<image src="https://lxnapi.ccttiot.com/bike/img/static/unsZOLTPuYrpQKF8MpFt" mode=""></image>
				</view>
				<view class="info">
					<view class="name">
						{{areaInfo.serviceName2}}
					</view>
					<view class="phone">
						{{areaInfo.servicePhone2}}
					</view>
				</view>
			</view>
			<view class="phone_box"  v-if="areaInfo.serviceName3!=''&&areaInfo.serviceName3&&areaInfo.servicePhone3!=''&&areaInfo.servicePhone3"  @click="callPhone(areaInfo.servicePhone3)">
				<view class="img">
					<image src="https://lxnapi.ccttiot.com/bike/img/static/unsZOLTPuYrpQKF8MpFt" mode=""></image>
				</view>
				<view class="info">
					<view class="name">
						{{areaInfo.serviceName3}}
					</view>
					<view class="phone">
					{{areaInfo.servicePhone3}}
					</view>
				</view>
			</view>
			<view class="phone_box"  v-if="lastArea.serviceName1!=''&&lastArea.serviceName1&&lastArea.servicePhone1!=''&&lastArea.servicePhone1"  @click="callPhone(lastArea.servicePhone1)">
				<view class="img">
					<image src="https://lxnapi.ccttiot.com/bike/img/static/u6VebEXfsdk8f4NbTWQs" mode=""></image>
				</view>
				<view class="info">
					<view class="name">
						订单或押金问题
					</view>
					<view class="phone">
						{{lastArea.servicePhone1}}
					</view>
				</view>
			</view>
			<image class="close" src="https://lxnapi.ccttiot.com/bike/img/static/ulwJylk0JSmOdmU3FnnG" mode="" @click="showkf=false"></image>
		</view>
		<u-mask :show="isbackcar" :z-index='100' duration='0'  @click="isbackcar = false" /> 
		<view class="pops" v-if="isbackcar">
			<view class="tits" style="font-weight: 600;text-align: center;display: flex;justify-content: center;">
				联系电话
			</view>
			<view class="cont_box" >
				<view class="pohone_li" v-if="areaInfo.serviceName1!=''&&areaInfo.serviceName1&&areaInfo.servicePhone1!=''&&areaInfo.servicePhone1" @click="callPhone(areaInfo.servicePhone1)">
					<view class="name">
						{{areaInfo.serviceName1}}
					</view>
					<view class="pohone">
							{{areaInfo.servicePhone1}}
					</view>
				</view>
				<view class="pohone_li" v-if="areaInfo.serviceName2!=''&&areaInfo.serviceName2&&areaInfo.servicePhone2!=''&&areaInfo.servicePhone2"  @click="callPhone(areaInfo.servicePhone2)">
					<view class="name">
						{{areaInfo.serviceName2}}
					</view>
					<view class="pohone">
							{{areaInfo.servicePhone2}}
					</view>
				</view>
				<view class="pohone_li" v-if="areaInfo.serviceName3!=''&&areaInfo.serviceName3&&areaInfo.servicePhone3!=''&&areaInfo.servicePhone3"  @click="callPhone(areaInfo.servicePhone3)">
					<view class="name">
						{{areaInfo.serviceName3}}
					</view>
					<view class="pohone">
						{{areaInfo.servicePhone3}}
					</view>
				</view>
			</view>
		
			<view class="btn_box">
				<view class="btn1" @click="isbackcar = false">
					取消
				</view>
				<!-- <view class="btn2" @click="backDevice()">
					确定
				</view> -->
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				bgc: {
					backgroundColor: "#64B6A7",
				},
				areaInfo: {},
				tabindex:0,
				classlist:[],
				wordlist:[],
				isbackcar:false,
				showkf:false,
				lastArea:{}
			}
		},
		onShow() {
			this.getarea()
			this.getclass()
			// this.getlastPhone()
			this.getuserInfo()
		},
		methods: {
			getlastPhone(user){
				this.$u.get('/appVerify/latestServicePhone?userId=' + user.userId).then(res => {
						
						if (res.code == 200) {
							this.lastArea=res.data
											
											
						}
				});
			},
			getuserInfo(){
				
				this.$u.get("/getAppInfo").then((res) => {
				
					if (res.code == 200) {
						console.log(res);
						this.getlastPhone(res.user)

					} else {

					}
				});
			},
			getarea() {
				let id = uni.getStorageSync('areaId');
				this.$u.get("/app/area/" + id).then((res) => {

					if (res.code == 200) {
						this.areaInfo = res.data
						// this.areaInfo.serviceName1='陶旭旭'
						// this.areaInfo.servicePhone1='17795402553'
					} else {
						// uni.showToast({
						// 	title: res.msg,
						// 	icon: 'none',
						// 	duration: 2000
						// });
					}
				});
			},
			topage(item) {
			    // 编码 title 和 content
			    const encodedTitle = encodeURIComponent(item.title);
			    const encodedContent = encodeURIComponent(JSON.stringify(item.content));
			    // 跳转到新页面并传递编码后的 title 和 content
			    uni.navigateTo({
			        url: `/page_user/word?id=`+item.articleId
			    });
			},
			changeitx(itme,index){
				this.tabindex=index
				this.getword(itme.classifyId)
			},
			getclass() {
				
				this.$u.get("/app/classify/list?deptId=101&parentId=111" ).then((res) => {
			
					if (res.code == 200) {
						this.classlist = res.data
						let id =this.classlist[0].classifyId
						this.getword(id)
					} else {
						// uni.showToast({
						// 	title: res.msg,
						// 	icon: 'none',
						// 	duration: 2000
						// });
					}
				});
			},
			getword(id) {
				
				this.$u.get("/app/article/list?classifyId="+id ).then((res) => {
			
					if (res.code == 200) {
						this.wordlist = res.rows
			
					} else {
						// uni.showToast({
						// 	title: res.msg,
						// 	icon: 'none',
						// 	duration: 2000
						// });
					}
				});
			},
			callPhone(phone){
				this.isbackcar=false
				uni.makePhoneCall({
					phoneNumber:phone
				})
				setTimeout(()=>{
					this.showkf=false
				},500)
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #fff;
	}

	.page {
		width: 750rpx;
		padding-bottom: 300rpx;
		.kfbox{
			padding: 48rpx 30rpx;
			position: fixed;
			left: 82rpx;
			top: 410rpx;
			width: 590rpx;
			// height: 282rpx;
			background: #FFFFFF;
			border-radius: 30rpx 30rpx 30rpx 30rpx;
			z-index: 110;
			display: flex;
			justify-content: center;
			flex-wrap: wrap;
			.close{
				position: relative;
				bottom: -124rpx;
				width: 60rpx;
				height: 60rpx;
			}
			.phone_box{
				margin-top:32rpx;
				width: 528rpx;
				height: 144rpx;
				background: #FFFFFF;
				box-shadow: 0rpx 4rpx 22rpx 0rpx rgba(0,0,0,0.1);
				border-radius: 20rpx 20rpx 20rpx 20rpx;
				display: flex;
				flex-wrap: nowrap;
				align-items: center;
				.img{
					width: 86rpx;
					height: 86rpx;
					image{
						margin-left: 30rpx;
						width: 86rpx;
						height: 86rpx;
					}
				}
				.info{
					display: flex;
					flex-wrap: wrap;
					margin-left: 34rpx;
					.name{
						width: 100%;
						font-weight: 600;
						font-size: 32rpx;
						color: #3D3D3D;	
					}
					.phone{
						width: 100%;
						font-weight: 400;
						font-size: 32rpx;
						color: #3D3D3D;
					}
				}
			}
			.tit{
				font-weight: 600;
				font-size: 40rpx;
				color: #3D3D3D;
			}
			.words{
				margin-bottom: 42rpx;
				margin-top: 16rpx;
				font-weight: 400;
				font-size: 28rpx;
				color: #3D3D3D;
			}
		}
		
		
		.pops {
		
			padding: 46rpx 36rpx;
			position: fixed;
			top: 400rpx;
			left: 74rpx;
			width: 604rpx;
			// height: 606rpx;
			background: #fff;
			border-radius: 20rpx 20rpx 20rpx 20rpx;
			z-index: 110;
		
			.close {
				position: absolute;
				left: 266rpx;
				bottom: -100rpx;
		
				image {
					width: 80rpx;
					height: 80rpx;
				}
			}
		
			.loading_box {
				width: 100%;
				// height: 200rpx;
				display: flex;
				align-items: center;
				justify-content: center;
		
				image {
					width: 336rpx;
					height: 154rpx;
				}
		
				// .loader {
				//   width: 120rpx;
				//   aspect-ratio: 1;
				//   border-radius: 50%;
				//   clip-path: inset(-360rpx); /* 4倍的比例调整 */
				//   box-shadow: -240rpx 60rpx, -240rpx 60rpx, -240rpx 60rpx; /* 4倍的比例调整 */
				//   transform: translateY(-60rpx); /* 4倍的比例调整 */
				//   animation: l19 1s infinite linear;
				// }
		
				// @keyframes l19 {
				//   16.67% {box-shadow:-240rpx 60rpx,-240rpx 60rpx,  76rpx 60rpx} /* 4倍的比例调整 */
				//   33.33% {box-shadow:-240rpx 60rpx,    0px 60rpx,  76rpx 60rpx} /* 4倍的比例调整 */
				//   40%,60%{box-shadow: -76rpx 60rpx,    0px 60rpx,  76rpx 60rpx} /* 4倍的比例调整 */
				//   66.67% {box-shadow: -76rpx 60rpx,    0px 60rpx, 240rpx 60rpx} /* 4倍的比例调整 */
				//   83.33% {box-shadow: -76rpx 60rpx, 240rpx 60rpx,240rpx 60rpx} /* 4倍的比例调整 */
				//   100%   {box-shadow: 240rpx 60rpx, 240rpx 60rpx,240rpx 60rpx} /* 4倍的比例调整 */
				// }
		
			}
		
			.btn_box {
				margin-top: 80rpx;
				display: flex;
				align-items: center;
				justify-content: center;
		
				.btn1 {
					display: flex;
					align-items: center;
					justify-content: center;
					width: 216rpx;
					height: 90rpx;
					background: #989898;
					border-radius: 54rpx 54rpx 54rpx 54rpx;
		
					font-weight: 500;
					font-size: 40rpx;
					color: #FFFFFF;
				}
		
				.btn2 {
					display: flex;
					align-items: center;
					justify-content: center;
					width: 268rpx;
					height: 90rpx;
					background: #4C97E7;
					border-radius: 54rpx 54rpx 54rpx 54rpx;
		
					font-weight: 500;
					font-size: 40rpx;
					color: #FFFFFF;
				}
			}
		
			.time {
				margin-top: 20rpx;
				text-align: center;
				font-weight: 500;
				font-size: 48rpx;
				color: #4C97E7;
			}
		
			.cont {
				height: 500rpx;
				overflow-x: hidden;
				overflow-y: auto;
			}
		
			.tits {
				// width: 604rpx;
				text-align: center;
				font-weight: 500;
				font-size: 36rpx;
				color: #3D3D3D;
				margin-bottom: 54rpx;
			}
		
			.cont_box {
				margin-top: 36rpx;
				display: flex;
				flex-wrap: wrap;
				align-items: center;
				justify-content: center;
				.pohone_li{
					margin-top: 10rpx;
					display: flex;
					flex-wrap: nowrap;
					.name{
						font-weight: 500;
						font-size: 36rpx;
						color: #3D3D3D;
						margin-bottom: 54rpx;
					}
					.pohone{
						margin-left: 20rpx;
						font-weight: 500;
						font-size: 36rpx;
						color: #3D3D3D;
						margin-bottom: 54rpx;
					}
				}
				
			}
		
			.text {
				margin-top: 36rpx;
				display: flex;
				flex-wrap: wrap;
				// align-items: center;
		
				.yuan {
					margin-top: 10rpx;
					margin-right: 12rpx;
					width: 20rpx;
					height: 20rpx;
					background: #000;
					border-radius: 50%;
				}
		
				span {
					width: 90%;
					font-weight: 400;
					font-size: 28rpx;
					color: #3D3D3D;
				}
			}
		
			.btn {
				margin-left: 40rpx;
				margin-top: 50rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				width: 470rpx;
				height: 90rpx;
				background: #4C97E7;
				border-radius: 54rpx 54rpx 54rpx 54rpx;
				font-weight: 500;
				font-size: 40rpx;
				color: #FFFFFF;
			}
		
			.act1 {
				background-color: #ccc;
			}
		}
		
		
		.backimg{
			position: fixed;
			width: 750rpx;
			height: 384rpx;
			z-index: -1;
		}
		.tit{
			margin-top: 56rpx;
			margin-left: 56rpx;
			font-weight: 400;
			font-size: 30rpx;
			color: #FFFFFF;
		}
		.qscard{
			width: 680rpx;
			margin: 40rpx auto ;
			background: #FFFFFF;
			border-radius: 40rpx;
			padding: 28rpx 30rpx;
			box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42,130,228,0.1);
			.card_top{
				display: flex;
				align-items: center;
				flex-wrap: nowrap;
				justify-content: space-around;
				.li{
					width: 112rpx;
					display: flex;
					flex-wrap: wrap;
					justify-content: center;
					.txt{
						font-weight: 500;
						font-size: 28rpx;
						color: #3D3D3D;
					}
					.bot_bor{
						margin-top: 16rpx;
						width: 66rpx;
						height: 6rpx;
						background: #64B6A7;
						border-radius: 3rpx 3rpx 3rpx 3rpx;
					}
				}
			}
			.qs_li:first-child{
				margin-top: 40rpx;
			}
			.qs_li:last-child{
				border-bottom: 2rpx solid #fff;
			}
			.qs_li{
					// margin-top: 10rpx;
				display: flex;
				flex-wrap: nowrap;
				align-items: center;
				justify-content: space-between;
				border-bottom: 2rpx solid #D8D8D870;
				padding-top: 26rpx;
				padding-bottom: 26rpx;
				.qs_li_txt{
				
					font-weight: 400;
					font-size: 28rpx;
					color: #3D3D3D;
				}
				.icon-xiangyou1{
					font-size: 32rpx;
					color: #3D3D3D;
				}
			}
		}
		.btn {
			position: fixed;
			left: 36rpx;
			bottom: 44rpx;
			display: flex;
			align-items: center;
			justify-content: center;


			width: 680rpx;
			height: 118rpx;
			background: #1E807A;
			border-radius:20rpx;

			image {
				margin-right: 18rpx;
				width: 34.5rpx;
				height: 33rpx;
			}
			font-weight: 600;
			font-size: 40rpx;
			color: #FFFFFF;
		}
	}
</style>