<template>
	<uv-popup ref='openKf' :zIndex="20" mode="center" bgColor="transparent">
		<view class="top-bg">
			<image class='image' src="/static/img/tip-bg.png"></image>
			<text class="text">联系客服</text>
		</view>
		<view class="pop-body fx-h fx-bc">
			<view class="inner fx-h fx-bc">
				<text class="title">已为您定制专属客服</text>
				<image src="/static/img/kfu.png" class="kfu-icon"></image>
				<view class="wx">客服VX:{{ wxName }}</view>

				<view class="btns fx-r fx-bc">
					<text class="n-btn ihover" @tap="tapCancel">取消</text>
					<text class="copy-btn ihover" @tap="tapCopy">复制微信</text>
				</view>

			</view>
			<view class="m-close">
				<uv-icon @tap="tapCancel" name="close-circle" size="35" color="#fff"></uv-icon>
			</view>
		</view>
	</uv-popup>
</template>
<style lang="scss">
	.top-bg {
		position: relative;
		text-align: center;
		z-index: 100;
		margin-bottom: -80rpx;
		.image {
			width: 60vw;
			height: 18vw;
		}
		.text {
			position: absolute;
			width: 100%;
			height: 100%;
			top: 0;
			left: 0;
			font-size: 32rpx;
			color: #734227;
			text-align: center;
			line-height: 16vw;
		}
	}
	
	.pop-body {
		position: relative;
		.inner {
			padding: 20px;
			width: 80vw;
			position: relative;
			background: #fff;
			border-radius: 20rpx;

			.title {
				font-size: 32rpx;
				color: #333333;
				margin-bottom: 20rpx;
				padding-top: 20rpx;
			}

			.wx {
				font-size: 32rpx;
				color: #333333;
				margin-top: 20rpx;
			}

			.kfu-icon {
				width: 180rpx;
				height: 143rpx;
			}

			.btns {
				margin-top: 30rpx;

				.n-btn {
					border-radius: 10rpx;
					border: 2rpx solid #DFC77C;
					font-size: 32rpx;
					color: #625120;
					padding: 0 80rpx;
					margin-right: 40rpx;
					height: 80rpx;
					line-height: 80rpx;
				}

				.copy-btn {
					background: linear-gradient(-90deg, #D4BA6C 0%, #F9E8A5 100%);
					border-radius: 10px;
					font-size: 32rpx;
					color: #625120;
					padding: 0 80rpx;
					height: 80rpx;
					line-height: 80rpx;
				}
			}
		}

		.m-close {
			margin-top: 60rpx;
		}
	}
</style>

<script>
	import Request from '@/library/Request.js'
	var swH = 0;
	export default {
		name: 'ui-customer',
		props: {},
		data() {
			return {
				isShow: false,
				wxName: ""
			}
		},
		methods: {
			tapCancel: function() {
				this.$refs.openKf.close()
			},
			open() {
				const that = this;
				uni.showLoading({
					title: '获取数据中..'
				});
				console.log(Request, 'Request')
				Request
					.post("indexGuLx")
					.then(res => {
						uni.hideLoading();
						if (res.code == 200) {
							that.wxName = res.data.wxname;
							that.$refs.openKf.open()
						} else {
							that.utils.Tip(res.msg);
						}
					})
					.catch((res) => {
						console.log(res);
						uni.hideLoading();
						uni.showModal({
							title: '系统提示',
							content: '加载失败，返回在尝试',
							showCancel: false
						});
					});

			},
			tapCopy() {
				uni.setClipboardData({
					data: value,
					showToast: true
				});
			}

		}
	}
</script>