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

const actions = {
  async query({ commit }, { skip = 0, limit, ...info } = {}) {
    const res = await this.$axios.$post(`${api.financeclaimsInfo}`, { skip, limit, ...info });
    return res;
  },
  async zhaiquanQuery({ commit }, { skip = 0, limit, ...info } = {}) {
    const res = await this.$axios.$post(`${api.financeclaimsInfo}`, { skip, limit, ...info });
    return res;
  },
  async create({ commit }, payload) {
    const res = await this.$axios.$post(`${api.financeclaimsInfo}`, payload);
    return res;
  },
  async fetch({ commit }, payload) {
    const res = await this.$axios.$get(`${api.financeclaimsInfo}/${payload}`);
    return res;
  },
  async update({ commit }, { id, ...data }) {
    const res = await this.$axios.$post(`${api.financeclaimsInfo}/update/${id}`, data);
    return res;
  },
  async delete({ commit }, payload) {
    const res = await this.$axios.$delete(`${api.financeclaimsInfo}/${payload}`);
    return res;
  },
  async searchpro({ commit }, payload) {
    const res = await this.$axios.$post(`${api.justNameId}`, payload);
    return res;
  },
};
export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
