const state = {
  searchValueOfMyCustomer: '',
  searchValueOfPartner: '',
  isSearchOfMyCustomer: 0,
  isSearchOfPartner: 0,
  defaultNav: '' // 记录销售页nav切换时，路由名
}

const getters = {
  searchValueOfMyCustomer (state) {
    return state.searchValueOfMyCustomer
  },
  searchValueOfPartner (state) {
    return state.searchValueOfPartner
  },
  isSearchOfMyCustomer (state) {
    return state.isSearchOfMyCustomer
  },
  isSearchOfPartner (state) {
    return state.isSearchOfPartner
  },
  defaultNav (state) {
    return state.defaultNav
  }
}

const actions = {
  setSearchValueOfMyCustomer ({ commit }, value) {
    commit('UPDATE_SEARCHOFMYCUSTOMER_VALUE', value)
  },
  setSearchValueOfPartner ({ commit }, value) {
    commit('UPDATE_SEARCHOFPARTNER_VALUE', value)
  },
  setIsSearchOfMyCustomer ({ commit }, value) {
    commit('UPDATE_ISSEARCHOFMYCUSTOMER_VALUE', value)
  },
  setIsSearchOfPartner ({ commit }, value) {
    commit('UPDATE_ISSEARCHOFPARTNER_VALUE', value)
  },
  setDefaultNav ({ commit }, value) {
    commit('UPDATE_DEFAULTNAV_VALUE', value)
  }
}

const mutations = {
  UPDATE_SEARCHOFMYCUSTOMER_VALUE (state, value) {
    state.searchValueOfMyCustomer = value
  },
  UPDATE_SEARCHOFPARTNER_VALUE (state, value) {
    state.searchValueOfPartner = value
  },
  UPDATE_ISSEARCHOFMYCUSTOMER_VALUE (state, value) {
    state.isSearchOfMyCustomer = value
  },
  UPDATE_ISSEARCHOFPARTNER_VALUE (state, value) {
    state.isSearchOfPartner = value
  },
  UPDATE_DEFAULTNAV_VALUE (state, value) {
    state.defaultNav = value
  }
}

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