import request from '/@/utils/request';

//添加产品
export function addProduct(data: object) {
	return request({
		url: '/customer-server/product/add',
		method: 'post',
		data: data,
	});
}

//删除产品
export function deleteProduct(data: object) {
	return request({
		url: '/customer-server/product/delete',
		method: 'post',
		data: data,
	});
}

//获取产品列表
export function getList(data: object) {
	return request({
		url: '/customer-server/product/list',
		method: 'get',
		params: data,
	});
}

//更新产品
export function updateProduct(data: object) {
	return request({
		url: '/customer-server/product/update',
		method: 'post',
		data: data,
	});
}

// 导出产品
export function exportProduct(data: object) {
	return request({
		url: '/customer-server/product/export',
		responseType: 'blob',
		method: 'get',
		params: data,
	});
}

//导入产品
export function importProduct(data: FormData) {
	return request({
		url: '/customer-server/product/import',
		method: 'post',
		data: data,
		headers: {
			'Content-Type': 'multipart/form-data', // 文件上传需要使用form-data
		},
		timeout: 60000, // 文件上传可能较慢
	});
}
