import { request } from '@/service/request';

/** 获取免邮配置 */
export function fetchConfig(params?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/globalConfig/find`,
    method: 'get',
    params
  });
}

/** 保存免邮配置 */
export function fetchSaveConfig(data?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/globalConfig/save`,
    method: 'post',
    data
  });
}

/** 获取区域规则配置 */
export function fetchAreaRule(params?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/regionRule/findList`,
    method: 'get',
    params
  });
}

/** 保存区域规则配置 */
export function fetchSaveAreaRule(data?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/regionRule/save`,
    method: 'post',
    data
  });
}

/** 编辑区域规则配置 */
export function fetchUpdateAreaRule(data?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/regionRule/update`,
    method: 'put',
    data
  });
}

/** 删除区域规则配置 */
export function fetchDelAreaRule(params?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/regionRule/delete`,
    method: 'delete',
    params
  });
}

/** 变更状态 */
export function fetchUpdateAreaStatus(params?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/regionRule/updateByStatus`,
    method: 'get',
    params
  });
}

/** 检查是否存在 */
export function fetchCheckAreaRule(data?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/regionRule/check`,
    method: 'post',
    data
  });
}

/** 省列表 */
export function fetchProvince(params?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/globalConfig/findAddressAll`,
    method: 'get',
    params
  });
}

/** 详情 */
export function fetchAreaDetail(params: any) {
  return request({
    url: `/smqjh-oms/v1/freight/regionRule/findById`,
    method: 'get',
    params
  });
}

//   -------------身份------------

/** 获取身份列表 */
export function fetchUserList(params?: any) {
  return request({
    url: `/smqjh-system/api/v1/channel/listAll`,
    method: 'get',
    params
  });
}

/** 获取身份规则配置 */
export function fetchUserRule(params?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/userIdentityRule/findList`,
    method: 'get',
    params
  });
}

/** 保存身份规则配置 */
export function fetchSaveUserRule(data?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/userIdentityRule/save`,
    method: 'post',
    data
  });
}

/** 编辑身份规则配置 */
export function fetchUpdateUserRule(data?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/userIdentityRule/update`,
    method: 'put',
    data
  });
}

/** 删除身份规则配置 */
export function fetchDelUserRule(params?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/userIdentityRule/delete`,
    method: 'delete',
    params
  });
}

/** 变更状态 */
export function fetchUpdateUserStatus(params?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/userIdentityRule/updateByStatus`,
    method: 'get',
    params
  });
}

/** 详情 */
export function fetchUserDetail(params: any) {
  return request({
    url: `/smqjh-oms/v1/freight/userIdentityRule/findById`,
    method: 'get',
    params
  });
}

/** 检查是否存在 */
export function fetchCheckUserRule(data?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/userIdentityRule/check`,
    method: 'post',
    data
  });
}

//   -------------会员------------

/** 获取会员列表 */
export function fetchMemberList(params?: any) {
  return request({
    url: `/smqjh-pms/api/v1/member/type/findAll`,
    method: 'get',
    params
  });
}

/** 获取区域规则配置 */
export function fetchMemberRule(params?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/userMemberRule/findList`,
    method: 'get',
    params
  });
}

/** 保存区域规则配置 */
export function fetchSaveMemberRule(data?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/userMemberRule/save`,
    method: 'post',
    data
  });
}

/** 编辑区域规则配置 */
export function fetchUpdateMemberRule(data?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/userMemberRule/update`,
    method: 'put',
    data
  });
}

/** 删除区域规则配置 */
export function fetchDelMemberRule(params?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/userMemberRule/delete`,
    method: 'delete',
    params
  });
}

/** 变更状态 */
export function fetchUpdateMemberStatus(params?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/userMemberRule/updateByStatus`,
    method: 'get',
    params
  });
}

/** 详情 */
export function fetchMemberDetail(params: any) {
  return request({
    url: `/smqjh-oms/v1/freight/userMemberRule/findById`,
    method: 'get',
    params
  });
}

/** 检查是否存在 */
export function fetchCheckMemberRule(data?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/userMemberRule/check`,
    method: 'post',
    data
  });
}

//   -------------分类--------------

/** 获取分类列表 */
export function fetchTypeList(params?: any) {
  return request({
    url: `/smqjh-pms/api/v1/shop-categories/findAll`,
    method: 'get',
    params
  });
}

/** 获取分类规则配置 */
export function fetchTypeRule(params?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/categoryMapping/find`,
    method: 'get',
    params
  });
}

/** 保存分类规则配置 */
export function fetchSaveTypeRule(data?: any) {
  return request({
    url: `/smqjh-oms/v1/freight/categoryMapping/save`,
    method: 'post',
    data
  });
}
