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

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

// 启用/停用
export const updateStatus = data => {
  return request({
    url: serviceName + '/logisticsContract/updateStatus',
    method: 'post',
    data,
  })
};

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

// 新增
export const Save = data => {
  return request({
    url: serviceName + '/logisticsContract/save',
    method: 'post',
    data,
  })
};

// 修改
export const Update = data => {
  return request({
    url: serviceName + '/logisticsContract/update',
    method: 'post',
    data,
  })
};

// 复制
export const Copy = data => {
  return request({
    url: serviceName + '/logisticsContract/copy',
    method: 'post',
    data,
  })
};

// --------------------------------------费用--------------------------------------
// 主表地址
export const priceListRemoteUrl = {
  url: serviceName + '/freightPrice/findList',
  method: 'post',
}

// 启用/停用
export const priceUpdateStatus = data => {
  return request({
    url: serviceName + '/freightPrice/updateStatus',
    method: 'post',
    data,
  })
};

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

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

// 新增
export const priceSave = data => {
  return request({
    url: serviceName + '/freightPrice/save',
    method: 'post',
    data,
  })
};

// 修改
export const priceUpdate = data => {
  return request({
    url: serviceName + '/freightPrice/update',
    method: 'post',
    data,
  })
};

// 试算实验
export const trialTest = data => {
  return request({
    url: serviceName + '/logisticsContract/trialTest',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data),
  })
};

// 日志
export const auditNode_listRemoteUrl = {
  url: serviceName + '/logisticsContract/log',
  method: 'post',
}

//导入url
export const importUrl = serviceName + '/freightPrice/import'
export const downUrl = serviceName + '/freightPrice/download_template'
//导出url
export const allUrl = serviceName + '/freightPrice/export_all'
export const currentUrl = serviceName + '/freightPrice/export_page'
export const selectUrl = serviceName + '/freightPrice/export_choose'


// 货主弹窗
export const consigner_listRemoteUrl = {
  url: UPCLOUD_RDC_TMS_MAINDATA_SERVICE + '/cargo_owner/popup',
  method: 'post',
}

// 承运商弹窗
export const carrier_listRemoteUrl = {
  url: UPCLOUD_RDC_TMS_MAINDATA_SERVICE + '/carrier/popup',
  method: 'post',
}

// 获取部门
export const organization_all = data => {
  return request({
    url: SERVICE_PLATFORM_POWER_BASE + '/organization/all',
    method: 'get',
    data,
  })
};