import request from "@/utils/httpRequest";
import { FINANCE_PATH as prefix } from "../../AppPath";

export default {
	list: function (params) {
		return request({
			url: prefix + "/cw_finance/invoice/list",
			method: "get",
			params: params,
		});
	},
	redList: function (params) {
		return request({
			url: prefix + "/cw_finance/invoice/redList",
			method: "get",
			params: params,
		});
	},
	queryById: function (id) {
		return request({
			url: prefix + "/cw_finance/invoice/queryById",
			method: "get",
			params: { id: id },
		});
	},
	queryByNumber: function (number, id) {
		return request({
			url: prefix + "/cw_finance/invoice/queryByNumber",
			method: "get",
			params: { number: number, id: id },
		});
	},
	save: function (inputForm) {
		return request({
			url: prefix + `/cw_finance/invoice/save`,
			method: "post",
			data: inputForm,
		});
	},
	delete: function (ids) {
		return request({
			url: prefix + "/cw_finance/invoice/delete",
			method: "delete",
			params: { ids: ids },
		});
	},
	updateStatusById: function (data) {
		return request({
			url: prefix + "/cw_finance/invoice/updateStatusById",
			method: "post",
			data: data,
		});
	},
	isReceivables: function (data) {
		return request({
			url: prefix + "/cw_finance/invoice/isReceivables",
			method: "post",
			data: data,
		});
	},
	saveForm: function (inputForm) {
		return request({
			url: prefix + `/cw_finance/invoice/saveForm`,
			method: "post",
			data: inputForm,
		});
	},
	saveFormInvalid: function (inputForm) {
		return request({
			url: prefix + `/cw_finance/invoice/saveFormInvalid`,
			method: "post",
			data: inputForm,
		});
	},
	queryIdByInvalidId: function (id) {
		return request({
			url: prefix + "/cw_finance/invoice/queryIdByInvalidId",
			method: "get",
			params: { id: id },
		});
	},
	importDetail: function (data) {
		return request({
			url: prefix + "/cw_finance/invoice/importDetail",
			method: "post",
			data: data,
		});
	},
	exportTemplate: function () {
		return request({
			url: prefix + "/cw_finance/invoice/importDetail/template",
			method: "get",
			responseType: "blob",
		});
	},
	exportFinanceTemplate: function () {
		return request({
			url: prefix + "/cw_finance/invoice/importFinance/template",
			method: "get",
			responseType: "blob",
		});
	},
	importFinance: function (data) {
		return request({
			url: prefix + "/cw_finance/invoice/importFinance",
			method: "post",
			data: data,
		});
	},
	getByIds: function (projectId, invoiceForm) {
		return request({
			url: prefix + "/cw_finance/invoice/getByIds",
			method: "get",
			params: { projectId: projectId, ...invoiceForm },
		});
	},
	getByIds2: function (projectId, invoiceForm) {
		return request({
			url: prefix + "/cw_finance/invoice/getByIds2",
			method: "get",
			params: { projectId: projectId, ...invoiceForm },
		});
	},
	getByContractId: function (contractId, invoiceForm) {
		return request({
			url: prefix + "/cw_finance/invoice/getByContractId",
			method: "get",
			params: { contractId: contractId, ...invoiceForm },
		});
	},
	getIdByClientId: function (clientId, invoiceForm) {
		return request({
			url: prefix + "/cw_finance/invoice/getIdByClientId",
			method: "get",
			params: { clientId: clientId, ...invoiceForm },
		});
	},
	exportFile: function (params) {
		return request({
			url: prefix + "/cw_finance/invoice/export",
			method: "get",
			params: params,
			responseType: "blob",
		});
	},

	getLabelById:function (param) {
		return request({
			url: prefix+"/cwProjectRecords/getLabelById",
			method:"get",
			params: {id: param}
		})

	},
	listByProgramId: function (params) {
		return request({
			url: prefix + "/cw_finance/invoice/listByProgramId",
			method: "get",
			params: params,
		});
	},

	getByNo (no) {
		return request({
			url: prefix + '/cw_finance/invoice/getByNo',
			method: 'get',
			params: {no: no}
		})
	}


};
