<template>
	<div>
		<common @asynCallBack="asynCallBack" :projectCheck="false"></common>
		<top-header :pageTitle="pageTitle"></top-header>

		<div class="mui-content vongi-xzdw">
			<ul class="mui-table-view vongi-xzyljg">
				<li v-for="(item,index) in companyList" class="mui-table-view-cell mui-media">
					<a @click="clickCompany(item)" v-text="item.name">

					</a>
				</li>
			</ul>
		</div>

		<loading :visible="isLoading"></loading>
	</div>
</template>

<script>
	import * as API_Person from '@/apis/person'
	import Common from '$project/components/Common.vue'
	import Loading from '$project/components/Loading.vue'
	import TopHeader from '$project/components/TopHeader.vue'
	import isReachBottom from '$project/utils/isReachBottom'
	import {
		mapGetters,
		mapMutations
	} from 'vuex'
	import * as types from '$project/store/mutation-types'
	export default {
		name: 'RegisterPensionStep3_4',
		components: {
			Common,
			Loading,
			TopHeader
		},
		data() {
			return {
				pageTitle: '选择服务机构',

				subForm: {
					sceneId: '',
					sceneName: '',
					personRoleId: '',
					roleName: '',
					name: '',
					telephone: '',
					personId: '',
					companyId: '',
					companyName: '请选择',
					companyStructureId: '',
					serviceCompanyId: '',
					serviceCompanyName: '请选择',
					//companyStructureName: '请选择',
					//最终选择的数据
					selectCompanyStructureList: [],
					address: '',
					idCard: '',
					faceImageUrl: ''
				},

				isLoading: false,

				companyList: []
			}
		},
		created() {
			this.subForm = this.register_form_data;
		},
		methods: {
			//获取公司列表
			getCompanyList() {
				this.isLoading = true;
				API_Person.getServiceCompanyIdList().then(response => {
					this.isLoading = false;
					this.companyList = response.list;
				}).catch(error => {
					this.isLoading = false;
					mui.toast(error);
				})
			},
			//公司选择
			clickCompany(item) {
				this.subForm.serviceCompanyId = item.id;
				this.subForm.serviceCompanyName = item.name;
				this.set_register_form_data(this.subForm);
				this.$router.push({
					name: 'RegisterPensionStep1'
				})
			},

			asynCallBack() {

			},
			...mapMutations({
				set_register_form_data: types.SET_REGISTER_FORM_DATA,
			})
		},
		mounted() {
			this.getCompanyList();
		},
		destroyed() {},
		computed: {
			...mapGetters({
				openId: 'wx_openid',
				token: 'token',
				person_data: 'person_data',
				person_popedom: 'person_popedom',
				register_form_data: 'register_form_data'
			})
		}
	}
</script>

<style scoped src="$project/assets/css/xpwyfyy.css"></style>
<style scoped src="$project/assets/css/sczpfyy.css"></style>
<style src="$project/assets/css/iconfont.css"></style>
<style>
</style>
