<template>
	<!-- 报价/客户支付模态框 -->
	<view class="cu-modal" :class="show?'show':''">
		<view class="cu-dialog bg-white">
			<view class="cu-bar bg-white justify-end">
				<view class="content">小程序邀请二维码</view>
				<view class="action" @click="hideModal">
					<text class="cuIcon-close text-red"></text>
				</view>
			</view>
			<view class="padding-tb-sm">
				<image :src="'data:image/png;base64,' + url"></image>
			</view>
			<view class="text-center">
				<view>请通过扫码或分享链接给好友进行邀请</view>
				<button class="cu-btn bg-main-color shadow-blur" open-type="share" :data-shareInfo="shareInfo"
					style="width: 100%;">
					<text class="cuIcon-share"></text>
					<text>分享链接给好友</text>
				</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		nama: 'app-invite-qrcode',
		data() {
			return {
				url: '',
				show: false,
				shareTemplate: {
					title: '家政服务就找工圈子',
					path: '/pages/index/index?customerPlace=',
					imageUrl: 'http://gqz.opsoul.com/sys/group-selfie.png'
				},
				shareInfo: null
			}
		},
		methods: {
			showModal(url) {
				this.show = true;
				this.url = url;
				let curUserInfo = this.$request.getCurUserInfo();
				if (curUserInfo.customerId && curUserInfo.customerId > 0) {
					let path = this.shareTemplate.path + curUserInfo.customerId;
					this.shareInfo = {
						...this.shareTemplate,
						path: path
					}
				}
			},
			hideModal() {
				this.shareInfo = null;
				this.show = false;
			}
		}
	}
</script>
