<template>
  <div class="mianBox">
    <van-row class="contentBox">
		<van-row>
			<van-col span="24" class="logo"><van-image width="75" height="75" :src="require('../img/success.png')" /></van-col>
			<van-col span="24" class="introduce">支付完成</van-col>
		</van-row>
		<div class="pay_wrap">
			<!-- <button class="pay" open-type="launchApp" app-parameter="wechat"  binderror="launchAppError">返回APP</button> -->
			<button class="pay" open-type="launchApp" app-parameter="appData"  @error="launchAppError" @click="closeXCX" v-if="state">返回APP</button>
			<button class="pay"  v-if="!state" @tap ="home">返回首页</button>
		</div>
		<van-toast id="van-toast" />
	</van-row>
  </div>
</template>
<script>
	import Toast from '../../wxcomponents/vant/weapp/dist/toast/toast';
	export default {
		data() {
			return {
				param:undefined,
				state:false,
				appData:{
					errCOde:0,
					errStr:null,
					extMsg:"已支付",
					extraData:"已支付",
					openId:undefined,
					transaction:null,
					type:"WXLaunchMiniProgramReq.Resp"
				}
			}
		},
		onLoad(options) {
			let _this = this
			uni.getStorage({
				key:"openid",
				success(e){
					if(e.data){
						_this.appData.openId = e.data
						_this.appData = JSON.stringify(_this.appData)
					}
				}
			})
			if(!options.type){
				this.state = true	
			}else{
				this.state = false
			}
		},
		methods: {
			// 关闭小程序
			closeXCX(){
				wx.exitMiniProgram({success: (res) => {}})
			},
			launchAppError(e) {
				Toast(e.detail.errMsg)
			},
			home(){
				uni.redirectTo({
				    url: `../index/index`
				});
			}
			
		},
		onShow(options){
		}
	}
</script>
<style lang="scss" scoped>
.mianBox{
    height: 100%;
    width: 100%;
    color: #000;
    box-sizing: border-box;
	background-color: #F2F6FC;
	position: fixed;
    .contentBox{
		width: 100%;
		height: auto;
		padding: 15px 20px;
		box-sizing: border-box;
		overflow: hidden;
		.logo{
			/deep/ .van-image{
				margin:40px auto 0;
				display: block;
			}
		}
		.introduce{
			text-align: center;
			color: #000;
			display: block;
			/deep/ .van-col{
				font-size: 20;
				margin-top:20px;
				letter-spacing: 2px;
			}
		}
		.money{
			text-align: center;
			color: #000;
			/deep/ .van-col{
				font-size: 30px;
				margin-top: 10px;
				font-weight: 700;
			}
		}
		.order_money{
			text-align: center;
			color: #ccc;
			display: block;
			/deep/ .van-col{
				font-size: 20;
				margin-top:10px;
				letter-spacing: 2px;
			}
		}
		/deep/ .van-button{
			border-radius: 6px;
			width: 100% !important;
			margin-top:25px;
			letter-spacing: 2px;
			font-size: 18px;
			height: 50px;
		}
		.order_wrap{
			width:95%;
			padding:10px 20px 20px 20px;
			box-sizing: border-box;
			width:95%;
			margin:20px 2.5%;
			background-color: #fff;
			border-radius: 6px;
			box-shadow: 0 2px 12px 0 #ccc;
			display: block;
			/deep/ .van-col{
				font-size: 16px;
				color:#ccc;
				margin-top:10px;
				display: block;
			}
			/deep/ .left{
				text-align: left;
			}
			/deep/ .right{
				text-align: right;
			}
		}
		.pay_wrap{
			width:95%;
			margin:70px 2.5% 0;
			.pay{
				height: 50px;
				font-size: 18px;
				border-radius: 10px;
				margin-top:40px;
			}
		}
		
    }
}
.pay{
	background:#F22E3C;
	color:#fff;
}
</style>


