import { request } from '/@/utils/service';
import { getShopOptions } from '/@/views/product-manage/product-list/api';

const apiPrefix = '/api/pricing/price_cost/';

export function getTableData(query: any) {
	return request({
		url: apiPrefix,
		method: 'GET',
		params: query
	});
}

export function updateRow(body: any) {
	return request({
		url: apiPrefix + body.id + '/',
		method: 'PUT',
		data: body
	});
}

export function deleteRow(body: any) {
	return request({
		url: apiPrefix + `${body.id}/` ,
		method: 'DELETE',
		data: body
	});
}

export function postCost(body: any) {
	return request({
		url: apiPrefix,
		data: body,
		method: 'POST'
	})
}

export function getDetail(query: any) {
	return request({
		url: apiPrefix + `${query.id}/` ,
		method: 'GET',
		params: query
	});
}

export function getCostOptions(query: any) {
	return request({
		url: apiPrefix + 'box/' ,
		method: 'GET',
		params: query
	});
}

export function exportData(query: any) {
	return request({
		url: apiPrefix + 'export_data/',
		method: 'GET',
		responseType: 'blob',
		params: query
	});
}

export function upload(body: any){
	return request({
		url: apiPrefix +'import_data/',
		method: 'POST',
		data: body,
	});
}



