import request from '@/utils/request'
import qs from 'qs'
import { UPCLOUD_RDC_TMS_MAINDATA_SERVICE, UPCLOUD_RDC_TMS_BMS_SERVICE, SERVICES_FILE_MANAGEMENT } from '@/config/serviceSettings.js'
const serviceName = UPCLOUD_RDC_TMS_MAINDATA_SERVICE

// 主表地址
export const listRemoteUrl = {
  url: serviceName + '/carrier/page',
  method: 'post',
}

// 启用
export const Enable = data => {
  return request({
    url: serviceName + '/carrier/enable',
    method: 'post',
    data,
  });
};

// 停用
export const Disable = data => {
  return request({
    url: serviceName + '/carrier/disable',
    method: 'post',
    data,
  });
};

// 删除
export const neverDelete = data => {
  return request({
    url: serviceName + '/carrier/delete',
    method: 'post',
    data,
  });
};

// 查看
export const viewCustomer = data => {
  return request({
    url: serviceName + '/carrier/check',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data),
  });
};

// 新增
export const saveCustomer = data => {
  return request({
    url: serviceName + '/carrier/add',
    method: 'post',
    data,
  });
};

// 修改
export const updateCustomer = data => {
  return request({
    url: serviceName + '/carrier/modify',
    method: 'post',
    data,
  });
};

//导入url
export const importUrl = serviceName + '/carrier/import'
export const downUrl = serviceName + '/carrier/download_template'

// 费用管理查询
export const costList = data => {
  return request({
    url: UPCLOUD_RDC_TMS_BMS_SERVICE + '/expenseManagement/findListNoPage/v1.0',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data),
  });
};

// 基础费用保存
export const feeSave = data => {
  return request({
    url: serviceName + '/carrier/feeSave',
    method: 'post',
    data,
  });
};

// 结算管理查询
export const settlementList = data => {
  return request({
    url: UPCLOUD_RDC_TMS_BMS_SERVICE + '/settlementFee/findListNoPage',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data),
  });
};

// 结算费用保存
export const accountSave = data => {
  return request({
    url: serviceName + '/carrier/accountSave',
    method: 'post',
    data,
  });
};

// 承运商司机分页查询
export const pageCarrierDriver = {
  url: serviceName + '/carrier/pageCarrierDriver',
  method: 'post',
}

// 承运商送货员分页查询
export const pageCarrierDeliveryman = {
  url: serviceName + '/carrier/pageCarrierDeliveryman',
  method: 'post',
}

// 承运商车辆分页查询
export const pageCarrierVehicle = {
  url: serviceName + '/carrier/pageCarrierVehicle',
  method: 'post',
}

// 承运商容器分页查询
export const pageCarrierContainer = {
  url: serviceName + '/carrier/pageCarrierContainer',
  method: 'post',
}

// 承运商设备分页查询
export const pageCarrierDevice = {
  url: serviceName + '/carrier/pageCarrierDevice',
  method: 'post',
}

// 承运商证件分页查询
export const pageCarrierPaper = {
  url: serviceName + '/carrier/pageCarrierPaper',
  method: 'post',
}

//承运商证件资料是否启用
export const whetherEnableCarrierPaper = data => {
  return request({
    url: serviceName + '/carrier/whetherEnableCarrierPaper',
    method: 'post',
    data,
  });
};

//承运商证件资料新增
export const addCarrierPaper = data => {
  return request({
    url: serviceName + '/carrier/addCarrierPaper',
    method: 'post',
    data,
  });
};

//承运商证件资料修改
export const updateCarrierPaper = data => {
  return request({
    url: serviceName + '/carrier/updateCarrierPaper',
    method: 'post',
    data,
  });
};

//获取证件ID
export const getPaperId = (_this, data) => {
  return request({
    url: serviceName + '/paper/getPaperId',
    method: 'post',
    data,
  });
};

export const updateImg = (_this, data, st) => {
  return request({
    processData: false,
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    url: SERVICES_FILE_MANAGEMENT + '/file/upload-file/v2',
    method: 'post',
    data
  })
};