| 123456789101112131415161718192021222324252627282930313233343536373839 |
- import { getShopInfoApi } from "@/api/common/index";
- export default {
- state: {
- merchantInfo: null //商家信息
- },
- getters: {
- getMerchantInfo(state) {
- return state.merchantInfo;
- }
- },
- actions: {
- async initMerchantInfo({ commit }) {
- try {
- const { data } = await getShopInfoApi();
- commit("UPDATE_MERCHANT_INFO", data);
- return data;
- } catch (error) {
- throw new Error(error);
- }
- },
- /**
- * 设置不同类别选中商品列表信息
- */
- updateMerchantInfo({ commit }, info) {
- commit("UPDATE_MERCHANT_INFO", info);
- },
- /**
- * 清除商家信息
- */
- rmoveMerchantInfo({ commit }) {
- commit("UPDATE_MERCHANT_INFO", null);
- }
- },
- mutations: {
- ["UPDATE_MERCHANT_INFO"](state, info) {
- state.merchantInfo = info;
- }
- }
- };
|