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

import { request } from '../index'

// 获取用户信息
const userIndex = () =>{
	return request({
		url: "user"
	})
}

// 实名认证
const realName = (data) =>{
	return request({
		url: "user/certification",
		method: 'POST',
		data: data
	})
}

// 是否实名认证
const judgeReal = () =>{
	return request({
		url: "user/certified"
	})
}

// 人脸识别
const faceUrl = () =>{
	return request({
		url: "e-signs/authorize/psn"
		
	})
}

// 获取签约地址
const contractGo = (business_order_id, data) =>{
	return request({
		url: "business/" + business_order_id + '/sign_url',
		data: data
	})
}

// 修改用户资料
const setting = (key, data) =>{
	return request({
		url: "user/setting/" + key,
		method: 'PUT',
		data: data
		
	})
}

// 我的伙伴
const Relations = (data) =>{
	return request({
		url: "user/relations",
		data: data
		
	})
}

// 我的推荐
const Parent = () =>{
	return request({
		url: "user/parent"
		
	})
}

// 邀请码
const inviteCode = () =>{
	return request({
		url: "user/invite"
		
	})
}

// 我的咨询单基础信息
const userBase = (business_order_id) =>{
	return request({
		url: "business/" + business_order_id + "/user/base"
	})
}

// 我的咨询单详细信息-银行
const userBank = (business_order_item_id) =>{
	return request({
		url: "business/" + business_order_item_id + "/user/bank"
	})
}

// 修改基础信息-提交
const basePut = (business_order_user_id, data) =>{
	return request({
		url: "business/" + business_order_user_id + "/user/base",
		method: 'POST',
		data: data
	})
}

// 修改银行和其他信息-提交
const bankPut = (business_order_user_bank_id, data) =>{
	return request({
		url: "business/" + business_order_user_bank_id + "/user/bank",
		method: 'POST',
		data: data
	})
}

// 我的咨询单基础信息 - 首次提交
const BaseFirst = (business_order_user_id, user_base_id) =>{
	return request({
		url: "business/" + business_order_user_id + "/user/base/" + user_base_id,
		method: 'POST'
	})
}

// 修改银行和其他信息--通过之前数据
const BankFirst = (business_order_user_bank_id, user_bank_id) =>{
	return request({
		url: "business/" + business_order_user_bank_id + "/user/bank/" + user_bank_id,
		method: 'POST'
	})
}

// 省市区选择
const create = (data) =>{
	return request({
		url: "region",
		data: data
	})
}

// 获取所有省市区数据
const createAll = (data) =>{
	return request({
		url: "region/all",
		data: data
	})
}

// 获取所有省市数据
const createCity = (data) =>{
	return request({
		url: "region/pro_city",
		data: data
	})
}

// 机构列表
const bankIns = (business_order_id) =>{
	return request({
		url: "business/" + business_order_id + "/ins"
	})
}

// 基本信息查看-个人中心
const BaseSee = () =>{
	return request({
		url: "user/base"
	})
}

// 机构详情查看-个人中心
const BankSee = (user_bank_id) =>{
	return request({
		url: "user/base/" + user_bank_id + "/bank"
	})
}

// 机构详情查看-个人中心
const BankIns = (business_institution_id) =>{
	return request({
		url: "user/base/" + business_institution_id + "/bank_by_ins"
	})
}

// 机构列表查看-个人中心
const BankList = () =>{
	return request({
		url: "user/base/banks"
	})
}

// 我的咨询单
const myOrders = (data) =>{
	return request({
		url: "business/orders",
		data: data
	})
}

// 进度
const StepsUrl = (business_order_id) =>{
	return request({
		url: "business/" + business_order_id + "/steps"
	})
}

// 服务包查看
const baleSee = (business_order_id) =>{
	return request({
		url: "business/" + business_order_id + "/order_services"
	})
}

// 获取物流公司
const getExpress = () =>{
	return request({
		url: "express"
	})
}

// 发件
const Send = (business_order_id, data) =>{
	return request({
		url: "business/" + business_order_id + "/expresses",
		method: 'POST',
		data: data
	})
}

// 优惠券
const coupons = (data) =>{
	return request({
		url: "coupons/user/coupons",
		data: data
	})
}

// 需要修改的订单资料
const myAffirm = (data) =>{
	return request({
		url: "business/modify/data",
		data: data
	})
}

// 需要补差价
const myDiff = (data) =>{
	return request({
		url: "business/diff_prices",
		data: data
	})
}

// 需要确认方案数
const myModify = (data) =>{
	return request({
		url: "business/close_schemes",
		data: data
	})
}

// 确认方案详情
const myModifyInfo = (business_order_scheme_id) =>{
	return request({
		url: "business/close_schemes/" + business_order_scheme_id
	})
}

// 确认方案详情 - 同意方案
const modifyYes = (business_order_close_scheme_id, data) =>{
	return request({
		url: "business/close_schemes/" + business_order_close_scheme_id + "/agree",
		method: 'POST',
		data: data
	})
}

// 确认方案详情 - 不同意方案
const modifyNo = (business_order_close_scheme_id, data) =>{
	return request({
		url: "business/close_schemes/" + business_order_close_scheme_id + "/refuse",
		method: 'POST',
		data: data
	})
}

// 获取用户姓名手机号性别
const userBasic = () =>{
	return request({
		url: "user/basic"
	})
}

// 获取邮寄列表
const expressList = (business_order_id) =>{
	return request({
		url: "business/" + business_order_id + "/expresses"
	})
}

// 查看物流
const logistic = (business_order_express_id) =>{
	return request({
		url: "business/" + business_order_express_id + "/logistic"
	})
}


// 退款完成
const myRefund = (data) =>{
	return request({
		url: "business/refunds",
		data: data
	})
}

// 展示法务老师操作记录
const doLogs = (order_id, data) =>{
	return request({
		url: "business/" + order_id + "/do_logs",
		data: data
	})
}

// 缓存信息-信用卡展示
const cacheBank = (business_order_user_bank_id) =>{
	return request({
		url: "business/" + business_order_user_bank_id + "/cache/bank"
	})
}


// 缓存信息-信用卡
const cacheBankPut = (business_order_user_bank_id, data) =>{
	return request({
		url: "business/" + business_order_user_bank_id + "/cache/bank",
		method: 'POST',
		data: data
	})
}

// 签约记录
const getSignLogs = data => {
	return request({
		url: 'business/flows',
		data
	})
}

// 获取签约合同
const getFlows = id => {
	return request({
		url: 'e-signs/flows/' + id
	})
}

// 删除用户微信数据和关注
const userSubscribe = () => {
	return request({
		url: 'user/auth/wechat/subscribe',
		method: 'DELETE'
	})
}

// 会员信息
const identity = () => {
	return request({
		url: 'identity'
	})
}

// 开通会员
const vip = data => {
	return request({
		url: 'identity/open',
		method: 'POST',
		data
	})
}

// 团队列表
const team = data => {
	return request({
		url: 'user/relations/wechat',
		data
	})
}

export {
	userIndex,
	realName,
	judgeReal,
	faceUrl,
	contractGo,
	setting,
	Relations,
	Parent,
	inviteCode,
	userBase,
	userBank,
	basePut,
	bankPut,
	BaseFirst,
	BankFirst,
	create,
	createAll,
	createCity,
	bankIns,
	BaseSee,
	BankSee,
	BankIns,
	BankList,
	myOrders,
	StepsUrl,
	baleSee,
	getExpress,
	Send,
	coupons,
	myAffirm,
	myDiff,
	myModify,
	myModifyInfo,
	modifyYes,
	modifyNo,
	userBasic,
	expressList,
	logistic,
	myRefund,
	doLogs,
	cacheBank,
	cacheBankPut,
	getSignLogs,
	getFlows,
	userSubscribe,
	identity,
	vip,
	team
}