<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:'',
				logindata:'',
				id:'',
			}
		},
		onLoad(opt) {
			var that=this;
			this.wxOpendata=uni.getStorageSync("wxOpendata");
			this.logindata=uni.getStorageSync("logindata")
			uni.getLocation({
			    type: 'gcj02',
			    success: function (res) {
			        console.log('当前位置的经度：' + res.longitude);
			        console.log('当前位置的纬度：' + res.latitude);
					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||!that.logindata){
							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+'carOwner/index?codeapp='+that.wxOpendata.code+ '&shopId='+that.wxOpendata.shopID+'&lat='+res.latitude+'&lng='+res.longitude
						}else{
							that.url=that.$webURL+'carOwner/index?codeapp=&shopId=&lat='+res.latitude+'&lng='+res.longitude
						}
					}
			    },
				fail(err) {
					console.log(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+'carOwner/index?codeapp='+that.wxOpendata.code+ '&shopId='+that.wxOpendata.shopID+'&lat=""&lng=""'
				    	}
				    }
				}
			});
			
			console.log(opt)
			//opt.id='3A9DBC40-D5D4-43A6-8ACA-5CF909771512'
			
			
			/* if(opt.shopId){
				this.url2='http://wx.32che.cn/weixin/authorize?path=/carOwner/index&isCarOwner=true&shopId='+opt.shopId
			} */
           //http://192.168.0.215:9588/#/carOwner/index?codeapp=D8E849B9EE0D4A07812BB0186E77B993&lat=36.68013&lng=117.06533
		   
		
		   
		},
		
		
		methods: {
			goUrl(){
				
			},
            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>
