
/**
 * 手太欠
 * 愿这世界都如故事里一样 美好而动人~
 */

import { request } from '../index'

// 首页数据
const home = () =>{
	return request({
		url: "business/home"
	})
}


// 文章分类
const articleSort = () =>{
	return request({
		url: "cms/categories"
	})
}

// 文章列表
const articleList = (data) =>{
	return request({
		url: "cms/articles",
		data: data
	})
}

// 文章详情
const articleBrief = (article_id) =>{
	return request({
		url: "cms/articles/" + article_id
	})
}

// 文章收藏
const collect = (article_id) =>{
	return request({
		url: "cms/articles/favorite/" + article_id
	})
}

// 我的文章收藏
const myCollect = (data) =>{
	return request({
		url: "user/favorites",
		data: data
	})
}

// 精选律师列表
const lawyers = (data) =>{
	return request({
		url: "lawyers",
		data: data
	})
}

// 精选律师详情
const lawyersdet = (lawyer_id) =>{
	return request({
		url: "lawyers/" + lawyer_id
	})
}

//律师业务
const lawyersBusiness = () =>{
	return request({
		url: "lawyers/businesses"
	})
}


//律师业务详情
const businessDet = (lawyer_business_id) =>{
	return request({
		url: "lawyers/businesses/" + lawyer_business_id
	})
}

//律师订单金额
const lawyerOrder = (lawyer_id) =>{
	return request({
		url: "lawyers/" + lawyer_id + "/order"
		
	})
}

//律师业务-创建订单
const businessOrder = (lawyer_business_id) =>{
	return request({
		url: "lawyers/businesses/" + lawyer_business_id + "/order"
		
	})
}

// 获取主业务
const workIndex = () =>{
	return request({
		url: "business/index"
	})
}

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

// 获取二级业务类型
const workLevel = (business_id) =>{
	return request({
		url: "business/institution/" + business_id + "/type"
	})
}

// 提交基础信息
const workStore = (data) =>{
	return request({
		url: "business/store",
		method: 'POST',
		data: data
	})
}

// 9.9预约
const Apply = (business_order_id) =>{
	return request({
		url: "business/apply/" + business_order_id + "/info"
	})
}

// 9.9预约--微信支付
const Wechat = (apply_order_no, data) =>{
	return request({
		url: "pay/apply/" + apply_order_no + "/wechat",
		data: data
	})
}

// 咨询服务费--微信支付
const applyPay = (business_order_id, data) =>{
	return request({
		url: "pay/order/" + business_order_id + "/wechat",
		data: data
	})
}

// 补差价--微信支付
const diffPay = (business_order_diff_price_id, data) =>{
	return request({
		url: "pay/diff/" + business_order_diff_price_id + "/wechat",
		data: data
	})
}


// 获取公众号openid
const Openid = (data) =>{
	return request({
		url: "user/auth/official/openid",
		data: data
	})
}

// 获取授权页面
const authFollow = (data) => {
    return request({
        url : 'user/auth/official/url',
		data: data
    })
}

// 获取方案
const Schemes = (business_order_id) =>{
	return request({
		url: "business/" + business_order_id + "/schemes"
	})
}

// h5入库用户数据
const wechatCode = (data) => {
    return request({
        url : 'user/auth/login/wechat/add',
        method: 'POST',
        data: data
    })
}

// 校验分享用户
const Verify = (data) => {
    return request({
        url : 'user/relations/verify',
        data: data
    })
}

// 绑定分享用户
const Bind = (data) => {
    return request({
        url : 'user/relations/bind',
		method: 'POST',
        data: data
    })
}

// 账户管理类
const accountManagement = () => {
	return request({
		url: "account_management/index"
	})
}

// 账户管理类 - 办理
const accountFrom = (data, id) => {
	return request({
		url		: "account_management/" + id + "/store",
		method	: "POST",
		data
	})
}

// 账户管理类 - 订单
const accountOrder = data => {
	return request({
		url		: "account_management/order/lists",
		data
	})
}

// 账户管理类 - 取消订单
const accountCancel = id => {
	return request({
		url		: "account_management/order/" + id + "/cancel",
		method	: "DELETE"
	})
}

// 委托管理类
const delegation = () => {
	return request({
		url: "delegation/index"
	})
}

// 委托管理类 - 办理
const delegationFrom = (data, id) => {
	return request({
		url		: "delegation/" + id + "/store",
		method	: "POST",
		data
	})
}

// 委托管理类 - 订单
const delegationOrder = data => {
	return request({
		url		: "delegation/order/lists",
		method	: "POST",
		data
	})
}

// 委托管理类 - 取消订单
const delegationCancel = id => {
	return request({
		url		: "delegation/order/" + id + "/cancel",
		method	: "DELETE" 
	})
}


export {
	home,
	articleSort,
	articleList,
	articleBrief,
	collect,
	myCollect,
	lawyers,
	lawyersdet,
	lawyersBusiness,
	businessDet,
	lawyerOrder,
	businessOrder,
	workIndex,
	workOne,
	workLevel,
	workStore,
	Apply,
	Wechat,
	applyPay,
	diffPay,
	Openid,
	authFollow,
	Schemes,
	wechatCode,
	Verify,
	Bind,
	accountManagement,
	accountFrom,
	accountOrder,
	accountCancel,
	delegation,
	delegationFrom,
	delegationOrder,
	delegationCancel
}
