<template>
	<view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				getstationCode:null,
			}
		},
		mounted() {
			this.getPamars()
		},
		onLoad(options) {
			if(options.stationCode){
				this.getstationCode=options.stationCode
			}
			if((decodeURIComponent(options.q)).split("=")[1]){
				this.getstationCode = (decodeURIComponent(options.q)).split("=")[1]
			}
		},
		methods: {
			getPamars(){
				if(this.$storage.getJson("token")){
					this.$http.getStationExchange({
						stationCode: this.getstationCode
					}).then(res => {
						if (res.code === 0 && res.data) {
							uni.redirectTo({
								url: '/pages/powerExchange/index?stationCode=' +this.getstationCode + '&exchangeNo=' + res.data
							})
						} else {
							uni.navigateTo({
								url: '/pages/public/404?error=' + res.msg
							})
						}
					})
				}else{
					uni.navigateTo({
						url: '/pages/public/login?topage='+this.getstationCode,
					});
				}
			}
		}
	}
</script>

<style>

</style>
