-
zhangwei
2024-08-16 ae95604f4d0f8211ffa79587ca3f42da16842609
src/store/index.js
@@ -1,79 +1,80 @@
import { createStore } from 'vuex'
import {
   createStore
} from 'vuex'
const store = createStore({
  // 为了不和页面或组件的data中的造成混淆,state中的变量前面建议加上$符号
  state: {
      config: {
          shopLogo:"/static/images/logo/logo.png"
      }, // 店铺配置信息 //添加一个前端项目中的图片地址
      orderTab: 0, // 选中的订单tab页
      scene: 0, // 选中的订单tab页
      redirectPage: '',
      uuid: '',//当前客户端
      searchStyle: '',
      sessionAuthId: '', //微信缓存授权信息
      searchFixed: false,//搜索框样式
      showLoginTip:false,//显示登录框
      hasLogin: false,//存储用户当前是否登录,作为切换特效使用
      userShip: {}, //地区信息
      userInfo: {}, //用户信息存储
      invoice: {}, //发票信息
     deliveryData: {},//派送订单详情
  },
  mutations: {
      config(state, payload) {
          state.config = payload
      },
      orderTab(state, tab) {
          state.orderTab = tab
      },
      scene(state, tab) {
          state.scene = tab
      },
      redirect(state, payload) {
          state.redirectPage = payload.page
      },
      searchStyle(state, style) {
          state.searchStyle = style
      },
      sessionAuthId(state, payload) {
          state.sessionAuthId = payload
      },
      searchFixed(state, payload) {
          state.searchFixed = payload
      },
      showLoginTip(state, payload) {
          state.showLoginTip = payload
      },
      hasLogin(state, payload) {
          state.hasLogin = payload
      },
      userShip(state, userShip) {
          state.userShip = userShip
      },
      userInfo(state, userInfo) {
          state.userInfo = userInfo
      },
      invoice(state, invoice) {
          state.invoice = invoice
      },
     deliveryData(state,data){
        state.deliveryData = data
     }
  },
  actions: {
  },
  getters: {
      shopConfig: state => state.config,
      scene: state => state.scene,
      userInfo: state => state.userInfo,
      uuid: state => state.uuid,
      hasLogin: state => state.hasLogin,
      sessionAuthId: state => state.sessionAuthId,
     deliveryData: state => state.deliveryData
  }
   // 为了不和页面或组件的data中的造成混淆,state中的变量前面建议加上$符号
   state: {
      config: {
         shopLogo: "/static/images/logo/logo.png"
      }, // 店铺配置信息 //添加一个前端项目中的图片地址
      orderTab: 0, // 选中的订单tab页
      scene: 0, // 选中的订单tab页
      redirectPage: '',
      uuid: '', //当前客户端
      searchStyle: '',
      sessionAuthId: '', //微信缓存授权信息
      searchFixed: false, //搜索框样式
      showLoginTip: false, //显示登录框
      hasLogin: false, //存储用户当前是否登录,作为切换特效使用
      userShip: {}, //地区信息
      userInfo: {}, //用户信息存储
      invoice: {}, //发票信息
      deliveryData: {}, //派送订单详情
   },
   mutations: {
      config(state, payload) {
         state.config = payload
      },
      orderTab(state, tab) {
         state.orderTab = tab
      },
      scene(state, tab) {
         state.scene = tab
      },
      redirect(state, payload) {
         state.redirectPage = payload.page
      },
      searchStyle(state, style) {
         state.searchStyle = style
      },
      sessionAuthId(state, payload) {
         state.sessionAuthId = payload
      },
      searchFixed(state, payload) {
         state.searchFixed = payload
      },
      showLoginTip(state, payload) {
         state.showLoginTip = payload
      },
      hasLogin(state, payload) {
         state.hasLogin = payload
      },
      userShip(state, userShip) {
         state.userShip = userShip
      },
      userInfo(state, userInfo) {
         state.userInfo = userInfo
      },
      invoice(state, invoice) {
         state.invoice = invoice
      },
      deliveryData(state, data) {
         state.deliveryData = data
      }
   },
   actions: {
   },
   getters: {
      shopConfig: state => state.config,
      scene: state => state.scene,
      userInfo: state => state.userInfo,
      uuid: state => state.uuid,
      hasLogin: state => state.hasLogin,
      sessionAuthId: state => state.sessionAuthId,
      deliveryData: state => state.deliveryData
   }
})
export default store
export default store