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

/**
 * 获取订单可用积分及抵扣金额（支付页面使用）
 * @returns
 */
export function calcUsablePoints(data, urlType = 'account') {
	return request({
		url: `${urlType}/admin/points/memberPoints/calcUsablePoints`,
		method: "GET",
		data: {
			...data
		}
	})
}

/**
 * 根据积分计算可抵扣金额
 * @returns
 */
export function calcDeductionAmount(data, urlType = 'account') {
	return request({
		url: `${urlType}/admin/points/memberPoints/calcDeductionAmount`,
		method: "GET",
		data: {
			...data
		}
	})
}

/**
 * 支付完成扣减积分
 * @returns
 */
export function payedDeductPoints(data, urlType = 'account') {
	return request({
		url: `${urlType}/admin/points/memberPoints/payedDeductPoints`,
		method: "POST",
		data: {
			...data
		}
	})
}


/**
 * 消费赠送积分
 * @returns
 */
export function consumeAwardPoints(data, urlType = 'account') {
	return request({
		url: `${urlType}/admin/points/memberPoints/consumeAwardPoints`,
		method: "POST",
		data: {
			...data
		}
	})
}
