import request from '@/utils/request'

/**
 * 会员绑定房产
 */
export function bindBuild(params : Record<string, any>) {
	return request.post(`xypm/member/build_bind`, params, {showSuccessMessage: true})
}

/**
 * 户主添加成员
 */
export function buildAddResident(params : Record<string, any>) {
	return request.post(`xypm/member/build_resident`, params, {showSuccessMessage: true,showErrorMessage:true})
}

/**
 * 会员房产列表
 */
export function getBuildList(params : Record<string, any>) {
	return request.get(`xypm/member/build`, params)
}

/**
 * 会员房产列表（全部）
 */
export function getBuildAll(params : Record<string, any>) {
	return request.get(`xypm/member/build_all`, params)
}

/**
 * 会员房产成员列表
 */
export function getBuildResidentList(params : Record<string, any>) {
	return request.get(`xypm/member/build_resident`, params)
}

/**
 * 会员设置默认房产
 */
export function setDefaultBuild(id: number) {
    return request.put(`xypm/member/build_default/${id}`,{showSuccessMessage: true});
}

/**
 * 会员解绑房产
 */
export function unBindBuild(id: number) {
    return request.delete(`xypm/member/build_unbind/${id}`,{showSuccessMessage: true});
}

/**
 * 户主删除成员
 */
export function delResident(id: number) {
    return request.delete(`xypm/member/build_resident/${id}`,{showSuccessMessage: true});
}

/**
 * 会员房产详情
 */
export function getBuildInfo(id:number) {
	return request.get(`xypm/member/build/${id}`)
}


/**
 * 缴费中心数据
 */
export function getBillCenterData(params : Record<string, any>) {
	return request.get(`xypm/member/bill_center`, params)
}

/**
 * 缴费订单初始数据
 */
export function getBillOrderInitData(params : Record<string, any>) {
	return request.get(`xypm/member/bill/order_init`, params)
}

/**
 * 创建缴费订单
 */
export function createBillOrder(params : Record<string, any>) {
    return request.post('xypm/member/bill/order_create', params, {showErrorMessage: true})
}

/**
 * 获取缴费订单状态列表
 */
export function getBillOrderStatus() {
    return request.get(`xypm/member/bill/order_status`)
}

/**
 * 获取缴费订单列表
 */
export function getBillOrder(params: Record<string, any>) {
    return request.get(`xypm/member/bill/order`, params)
}

/**
 * 获取缴费订单详情
 */
export function getBillOrderDetail(order_id: number) {
    return request.get(`xypm/member/bill/order/${order_id}`)
}

/**
 * 关闭缴费订单
 */
export function billOrderClose(order_id: number) {
    return request.put(`xypm/member/bill/order_close/${order_id}`)
}