import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/mall/goodsinfo/storePage',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  })
}

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 audit = (param) => {
  return request({
    url: '/api/mall/goodsinfo/audit',
    method: 'post',
    params: {
        ...param
    }
  })
}


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

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/storeSubmit',
    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,
    }
  })
}

