import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/mall/goodsinfo/list',
    method: 'post',
    data: {
      ...params,
      current,
      size,
      descs: 'create_time'
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/mall/goodsinfo/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const tree = () => {
  return request({
    url: '/api/mall/categoryinfo/tree',
    method: 'get'
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/mall/goodsinfo/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const modifyState = (ids, state) => {
  return request({
    url: '/api/mall/goodsinfo/modifyState',
    method: 'post',
    params: {
      ids,
      state
    }
  })
}

export const modifyCategory = (ids, categoryIds) => {
  return request({
    url: '/api/mall/goodsinfo/modifyCategory',
    method: 'post',
    params: {
      ids,
      categoryIds
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/mall/goodsinfo/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/mall/goodsinfo/update',
    method: 'post',
    data: row
  })
}

export const modifySaleState = (row) => {
  return request({
    url: '/api/mall/goodsinfo/modifySaleState',
    method: 'post',
    data: row
  })
}

export const modifyGrossRate = (ids, grossRate) => {
  return request({
    url: '/api/mall/goodsinfo/modifyGrossRate',
    method: 'post',
    params: {
      ids,
      grossRate
    }
  })
}

export const modifyZoneType = (ids, zoneType, activityDate) => {
  return request({
    url: '/api/mall/goodsinfo/modifyZoneType',
    method: 'post',
    params: {
      ids,
      zoneType,
      activityDate
    }
  })
}

export const setActivityGoods = (ids, activityDate) => {
  return request({
    url: '/api/mall/goodsinfo/setActivityGoods',
    method: 'post',
    params: {
      ids,
      activityDate
    }
  })
}

export const zoneTypeOption = () => {
  return request({
    url: '/api/blade-system/dict-biz/dictionary?code=zone_type',
    method: 'get',
  })
}

export const getSpecList = (current, size, params) => {
  return request({
    url: '/api/mall/goodsspec/list',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  })
}


export const getRoundList = () => {
  return request({
    url: '/api/mall/seckillround/round',
    method: 'get'
  })
}

export const syncFull = (ids) => {
  return request({
    url: '/api/mall/goodsinfo/sync/full',
    method: 'post',
    params: {
      ids,
    }
  })
}

