productpact.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import Vue from 'vue';
  2. import Vuex from 'vuex';
  3. import _ from 'lodash';
  4. Vue.use(Vuex);
  5. const api = {
  6. productpactInfo: `/api/market/productpact`,
  7. findpactInfo: `/api/market/productpact/findpact`,
  8. };
  9. const state = () => ({});
  10. const mutations = {};
  11. const actions = {
  12. async query({ commit }, { skip = 0, limit, ...info } = {}) {
  13. const res = await this.$axios.$get(api.productpactInfo, {
  14. skip,
  15. limit,
  16. ...info,
  17. });
  18. return res;
  19. },
  20. async create({ commit }, payload) {
  21. const res = await this.$axios.$post(`${api.productpactInfo}`, payload);
  22. return res;
  23. },
  24. async fetch({ commit }, payload) {
  25. const res = await this.$axios.$get(`${api.productpactInfo}/${payload}`);
  26. return res;
  27. },
  28. async findpact({ commit }, payload) {
  29. const res = await this.$axios.$get(`${api.findpactInfo}/${payload}`);
  30. return res;
  31. },
  32. async update({ commit }, { id, ...data }) {
  33. const res = await this.$axios.$post(`${api.productpactInfo}/update/${id}`, data);
  34. return res;
  35. },
  36. async delete({ commit }, payload) {
  37. const res = await this.$axios.$delete(`${api.productpactInfo}/${payload}`);
  38. return res;
  39. },
  40. };
  41. export default {
  42. namespaced: true,
  43. state,
  44. mutations,
  45. actions,
  46. };