| | |
| | | import http from '../plugins/http' |
| | | import storage from '../plugins/storage.js' |
| | | import message from '../plugins/message.js' |
| | | // #ifndef VUE3 |
| | | import Vue from 'vue' |
| | | import Vuex from 'vuex' |
| | | |
| | | Vue.use(Vuex) |
| | | const store = new Vuex.Store({ |
| | | // #endif |
| | | |
| | | |
| | | |
| | | // #ifdef VUE3 |
| | | import { |
| | | createStore |
| | | } from 'vuex' |
| | | const store = createStore({ |
| | | // #endif |
| | | state: { |
| | | hasLogin: false, |
| | | isUniverifyLogin: false, |
| | |
| | | 'enterprise': 0, |
| | | 'info': 0, |
| | | 'flower': 0, |
| | | 'shopping': 0, |
| | | }, |
| | | defaultaddress: {} |
| | | }, |
| | |
| | | }) { |
| | | //把权限获取到 |
| | | // console.log('getCurrentInfo,getCurrentInfo') |
| | | const currentInfo = await http.request('get', '/api/current/user', { |
| | | |
| | | }) |
| | | const currentInfo = await http.request('get', '/api/current/user', {}) |
| | | if (currentInfo && currentInfo.code == 0) { |
| | | // state.cMenu = cMenu |
| | | // state.roles = currentInfo.data.roles || [] |
| | |
| | | } |
| | | |
| | | }, |
| | | submitShopping: async function ({commit, dispatch}, data) { |
| | | const resp = await http.request('post', '/api/api/customer/flower/cart/change-num', { |
| | | data: { |
| | | id: data.id, |
| | | num: 1 |
| | | } |
| | | } |
| | | ) |
| | | if (resp && resp.code === 0) { |
| | | message.showToast('添加购物车成功') |
| | | dispatch('sign_add', 'shopping') |
| | | } else { |
| | | |
| | | } |
| | | return resp |
| | | }, |
| | | |
| | | } |
| | | }) |