import axios from "@/libs/api.request";

export default {
  //商品
  getGoodsList: data => {
    return axios
      .request({
        url: "/cms/activityProduct/findPage",
        data: data,
        method: "post"
      })
      .then(res => res.data);
  },
  addGoods: data => {
    return axios
      .request({
        url: "/cms/activityProduct/add",
        data: data,
        method: "post"
      })
      .then(res => res.data);
  },
  updateGoods: data => {
    return axios
      .request({
        url: "/cms/activityProduct/update",
        data: data,
        method: "post"
      })
      .then(res => res.data);
  },
  delGoods: id => {
    return axios
      .request({
        url: "/cms/activityProduct/delProduct?id=" + id,
        method: "get"
      })
      .then(res => res.data);
  },
  getGoods: id => {
    return axios
      .request({
        url: "/cms/activityProduct/findById",
        params: { id },
        method: "get"
      })
      .then(res => res.data);
  },
  stopActivity: id => {
    return axios
      .request({
        url: "/cms/activityProduct/endProduct",
        params: { id },
        method: "get"
      })
      .then(res => res.data);
  },
  changeStatus: data => {
    return axios
      .request({
        url: "cmsGoods/setStatus",
        data: data,
        method: "post"
      })
      .then(res => res.data);
  }
};
