<template>
	<view class="qr_code flexCC">
		<image src="../../static/code_bg.png" mode="" class="code_bg"></image>
		<view class="code_box flexCC">
			<view class="img flexC">
				<image :src="info.headimg" class="store_img"></image>
			</view>
			<view class="qr_con">
				<view class="store_name">{{ info.name | getName(10) }}</view>
				<image :src="info.qrcode" class="code_img" @click="preview"></image>
				<view class="hint">点击图片-长按-加客服微信好友</view>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		getServiceInfo
	} from '../../../apis/shop.js'
	export default {
		data() {
			return {
				info: '' //店铺信息
			};
		},
		methods: {},
		onShow() {
			this.getInfo()
		},
		methods: {
			//点击放大
			preview() {
				uni.previewImage({
					current: this.info.qrcode,
					urls: [this.info.qrcode]
				})
			},
			//获取客服信息
			getInfo() {
				getServiceInfo().then(res => {
					if (res.code == 200) {
						this.info = res.data;
					} else {
						uni.showModal({
							content: res.msg || '获取信息失败',
							showCancel: false,
							success: model => {
								if (model.confirm) {
									uni.navigateBack()
								}
							}
						})
					}
				})
			}
		}
	};
</script>

<style lang="scss" scoped>
	.qr_code {
		width: 100vw;
		height: 100vh;
		position: relative;

		.code_bg {
			width: 100vw;
			height: 100vh;
			position: fixed;
			top: 0;
			left: 0;
		}

		// background: url('../../static/code_bg.png') no-repeat;
		// background-size: 100% 100%;
		.code_box {
			width: 100%;
			height: 100vh;
			z-index: 999;

			.img {
				.store_img {
					width: 200rpx;
					height: 200rpx;
					border: 6rpx solid #fff;
					border-radius: 50%;
					z-index: 99999;
				}
			}

			.qr_con {
				width: 690rpx;
				height: 70vh;
				background: rgba(255, 255, 255, 0.79);
				margin: -100rpx auto 0;
				border-radius: 24rpx;
				display: flex;
				flex-direction: column;
				align-items: center;

				.store_name {
					font-size: 44rpx;
					font-weight: bold;
					padding: 130rpx 0 30rpx;
				}

				.code_img {
					width: 450rpx;
					height: 450rpx;
					margin: 40rpx 0 40rpx;
					border-radius: 24rpx;
				}

				.hint {
					font-size: 36rpx;
					font-weight: bold;
				}
			}

		}

	}
</style>
