import Vue from 'vue';
import Vuex from 'vuex';
import _ from 'lodash';
Vue.use(Vuex);
const api = {
  managemoneyInfo: `/api/financial/managemoney`,
};
const state = () => ({});
const mutations = {};

const actions = {
  async create({ commit }, payload) {
    const res = await this.$axios.$post(`${api.managemoneyInfo}`, payload);
    return res;
  },
  async fetch({ commit }, payload) {
    const res = await this.$axios.$get(`${api.managemoneyInfo}/${payload}`);
    return res;
  },
  async update({ commit }, { id, ...data }) {
    const res = await this.$axios.$post(`${api.managemoneyInfo}/update/${id}`, data);
    return res;
  },
  async orUpdate({ commit }, payload) {
    // 修改前要请求的接口
    const res = await this.$axios.$post(`${api.managemoneyInfo}/orUpdate`, payload);
    return res;
  },
  async mmoneyList({ commit }, payload) {
    const res = await this.$axios.$post(`${api.managemoneyInfo}/mmoneyList`, payload);
    return res;
  },
};
export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
