<template>
	<view>
		<block v-if="!is_apply"><ApplyForm @applySuccess="applySuccess" :merchantInfo="merchant_info"/></block>
		<block v-else><AuditApplay :merchantInfo="merchant_info" @cancelApply='cancelApply'/></block>
	</view>
</template>

<script>
import ApplyForm from './components/ApplyForm.vue';
import AuditApplay from './components/AuditApplay.vue';

export default {
	components: { ApplyForm, AuditApplay },
	data() {
		return {
			is_apply: false,
			merchant_info: {}
		};
	},
	onLoad() {
		this.getInfoMerchant();
	},
	methods: {
		// 提交申请成功
		applySuccess() {
			this.is_apply = true;
		},
		cancelApply(){
			this.is_apply = false;
		},
		// 商户详情
		getInfoMerchant() {
			this.$u.api.getInfoMerchant().then(res => {
				this.merchant_info = res.data;
				this.is_apply = JSON.stringify(res.data) !== '{}';
			});
		}
	}
};
</script>

<style></style>
