import { fetch } from '@/utils/request'
import {
  API_HOUSE_LIST,
  API_PRESELECTION_RECORD,
  API_SALESBATCH_LIST,
  API_RATSE_RECORD,
  API_HOUSE_DETAIL,
  API_ADD_PRESELECTION,
  API_CANCEL_PRESELECTION,
  API_APARTMENT_TYPE,
  API_NOTICE_INFO,
  API_SALES_BATCH,
  API_RATSE_DETAIL,
  API_RATSE_ORDER,
  API_CANCEL_ORDER

} from '@/constants/api'


/**
 * 获取房源列表
 * @param {*} payload
 */
export const queryHouseList = payload => fetch({ url: API_HOUSE_LIST, payload })

/**
 * 获取房源分享信息
 * @param {*} id
 */
export const querySalesInfo = id => fetch({ url: `${API_SALES_BATCH}/${id}` })
/**
 * 获取认筹单详情
 * @param {*} id
 */
export const queryRaiseDetail = id => fetch({ url: `${API_RATSE_DETAIL}/${id}` })
/**
 * 获取房源列表滚动提示
 * @param {*} id
 */
export const queryNoticeInfo = id => fetch({ url: `${API_NOTICE_INFO}/${id}` })

/**
 * 预选房源
 * @param {*} payload
 */
export const addPreselection = payload => fetch({ url: API_ADD_PRESELECTION, payload, method: 'POST' })
/**
 * 取消预选房源
 * @param {*} payload
 */
export const cancelPreselection = payload => fetch({ url: `${API_CANCEL_PRESELECTION}?${'houseId=' + payload.houseId}&${'personId=' + payload.personId}`, method: 'DELETE' })
/**
 * 获取房源详情
 * @param {*} payload
 */
export const queryHouseDetail = payload => fetch({ url: API_HOUSE_DETAIL, payload })

/**
 * 获取选房记录
 * @param {*} payload
 */
export const queryPreselectionRecord = payload => fetch({ url: API_PRESELECTION_RECORD, payload })
/**
 * 获取认筹记录
 * @param {*} payload
 */
export const queryRaiseRecord = payload => fetch({ url: API_RATSE_RECORD, payload })
/**
 * 获取销售批次列表
 * @param {*} payload
 */
export const querySalesList = payload => fetch({ url: API_SALESBATCH_LIST, payload })
/**
 * 获取某销售批次下所有房源户型
 * @param {*} payload
 */
export const queryApartmentType = payload => fetch({ url: API_APARTMENT_TYPE, payload })
/**
 *认筹下单接口
 * @param {*} payload
 */
export const raiseOrder = payload => fetch({ url: API_RATSE_ORDER, payload, method: 'POST' })
/**
 *认筹单取消支付接口
 * @param {*} payload
 */
export const cancelOrder = payload => fetch({ url: API_CANCEL_ORDER, payload, method: 'POST' })



