
/**
 * Web唐明明
 * 匆匆数载恍如梦，岁月迢迢华发增。
 * 碌碌无为枉半生，一朝惊醒万事空。
 * moduleName: 业务
 */

import { request } from '../index'

// 主业务类型
const business = () =>{
	return request({
		url: "business/index",
	})
}

// 获取主业务机构
const institution = id =>{
	return request({
		url: "business/" + id + "/institution",
	})
}

// 获取机构表单数据
const institutionType = id => {
	return request({
		url: "business/institution/" + id + "/type",
	})
}

// 搜索办理业务用户
const availableUser = (type, value) => {
	if(type === 'mobile'){
		return request({
			url	: "user/relations/child_by_mobile",
			data: {
				mobile: value
			}
		})
	}
	if(type === 'name'){
		return request({
			url	: "user/relations/child_by_name",
			data: {
				name: value
			}
		})
	}
}

// 提交用户办理信息
const submitStore = data => {
	return request({
		url		: "business/store",
		method	: "POST",
		data
	})
}

export {
	business,
	institution,
	institutionType,
	availableUser,
	submitStore
}
