import deviceServer from '../subpackage/device/js/device_server'; import deviceApi from '../subpackage/device/js/device_api'; export default { state(){ return { storeList: [], curStoreInfo: {} } }, mutations: { setStoreList(state, query){ state.storeList = query; }, setStoreInfo(state, query){ state.curStoreInfo = query; } }, actions: { // 小程序模块化访问失败 this.$store.dispatch('device/getStoreList') getStoreList({ commit, state , rootState}){ return deviceServer.get({ url: deviceApi.stadiumList, data: { brand_id: rootState.brandInfo.brand.id }, failMsg: '加载失败!', }) .then(res=>{ let _list = res.list || []; commit('setStoreList', _list); if(JSON.stringify(state.curStoreInfo) == '{}'&&_list.length)commit('setStoreInfo', _list[0]); return res; }) } } }