import http from '@/utils/request'

/** 添加银行卡 */
export const addUserAddress = data => {
  return http({
    url: '/api/service/userCard',
    method: 'post',
    data
  })
}

/** 修改银行卡 */
export const updateUserAddress = data => {
  return http({
    url: '/api/service/userCard',
    method: 'put',
    data
  })
}

/** 获取用户银行卡列表 */
export const getUserAddress = data => {
  return http({
    url: '/api/service/userCard/list',
    method: 'get',
    data
  })
}

/** 删除银行卡 */
export const deleteUserAddress = id => {
  return http({
    url: `/api/service/userCard/${id}`,
    method: 'delete'
  })
}

/** 获取用户银行卡详情 */
export const getUserAddressDetail = id => {
  return http({
    url: `/api/service/userCard/details/${id}`,
    method: 'get'
  })
}

/** 获取用户支付密码详细信息 */
export const getUserPayPwd = () => {
  return http({
    url: '/api/service/userPassword/details',
    method: 'get'
  })
}

/**
 * 添加/修改支付密码
 * @param {*} data
 * @param {*} method post 添加 put 修改
 * @returns
 */
export const updateUserPayPwd = (data, method = 'post') => {
  return http({
    url: '/api/service/userPassword',
    method,
    data
  })
}

/**
 * 添加/修改银行卡
 * @param {*} data
 * @param {*} method post 添加 put 修改
 * @returns
 */
export const addUserPayPwd = (data, method = 'post') => {
  return http({
    url: '/api/service/userCard',
    method,
    data
  })
}

/** 删除银行卡 */
export const deleteUserPayPwd = id => {
  return http({
    url: `/api/service/userCard/${id}`,
    method: 'delete'
  })
}

/** 获取银行卡列表 */
export const getUserBankList = () => {
  return http({
    url: '/api/service/userCard/list',
    method: 'get'
  })
}

/** 获取银行卡详情 */
export const getUserBankDetail = id => {
  return http({
    url: `/api/service/userCard/details/${id}`,
    method: 'get'
  })
}

/**
 * 添加/修改用户第三方支付账户
 * @param {*} data 提交数据
 * @param {*} method post 添加 put 修改
 * @returns
 */
export const addUserThirdPay = (data, method = 'post') => {
  return http({
    url: '/api/service/userPayment',
    method,
    data
  })
}

/** 获取用户第三方支付详情 */
export const getUserThirdPay = id => {
  return http({
    url: `/api/service/userPayment/${id}`,
    method: 'get'
  })
}

/** 获取第三方支付列表 */
export const getUserThirdPayList = () => {
  return http({
    url: '/api/service/userPayment/list',
    method: 'get'
  })
}

/** 获取身份证信息 */
export const getUserIdCard = () => {
  return http({
    url: '/api/service/userVerification/details',
    method: 'get'
  })
}

/**
 * 添加/修改身份证
 * @param {*} data
 * @param {*} method post 添加 put 修改
 * @returns
 */
export const addUserIdCard = (data, method = 'post') => {
  return http({
    url: '/api/service/userVerification',
    method,
    data
  })
}

/** 获取提现配置详细信息 */
export const getUserWithdrawConfig = id => {
  return http({
    url: `/api/service/appWithdrawalConfig/${id}`,
    method: 'get'
  })
}

/** 获取用户积分详细信息 */
export const getUserIntegral = () => {
  return http({
    url: `/api/system/userPoints/details`,
    method: 'get'
  })
}

/** 添加提现 */
export const addUserWithdraw = data => {
  return http({
    url: '/api/service/SerAppUserWithdrawal',
    method: 'post',
    data
  })
}

/** 获取提现列表 */
export const getUserWithdrawList = data => {
  return http({
    url: '/api/service/SerAppUserWithdrawal/list',
    method: 'get',
    data
  })
}

/** 交易记录列表 */
export const getUserTradeRecordList = data => {
  return http({
    url: '/api/system/logPoints/list',
    method: 'get',
    data
  })
}

/** 发布朋友圈 */
export const addUserMoments = data => {
  return http({
    url: '/api/service/userMoments',
    method: 'post',
    data
  })
}

/** 获取朋友圈列表 */
export const getUserMomentsList = data => {
  return http({
    url: '/api/service/userMoments/list',
    method: 'get',
    loading: false,
    data
  })
}

/** 点赞 */
export const likeUserMoments = id => {
  return http({
    url: `/api/service/userMoments/like/${id}`,
    method: 'put'
  })
}

/** 发布评论 */
export const addUserMomentsComment = data => {
  return http({
    url: '/api/service/userMoments/comment',
    method: 'post',
    data
  })
}

/** 删除 */
export const deleteUserMoments = id => {
  return http({
    url: `/api/service/userMoments/${id}`,
    method: 'delete'
  })
}

/** 添加意见反馈 */
export const addUserFeedback = data => {
  return http({
    url: '/api/service/feedback',
    method: 'post',
    data
  })
}

/** 获取消息通知列表 */
export const getUserNoticeList = data => {
  return http({
    url: '/api/service/serNotification/list',
    method: 'get',
    data
  })
}

/** 获取消息通知详情 */
export const getUserNoticeDetail = id => {
  return http({
    url: `/api/service/serNotification/${id}`,
    method: 'get'
  })
}

/** 客服列表 */
export const getUserServiceList = () => {
  return http({
    url: '/api/service/customerStaff/list',
    method: 'get'
  })
}

/** 查询空闲客服 */
export const getUserServiceFree = () => {
  return http({
    url: '/api/service/customerStaff/listFree',
    method: 'get'
  })
}

/** 结束客服对话 */
export const endUserService = id => {
  return http({
    url: `/api/service/customerStaff/end/${id}`,
    method: 'get'
  })
}
