<template>
	<view class="install">
		<view class="install_notice">
			尊敬的用户,为了方便您<text>下单的产品</text>预约安装、售后保修以及咨询官方客服,我们将家电、手机、平板、笔记本电脑的主流品牌的预约安装,售后保修的<text>官方链接整理如下</text>,您只需要对应好品类,选择相应的品牌即可直接预约安装、售后报修、查询官方服务站,以及<text>联系官方客服</text>。
		</view>
		<view class="install_content" v-for="(item,index) in list">
			<view class="install_name">{{item.name}}</view>
			<view class="install_bao">
				<view class="install_xiu" v-for="(child,index) in item.maintenances" :key="index" @click="onLookCord(child.img_url)">
					{{child.name}}
				</view>
			</view>
		</view>
		<view class="install_kefu">
			<view class="install_cont">
				感谢您对我们的信任与支持!如果您的订单有什么疑问,或者需要帮助,请您在线联系我们的客服人员,我司全体工作人员竭诚为您服务!
			</view>
		</view>
		<!-- 核销二维码弹窗 -->
		<view class="bigCode" v-if="showQRCodePopup" @click="showQRCodePopup=false">
			<view class="cm">
				<view class="cm_text">
					识别二维码
				</view>
				<view class="txm">
					<image :src="qrcode" :show-menu-by-longpress="true"
						mode="" class="codeImg"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import * as newFunApi from '@/api/newFun'
	import {
		createQrCodeImg
	} from '@/utils/qrcode'
	export default {
		data() {
			return {
				showQRCodePopup: false,
				list: [],
				qrcode:''
			};
		},
		onLoad(o) {
			this.getList()
		},
		methods: {
			onLookCord(url) {
				console.log(url)
				uni.previewImage({
					urls: [url], //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
					current: url, // 当前显示图片的http链接,默认是第一个
					success: function(res) {},
					fail: function(res) {},
					complete: function(res) {},
				})
				// this.showQRCodePopup = true
				// this.qrcode = createQrCodeImg(url, { 'size': 500 });
				// uni.previewImage({
				// 	current:: this.qrcode
				// 	urls: [this.qrcode]
				// })
			},
			/**
			 * 获取列表
			 */
			async getList() {
				let {status, message, data} = await newFunApi.maintenance({});
				if(status == 200){
					this.list=data
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.install {
		overflow: hidden;
		margin: 20rpx;

		.bigCode {
			position: fixed;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			background: rgba(65, 65, 65, 0.46);
			display: flex;
			align-items: center;
			justify-content: center;

			.cm {
				width: 560rpx;
				background: #FFFFFF;
				border-radius: 16rpx 16rpx 16rpx 16rpx;
				opacity: 1;
				padding: 40rpx 0 50rpx 0;

				.cm_text {
					width: 100%;
					height: 42rpx;
					font-size: 30rpx;
					font-weight: 500;
					color: #424242;
					line-height: 42rpx;
					text-align: center;
				}

				.txm {
					display: flex;
					justify-content: center;
					margin-top: 30rpx;

					.codeImg {
						width: 394rpx;
						height: 394rpx;
						border-radius: 0rpx 0rpx 0rpx 0rpx;
						opacity: 1;
					}

				}
			}
		}

		.install_content {
			width: 100%;
			// height: 385rpx;
			background: #FFFFFF;
			border-radius: 10rpx;
			margin-top: 25rpx;

			.install_name {
				height: 80rpx;
				background-image: url('https://www.royaum.com.cn/static/install_name.png');
				background-size: 100% 100%;
				background-position: center;
				font-family: Alibaba PuHuiTi;
				font-weight: 400;
				font-size: 34rpx;
				line-height: 80rpx;
				color: #222222;
				padding-left: 32rpx;
				font-weight: 700;
			}

			.install_bao {
				overflow: hidden;
				padding: 0rpx 20rpx 25rpx 20rpx;
				display: flex;
				flex-wrap: wrap;
				.install_xiu {
					font-family: Alibaba PuHuiTi;
					font-weight: 400;
					font-size: 30rpx;
					color: #222222;
					padding: 0 32rpx;
					height: 70rpx;
					background: #FFFFFF;
					border-radius: 10rpx;
					border: 1rpx solid #CCCCCC;
					text-align: center;
					line-height: 70rpx;
					margin-bottom: 20rpx;
					margin: 20rpx 10rpx 0 10rpx;
				}
			}
		}

		.install_kefu {
			width: 100%;
			height: 244rpx;
			background-image: url('https://www.royaum.com.cn/static/install_footer.png');
			background-size: 100% 100%;
			font-family: Alibaba PuHuiTi;
			font-weight: 400;
			font-size: 28rpx;
			color: #222222;
			line-height: 48rpx;
			margin-bottom: 50rpx;
			margin-top: 20rpx;
			position: relative;

			.install_cont {
				position: absolute;
				right: 30rpx;
				top: 28rpx;
				width: 450rpx;
			}
		}

		.install_notice {
			width: 100%;
			height: 354rpx;
			background-image: url('https://www.royaum.com.cn/static/install_hedaer.png');
			background-size: 100% 100%;
			font-family: Alibaba PuHuiTi;
			font-weight: 400;
			font-size: 28rpx;
			color: #222222;
			padding: 35rpx;
			line-height: 48rpx;

			text {
				font-weight: 700;
			}

		}
	}
</style>