import request from '@/utils/request'

// 获取表格分页数据
export function getTableData(forData) {
	let data = ''
	data += '?page=' + forData.page + '&rows=' + forData.rows

	if (typeof forData.status !== 'undefined') {
		data += '&status=' + forData.status
	}
	if (forData.search_datatime !== undefined && forData.search_datatime !== null) {
		data += '&complainStartTime=' + forData.search_datatime[0]
		data += '&complainEndTime=' + forData.search_datatime[1]
	}
	if (typeof forData.keyword !== 'undefined') {
		data += '&keywords=' + forData.keyword
	}

	return request({
		url: '/mhotel/ComplainqueryPage.action' + data,
		method: 'get',
		data
	})
}

// 获取投诉详情
export function getXiang(row) {
	let query = '?id=' + row.id

	return request({
		url: '/mhotel/ComplaingetById.action' + query,
		method: 'get'
	});
};

// 确认受理
export function Complainacceptance(row) {
	let query = '?id=' + row.id + '&remark=' + row.remark
	
	return request({
		url: '/mhotel/Complainacceptance.action' + query,
		method: 'get'
	});
};

// 更新备注
export function ComplainupdateRemarkById(row) {
	let query = '?id=' + row.id + '&remark=' + row.remark
	
	return request({
		url: '/mhotel/ComplainupdateRemarkById.action' + query,
		method: 'get'
	});
};

// 下载
export function downloadExcel(forData) {
	let data = ''
	data += '?page=' + forData.page + '&rows=' + forData.rows

	if (typeof forData.status !== 'undefined') {
		data += '&status=' + forData.status
	}
	if (forData.search_datatime !== undefined && forData.search_datatime !== null) {
		data += '&complainStartTime=' + forData.search_datatime[0]
		data += '&complainEndTime=' + forData.search_datatime[1]
	}
	if (typeof forData.keyword !== 'undefined') {
		data += '&keywords=' + forData.keyword
	}

	return request({
		url: '/mhotel/ComplaintoComplainExcel.action',
		method: 'get',
		data
	})
}