/**
 * 客户管理请求接口
 */
import request from '../index'
import type { ICustomerQuery } from '@/views/customer/customerInfo/customer_interface'
const prefix = '/meter'

// 列表查询
export function getCustomerList(data: ICustomerQuery) {
  return request({
    url: `${prefix}/supplier/listPage?offset=${data.offset}&limit=${data.limit}`,
    method: 'post',
    data,
  })
}

// 数据删除
export function deleteCustomer(data: { id: string }) {
  return request({
    url: `${prefix}/supplier/delete`,
    method: 'post',
    data,
  })
}

// 查看详情
export function getCustomerDetail(data: { id: string }) {
  return request({
    url: `${prefix}/supplier/detail`,
    method: 'post',
    data,
  })
}

// 新增数据
export function addCustomer(data: object) {
  return request({
    url: '/meter/supplier/submit',
    method: 'post',
    data,
  })
}
// 编辑数据
export function updateCustomer(data: object) {
  return request({
    url: `${prefix}/supplier/update`,
    method: 'post',
    data,
  })
}

// 导出列表
export function exportCustomerList(data: Omit<ICustomerQuery, 'limit' | 'offset'>) {
  return request({
    url: `${prefix}/supplier/listExport`,
    method: 'post',
    responseType: 'blob',
    data,
  })
}

