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

const actions = {
  async create({ commit }, payload) {
    const res = await this.$axios.$post(`${api.financeclaimInfo}`, payload);
    return res;
  },
  async fclaimsList({ commit }, payload) {
    // 债券产品列表
    const res = await this.$axios.$post(`${api.financeclaimInfo}/claimsList`, payload);
    return res;
  },
  async orUpdate({ commit }, payload) {
    // 修改前要请求的接口
    const res = await this.$axios.$post(`${api.financeclaimInfo}/orUpdate`, payload);
    return res;
  },
  async one({ commit }, payload) {
    // 详情
    const res = await this.$axios.$post(`${api.financeclaimInfo}/one`, payload);
    return res;
  },
  async dupdate({ commit }, { id, ...data }) {
    //逻辑删除
    const res = await this.$axios.$post(`${api.financeclaimInfo}/update/${id}`, data);
    return res;
  },
  async fetch({ commit }, payload) {
    const res = await this.$axios.$get(`${api.financeclaimInfo}/${payload}`);
    return res;
  },
  async update({ commit }, { id, ...data }) {
    const res = await this.$axios.$post(`${api.financeclaimInfo}/update/${id}`, data);
    return res;
  },
};
export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
