<template>
	<view>
		<web-view @message="handleMsg" :src='webUrl' ></web-view>
	</view>
</template>

<script>
	import http from '@/shopro/request/index';
	// import http from '@/shopro/request/index';
	import {
		BASE_URL,
		MALL_ID,
		COMPANY_ID
	} from "@/env";
	export default {
		data() {
			return {
				webUrl:'',
				appointPage:''
			}
		} ,
		onReady(){
			// this.webUrl = "https://wx.zhonghuihaotai.com/webpage/wxdist/index.html#/?mallId=134581110000230&companyId=00000310&time="+new Date().getTime()
		},
		methods:{
			handleMsg(e){
				// uni.navigateToMiniProgram({
				// 	orderId: data.orderId,
				// });
			},
			saveMiniCode(){
				let fsCode =  uni.getStorageSync('token');
				http('user.miniCode', {fsCode:fsCode}).then(res => {
					if (!res.code && res.data) {
						let code = res.data.sfCode;
						let time = new Date().getTime();
						this.webUrl= `${BASE_URL}/webpage/wxdist/index.html#/${this.appointPage?this.appointPage:""}?mallId=${MALL_ID}&companyId=${COMPANY_ID}&time=${time}&sfCode=${code}&authMode=force`
						console.log(this.webUrl)
					}  
				})
				
			}
		},
		onLoad(option){
			this.appointPage = option.appointPage;//指定页面
			// uni.hideTabBar();
			this.saveMiniCode();
		},
		onLaunch(){
		}
	}
</script>
<style>
</style>
