import http from '@/http/http.js'
const request = http.request

/**
 * 获取挂账人分页
 * @returns
 */
export function getCreditBuyerPage(data, urlType = 'order') {
	return request({
		url: `${urlType}/admin/order/credit/buyer/page`,
		method: "GET",
		data: {
			...data
		}
	})
}

/**
 * 获取挂账人详情
 * @returns
 */
export function getCreditBuyerDetail(id, urlType = 'order') {
	return request({
		url: `${urlType}/admin/order/credit/buyer/${id}`,
		method: "GET",
	})
}

/**
 * 添加挂账人
 * @returns
 */
export function addCreditBuyer(data, urlType = 'order') {
	return request({
		url: `${urlType}/admin/order/credit/buyer`,
		method: "POST",
		data: {
			...data
		}
	})
}

/**
 * 编辑挂账人
 * @returns
 */
export function editCreditBuyer(data, urlType = 'order') {
	return request({
		url: `${urlType}/admin/order/credit/buyer`,
		method: "PUT",
		data: {
			...data
		}
	})
}

/**
 * 删除挂账人
 * @returns
 */
export function delCreditBuyer(id, urlType = 'order') {
	return request({
		url: `${urlType}/admin/order/credit/buyer/${id}`,
		method: "DELETE",
	})
}

/**
 * 还款
 * @returns
 */
export function creditBuyerRepayment(data, urlType = 'order') {
	return request({
		url: `${urlType}/admin/order/credit/buyer/repayment`,
		method: "POST",
		data: {
			...data
		}
	})
}

/**
 * 付款
 * @returns
 */
export function creditBuyerOrderPay(data, urlType = 'order') {
	return request({
		url: `${urlType}/admin/order/credit/buyerOrder/pay`,
		method: "POST",
		data: {
			...data
		}
	})
}

/**
 * 还款记录
 * @returns
 */
export function creditRePaymentRecord(data, urlType = 'order') {
	return request({
		url: `${urlType}/admin/order/credit/paymentRecord/page`,
		method: "GET",
		data: {
			...data
		}
	})
}

/**
 * 明细分页
 * @returns
 */
export function creditBuyerOrderList(data, urlType = 'order') {
	return request({
		url: `${urlType}/admin/order/credit/buyerOrder/page`,
		method: "GET",
		data: {
			...data
		}
	})
}

/**
 * 明细统计
 * @returns
 */
export function creditBuyerOrderSummary(data, urlType = 'order') {
	return request({
		url: `${urlType}/admin/order/credit/buyerOrder/summary`,
		method: "GET",
		data: {
			...data
		}
	})
}