<template>
	<view>
		<view  v-if="pageData.type=='4'">
			<ShopApproval :businessId="pageData.id" :data="approvalInfo" ref="shop" @refresh="reload" :approvalData="approvalData"></ShopApproval>
		</view>
	</view>
</template>

<script>
	import ShopApproval from './components/shopApproval.vue'
	export default {
		data() {
			return {
				pageData:{
					type: null,
					id: null
				},
				approvalInfo: {},
				approvalData: {}// 审批后授权的列表
			}
		},
		components:{
			ShopApproval
		},
		methods: {
			getDetail (opt){
				let _this = this
				this.$request.$webGet('/EShangApiMain/Platform/GetPermissionApplyDetail?permissionApplyid='+opt.id).then(res=>{
					uni.hideLoading()
					if (res.Result_Code !== 100) {return }
					_this.approvalInfo = res.Result_Data
					if(_this.pageData.type==='4') {
						_this.$refs['shop'].getShops(res.Result_Data)
						_this.getDetailList({id:opt.id,type: res.Result_Data.PERMISSIONAPPLY_TYPE})
					}
				})
			},
			getDetailList(obj){
				let _this = this
				this.$request.$webGet('/EShangApiMain/BusinessProcess/GetPermissionApplyDetailList?permissionApplyid='+obj.id+'&PermissionApplyType='+obj.type).then(res=>{
					uni.hideLoading()
					if (res.Result_Code !== 100) {return }
					_this.approvalData = res.Result_Data 
					
				})
			},
			reload(){
				
				this.getDetail(this.pageData)
				this.getDetailList(this.pageData)
			}
		},
		onLoad(option){
			uni.showLoading()
			this.pageData = option
			this.getDetail(option)
			this.$forceUpdate()
		}
	}
</script>

<style>

</style>
