<template>
	<view class="content">
		<view class="box">
			<web-view :src="url" @message="message"></web-view> 
		</view>
		<!-- <view>12zf</view> -->
		 
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: '',
				
				wxOpendata:'',
				id:'',
			}
		},
		onLoad(opt) {
			var that=this;
			this.wxOpendata=uni.getStorageSync("wxOpendata");
			uni.getLocation({
			    type: 'wgs84',
			    success: function (res) {
			       if(opt.id){
			       	that.url=that.$webURL+'paySuccess?orderId='+opt.id+'&hideHeader=true&codeapp='+that.wxOpendata.code+'&lat='+res.latitude+'&lng='+res.longitude
			       }else{
			       	if(!that.wxOpendata.shopID){
			       		uni.navigateTo({
			       			url:'../login/empower'
			       		})
			       	}
			       	if(that.wxOpendata.code){
			       		//this.url='http://dms.32che.cn/#/carOwner/index?codeapp='+this.wxOpendata.code+ '&shopId='+this.wxOpendata.shopID
			       		that.url=that.$webURL+'?codeapp='+that.wxOpendata.code+ '&shopId='+that.wxOpendata.shopID+'&lat='+res.latitude+'&lng='+res.longitude
			       	}
			       }
					
			    },
				fail(err) {
					if(opt.id){
						that.url=that.$webURL+'paySuccess?orderId='+opt.id+'&hideHeader=true&codeapp='+that.wxOpendata.code+'&lat=""&lng=""'
					}else{
						if(!that.wxOpendata.shopID){
							uni.navigateTo({
								url:'../login/empower'
							})
						}
						if(that.wxOpendata.code){
							//this.url='http://dms.32che.cn/#/carOwner/index?codeapp='+this.wxOpendata.code+ '&shopId='+this.wxOpendata.shopID
							that.url=that.$webURL+'?codeapp='+that.wxOpendata.code+ '&shopId='+that.wxOpendata.shopID+'&lat=""&lng=""'
						}
					}
				}
			});
			
			/* if(opt.id){
				this.url=this.$webURL+'paySuccess?orderId='+opt.id+'&hideHeader=true&codeapp='+this.wxOpendata.code
			}else{
				if(!this.wxOpendata.shopID){
					uni.navigateTo({
						url:'../login/empower'
					})
				}
				if(this.wxOpendata.code){
					//this.url='http://dms.32che.cn/#/carOwner/index?codeapp='+this.wxOpendata.code+ '&shopId='+this.wxOpendata.shopID
					this.url=this.$webURL+'?codeapp='+this.wxOpendata.code+ '&shopId='+this.wxOpendata.shopID
				}
			} */
			
			/* if(opt.shopId){
				this.url2='http://wx.32che.cn/weixin/authorize?path=/carOwner/index&isCarOwner=true&shopId='+opt.shopId
			} */
           
		   
		
		   
		},
		
		
		methods: {
            message(event){
                console.log(event);
            }
		}
	}
</script>

<style>
	.content {
		/* display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center; */
		
	}
	.box{
		padding-bottom: env(safe-area-inset-bottom);
		
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>