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

const actions = {
  async create({ commit }, payload) {
    const res = await this.$axios.$post(`${api.loanproInfo}`, payload);
    return res;
  },
  async loanproList({ commit }, payload) {// 贷款产品列表
    const res = await this.$axios.$post(`${api.loanproInfo}/loanproList`, payload);
    return res;
  },
  async dupdate({ commit }, { id, ...data }) {//逻辑删除
    const res = await this.$axios.$post(`${api.loanproInfo}/update/${id}`, data);
    return res;
  },
  async fetch({ commit }, payload) {
    const res = await this.$axios.$get(`${api.loanproInfo}/${payload}`);
    return res;
  },
  async update({ commit }, { id, ...data }) {
    const res = await this.$axios.$post(`${api.loanproInfo}/update/${id}`, data);
    return res;
  },

};
export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
