<template>
	<view class="p-box">
		<view class="box ">
			<image src="../../static/img/logo.png" mode=""></image>
			<image src="../../static/img/2.png" mode=""></image>
			<view style="margin-top: 10px;">掌柜会员号：{{id}}
				<image style="height:12px;width:13px;display: inline-block;margin-left:5px"
					src="../../static/icon/gongxiang.png" mode="" @tap="aaa"></image>
			</view>
			<view>绑定手机号：{{mobile}}</view>
			<image style="padding-top: 12px;
			width: 100%;
			height: 330px;" src="../../static/img/1.png" mode=""></image>
			<image src="../../static/img/3.png" mode="" @tap="downloadApp('android')"></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mobile: '',
				id: '',
				type: '',
			}
		},
		async onLoad(e) {
			let options = JSON.parse(e.data);
			if (e) {
				this.id = options.id;
				this.mobile = options.mobile; //驳回内容
				this.grade = options.grade;
			}
		},
		methods: {
			aaa() {
				uni.setClipboardData({
					data: this.id
				})
			},
			downloadApp(typeId) {
				var btn = document.getElementById(typeId);
				this.weixinTip(btn);
			},
			// 判断是不是微信
			async weixinTip(ele) {
				var ua = navigator.userAgent;
				var isWeixin = !!/MicroMessenger/i.test(ua);
				if (isWeixin) {
					ele.onclick = function(e) {
						window.event ? window.event.returnValue = false : e.preventDefault();
						document.getElementById('weixin-tip').style.display = 'block';
					}
				} else {
					if (!!this.id) {
						uni.setClipboardData({
							data: this.id
						})
					}
					let pageRequest = {
						pageNum: 1,
						pageSize: 50,
						columnFilters: {
							apptype: {
								name: "apptype",
								value: "apk",
							},
							appid: {
								name: "appid",
								value: this.grade == 4 ? "__UNI__D4FE29A" : '__UNI__2041321',
							}
						}
					};
					let getquote = await this.$http.post('/sysVersion/findPage', pageRequest);
					let url = getquote.data.content[0].path;
					if (getquote.code == '200') {
						window.open(url);
					} else {
						uni.showToast({
							title: getquote.msg,
							icon: 'none'
						});
					}

				}
			},
			async promotionCode() {

				let pageRequest = {
					pageNum: 1,
					pageSize: 50,
					columnFilters: {
						apptype: {
							name: "apptype",
							value: "apk",
						},
						appid: {
							name: "appid",
							value: '__UNI__2041321',
						}
					}
				}
				let res = await this.$http.post('/sysVersion/findPage', pageRequest);
				if (res.code == 200) {
					this.pathUrl = res.data.content[0].path
					this.workImg = QR.createQrCodeImg(res.data.content[0].path, {
						size: parseInt(200) //二维码大小  
					})
				}

			},
		},
	}
</script>

<style lang="scss" scoped>
	.p-box {
		width: 100%;
		height: 100vh;
		background: url(/static/img/beijing1.png) no-repeat;
		background-size: 100% 100%;
		// background: #D0CCFB;
	}

	.box {
		height: 160px;
		width: 100%;
		// position: relative;
		background: url(/static/img/beijng2.png) no-repeat;
		background-size: 100% 100%;
		text-align: -webkit-center;

		// position: relative;
		image {
			display: block;
		}

		text {
			font-size: 14px;
			color: #666666;
			padding-top: 5px;
		}

		image:first-child {
			padding-top: 52px;
			width: 110px;
			height: 20px;
		}

		image:nth-child(2) {
			padding-top: 17px;
			width: 260px;
			height: 35px;
		}

		image:last-child {
			padding-top: 30px;
			width: 220px;
			height: 55px;
		}
	}
</style>