import request from '@/utils/request'
import Cookies from "js-cookie";


// 查询部门下拉树结构
export function treeselect() {
  return request({
    url: '/open/depositm/dept/treeselect',
    method: 'get'
  })
}

// 保险公司登录
export function serviceLogin(data) {
  return request({
    url: '/open/depositm/financialService/login',
    method: 'post',
    data: data
  })
}

// 保险公司注册
export function serviceRegister(data) {
  return request({
    url: '/open/depositm/financialService/register',
    method: 'post',
    data: data
  })
}

// 服务组织登录
export function entityLogin(data) {
  return request({
    url: '/open/depositm/entity/login',
    method: 'post',
    data: data
  })
}

//保险公司列表
export function serviceList(query) {
  return request({
    url: '/open/depositm/financialService/list',
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'get',
    params: query
  })
}

//保险公司详情
export function serviceGet(id) {
  return request({
    url: '/open/depositm/financialService/get/'+id,
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'get',
  })
}

//保险公司修改
export function serviceEdit(data) {
  return request({
    url: '/open/depositm/financialService/edit',
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'post',
    data:data
  })
}

//保险产品列表
export function productList(query) {
  return request({
    url: '/open/depositm/financialProduct/list',
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'get',
    params: query
  })
}

//保险产品详情
export function productGet(id) {
  return request({
    url: '/open/depositm/financialProduct/get/'+id,
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'get',
  })
}

//上传全局方法附件
export function commonUpload(data) {
  return request({
    url: '/open/depositm/common/upload',
    method: 'post',
    headers: {
      "Content-Type": 'application/x-www-form-urlencoded',
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    data: data
  })
}

// 修改保险产品
export function financialProductEdit(data) {
  return request({
    url: '/open/depositm/financialProduct/edit',
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'post',
    data: data
  })
}

// 新增保险产品
export function financialProductAdd(data) {
  return request({
    url: '/open/depositm/financialProduct/add',
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'post',
    data: data
  })
}

// 保险产品上架
export function productIn(id) {
  return request({
    url: '/open/depositm/financialProduct/productIn/'+id,
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'post',
  })
}

// 保险产品下架
export function productOut(id) {
  return request({
    url: '/open/depositm/financialProduct/productOut/'+id,
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'post',
  })
}

//服务组织列表
export function detailList(query) {
  return request({
    url: '/open/depositm/entity/list',
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'get',
    params: query
  })
}

//服务组织注册
export function entityRegister(data) {
  return request({
    url: '/open/depositm/entity/register',
    method: 'post',
    data: data
  })
}

//服务项目列表
export function supplyDemandList(query) {
  return request({
    url: '/open/depositm/supplyDemand/list',
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'get',
    params: query
  })
}

//服务项目列表
export function productTypes(query) {
  return request({
    url: '/open/depositm/supplyDemand/productTypes',
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'get',
    params: query
  })
}

//服务项目详情
export function supplyDemandGet(id) {
  return request({
    url: '/open/depositm/supplyDemand/get/'+id,
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'get',
  })
}

// 编辑服务项目
export function supplyDemandEdit(data) {
  return request({
    url: '/open/depositm/supplyDemand/edit',
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'post',
    data: data
  })
}

// 评价
export function supplyComment(data) {
  return request({
    url: '/entity/supplyorder/comment',
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'post',
    data: data
  })
}

// 服务项目下架
export function supplyDemandProductOut(id) {
  return request({
    url: '/open/depositm/supplyDemand/productOut/'+id,
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'post',
  })
}

// 服务项目上架
export function supplyDemandProductIn(id) {
  return request({
    url: '/open/depositm/supplyDemand/productIn/'+id,
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'post',
  })
}

// 服务项目新增
export function supplyDemandAdd(data) {
  return request({
    url: '/open/depositm/supplyDemand/add',
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'post',
    data:data
  })
}


// 拒单
export function supplyorderReject(id) {
  return request({
    url: '/open/depositm/supplyorder/reject/'+id,
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'post',
  })
}

// 接单
export function supplyorderFinish(id) {
  return request({
    url: '/open/depositm/supplyorder/finish/'+id,
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'post',
  })
}

//订单列表
export function supplyorderList(query) {
  return request({
    url: '/open/depositm/supplyorder/list',
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'get',
    params: query
  })
}

//服务组织订单统计
export function orderStatistics(query) {
  return request({
    url: '/open/depositm/supplyorder/orderStatistics',
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'get',
    params: query
  })
}

//订单详情
export function supplyorderGet(id) {
  return request({
    url: '/open/depositm/supplyorder/get/'+id,
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'get',
  })
}

//服务组织详情
export function entityGet(id) {
  return request({
    url: '/open/depositm/entity/get/'+id,
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'get',
  })
}

//服务合同
export function fwhtList(query) {
  return request({
    url: '/geo/fwht/list',
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'get',
    params: query
  })
}

//下单
export function placeOrder(data) {
  return request({
    url: '/entity/supplyorder/placeOrder',
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'post',
    data: data
  })
}

//下单
export function entityEdit(data) {
  return request({
    url: '/open/depositm/entity/edit',
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'post',
    data: data
  })
}

//贷款需求列表
export function loanDemandList(query) {
  return request({
    url: '/open/depositm/financialService/loanDemandList',
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'get',
    params: query
  })
}

//贷款需求列表
export function thirdDetail(id,query) {
  return request({
    url: '/open/depositm/financialService/thirdDetail/'+id,
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'get',
    params: query
  })
}

//贷款需求列表
export function subjectDetail(id,query) {
  return request({
    url: '/open/depositm/financialService/subjectDetail/'+id,
    headers: {
      "ACCESS-SESSION-ID": Cookies.get('ACCESS-SESSION-ID')
    },
    method: 'get',
    params: query
  })
}
