import request from '@/utils/request'

// 创建信用规则
export function createCreditRule(data) {
  return request({
    url: '/customer/credit-rule/create',
    method: 'post',
    data: data
  })
}

// 更新信用规则
export function updateCreditRule(data) {
  return request({
    url: '/customer/credit-rule/update',
    method: 'put',
    data: data
  })
}

// 删除信用规则
export function deleteCreditRule(id) {
  return request({
    url: '/customer/credit-rule/delete?id=' + id,
    method: 'delete'
  })
}

// 获得信用规则
export function getCreditRule(id) {
  return request({
    url: '/customer/credit-rule/get?id=' + id,
    method: 'get'
  })
}

// 获得信用规则分页
export function getCreditRulePage(query) {
  return request({
    url: '/customer/credit-rule/page',
    method: 'get',
    params: query
  })
}

// 导出信用规则 Excel
export function exportCreditRuleExcel(query) {
  return request({
    url: '/customer/credit-rule/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
