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

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

export const consigneeListRemoteUrl = {
  url: serviceName + '/tmsBaseCustomer/queryCustomerReceiver',
  method: 'post',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded'
  },
  transformRequest: [data => qs.stringify(data)]
}

// 启用
export const activeCustomer = data => {
  return axios.post(serviceName + "/tmsBaseCustomer/activeCustomer", data);
};

// 停用
export const deleteCustomer = data => {
  return axios.post(serviceName + "/tmsBaseCustomer/deleteCustomer", data);
};

// 删除
export const neverDelete = data => {
  return axios.post(serviceName + "/tmsBaseCustomer/neverDelete", data);
};

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

// 新增
export const saveCustomer = data => {
  return axios.post(serviceName + "/tmsBaseCustomer/saveCustomer", data);
};

// 修改
export const updateCustomer = data => {
  return axios.post(serviceName + "/tmsBaseCustomer/updateCustomer", data);
};

// 收货方启用
export const activeCustomerReceiver = data => {
  return axios.post(serviceName + "/tmsBaseCustomer/activeCustomerReceiver", data);
};

// 收货方停用
export const deleteCustomerReceiver = data => {
  return axios.post(serviceName + "/tmsBaseCustomer/deleteCustomerReceiver", data);
};

// 收货方删除
export const neverDeleteCustomerReceiver = data => {
  return axios.post(serviceName + "/tmsBaseCustomer/neverDeleteCustomerReceiver", data);
};

// 收货方查看
export const viewCustomerReceiver = data => {
  return axios.post(serviceName + "/tmsBaseCustomer/viewCustomerReceiver", qs.stringify(data), {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
};

// 收货方新增
export const saveCustomerReceiver = data => {
  return axios.post(serviceName + "/tmsBaseCustomer/saveCustomerReceiver", data);
};

// 收货方修改
export const updateCustomerReceiver = data => {
  return axios.post(serviceName + "/tmsBaseCustomer/updateCustomerReceiver", data);
};

//导入url
export const importUrl = serviceName + '/tmsBaseCustomer/batchImportCustomer'
export const downUrl = serviceName + '/tmsBaseCustomer/customer_download_template'
export const consigneeImportUrl = serviceName + '/tmsBaseCustomer/batchImportCustomerReceiver'
export const consigneeDownUrl = serviceName + '/tmsBaseCustomer/consignee_download_template'

// 通过省市区获取站点
export const query_by_administrative = data => {
  return axios.post(serviceName + "/station/query_by_administrative", data);
};