/*
 * vip相关
 */
import {
  req
} from "../request"


//项目筹集分类
const crowdfundcategory = id => req({
  url: "ajax/crowdfundcategory",
  data: {
    company_id: id
  }
})
//项目分类下列表
const crowdfunds = (company_id, category_id, page) => req({
  url: "crowdfunds",
  data: {
    company_id: company_id,
    category_id: category_id,
    page: page
  }
})
//项目详情
const crowdfundsDetail = crowdfund_id => req({
  url: "crowdfunds/" + crowdfund_id
})
// 获取关注列表
const getCrowdfundsLike = page => req({
  url: "user/crowdfunds",
  method: "get",
  data: {
    page: page
  }
})
//项目关注
const crowdfundsLike = crowdfund_id => req({
  url: "crowdfunds/like",
  method: "POST",
  data: {
    crowdfund_id: crowdfund_id
  }
})
//项目取消关注
const crowdfundsUnLike = crowdfund_id => req({
  url: "crowdfunds/unlike",
  method: "POST",
  data: {
    crowdfund_id: crowdfund_id
  }
})
//获取确认订单信息
const crowdfundsCreat = crowdfund_item_id => req({
  url: "crowdfunds/create",
  data: {
    crowdfund_item_id: crowdfund_item_id
  }
})
//创建订单
const crowdfundsCreatOrder = (crowdfund_item_id, address_id, remark) => req({
  url: "crowdfunds",
  method: "POST",
  data: {
    crowdfund_item_id: crowdfund_item_id,
    address_id: address_id,
    remark: remark
  }
})
//调用微信支付
const wechat = data => req({
  url: "payments/wechat",
  method: "POST",
  data: data
})

// 企业信息
const company = (company_id) => req({
  url: "company/" + company_id
})
// 企业活动列表
const actives = (model, model_id, page) => req({
  url: "actives",
  data: {
    model: model,
    model_id: model_id,
    page: page
  }
})

// 企业活动详情
const activesDetail = (active_id) => req({
  url: "actives/" + active_id,
})

// 企业活动报名
const activesEnroll = (code, active_id) => req({
  url: "actives/" + active_id + '/enroll',
  method: "POST",
  data: {
    code: code
  }
})

// 企业动态列表
const dynamics = (company_id, page) => req({
  url: "company/" + company_id + "/dynamics",
  data: {
    page: page
  }
})

// 企业动态列表
const dynamicsDetail = (company_id, dynamic_id) => req({
  url: "company/" + company_id + "/dynamics/" + dynamic_id,
})

// 企业风采更多列表
const graces = (company_id, page) => req({
  url: "company/" + company_id + "/graces",
  data: {
    page: page
  }
})


// 企业风采更多列表
const videos = (company_id, page) => req({
  url: "videos/" + company_id + "/advert",
  data: {
    page: page
  }
})

// 更多员工列表
const users = (company_id, page) => req({
  url: "company/" + company_id + "/users",
  data: {
    page: page
  }
})
// 我的活动列表啥
const userActives = (state, page) => req({
  url: "user/actives",
  data: {
    state: state,
    page: page
  }
})
//活动签到
const signed = (active_id) => req({
  url: "actives/" + active_id + "/signed",
  method: "POST"
})

// 获取项目订单
const orderList = (url, page) => req({
  url: url,
  data: {
    page: page
  }
})

//订单-详情
const getOrderInfo = (orderId) => req({
  url: "crowdorders/" + orderId
})


// 退款售后详情
const getRefundInfo = (refundId) => req({
  url: "refunds/" + refundId
})

// 退款进度查询
const getRefundLogsInfo = (refundId) => req({
  url: "refunds/" + refundId + '/logs'
})


export default ({
  crowdfundcategory, //项目筹集分类
  crowdfunds, //根据项目筹集获取列表
  crowdfundsDetail, //项目详情
  getCrowdfundsLike, //获取已关注列表
  crowdfundsLike, //关注项目
  crowdfundsUnLike, //取消关注项目
  crowdfundsCreat, //获取确认订单信息
  crowdfundsCreatOrder, //创建订单
  wechat, //微信支付
  company, //企业基本信息
  actives, //企业活动列表
  activesDetail, //企业活动详情
  activesEnroll, //企业报名
  dynamics, //企业动态
  dynamicsDetail, //企业动态详情
  graces, //企业风采更多
  videos, //企业宣传更多
  users, // 更多员工列表
  userActives, //活动列表
  signed, //活动签到
  orderList, //获取项目订单
  getOrderInfo, //根id 获取订单详情
  getRefundInfo, //根id 获取退款详情
  getRefundLogsInfo,//退款进度查询
})