import request from '../index'
const prefix = '/price'

// 导出列表
export function exportPriceList(data: object) {
  return request({
    url: `${prefix}/exportPriceList`,
    method: 'post',
    responseType: 'blob',
    data,
  })
}

// 价格列表查询
export function getPriceList(data: { offset: number; limit: number }) {
  return request({
    url: `${prefix}/queryPriceList?offset=${data.offset}&limit=${data.limit}`,
    method: 'post',
    data,
  })
}
// 价格列表新增
export function getPriceAddList(data: object) {
  return request({
    url: `${prefix}/addMeterPrice`,
    method: 'post',
    data,
  })
}

// 获取下拉框
export function getTypeSelect(code: string) {
  return request({
    url: `/sys/dict/code/${code}`,
    method: 'get',
  })
}

// 获取详情信息
export function getQueryPriceInfo(data: object) {
  return request({
    url: `${prefix}/queryPriceInfo`,
    method: 'post',
    data,
  })
}

// 修改编辑
export function getUpdatePriceInfo(data: object) {
  return request({
    url: `${prefix}/updatePriceInfo`,
    method: 'post',
    data,
  })
}

// 删除列表
export function getDeletePrice(data: object) {
  return request({
    url: `${prefix}/deletePrice`,
    method: 'post',
    data,
  })
}
// 上传文件
export function uploadPrice(data: FormData) {
  return request({
    url: `${prefix}/batchImportPrice`,
    method: 'post',
    data,
  })
}
