2026-03-24 11:45:13 +08:00
|
|
|
|
import Vue from "vue";
|
|
|
|
|
|
// import createPersistedState from 'vuex-persistedstate'
|
|
|
|
|
|
import Vuex from "vuex";
|
|
|
|
|
|
|
|
|
|
|
|
Vue.use(Vuex);
|
|
|
|
|
|
|
|
|
|
|
|
const store = new Vuex.Store({
|
|
|
|
|
|
state: {
|
2026-05-27 15:45:10 +08:00
|
|
|
|
messageNum: 0, // 底部消息数量
|
|
|
|
|
|
// ========== 新增:全局当前选中的 tab 索引 ==========
|
|
|
|
|
|
currentTabIndex: 0, // 用于自定义 tabbar 高亮
|
|
|
|
|
|
// ============================================
|
|
|
|
|
|
sjServiceList: {}, // 商家分配手艺人时服务数据shop/staff
|
|
|
|
|
|
tabbarList: [], // 底部设置
|
|
|
|
|
|
reservationTime: {}, // 预约时刻信息
|
|
|
|
|
|
reservationSyr: {}, // 预约手艺人人信息
|
|
|
|
|
|
reservationAddress: {}, // 预约地址信息
|
|
|
|
|
|
selectStore: {}, // 选择的门店信息
|
|
|
|
|
|
wxShareType: 0, // 正式版:0,测试版:1,体验版:2
|
2026-03-24 11:45:13 +08:00
|
|
|
|
searchCity: {
|
|
|
|
|
|
center: "117.330043,38.372266",
|
|
|
|
|
|
name: "黄骅",
|
|
|
|
|
|
},
|
2026-05-27 15:45:10 +08:00
|
|
|
|
systemInfo: uni.getSystemInfoSync(),
|
2026-03-24 11:45:13 +08:00
|
|
|
|
isLocation: false,
|
|
|
|
|
|
baseUrl: "",
|
|
|
|
|
|
version: {
|
|
|
|
|
|
VersionCode: "",
|
|
|
|
|
|
DeviceBrand: "",
|
|
|
|
|
|
DeviceType: "",
|
|
|
|
|
|
},
|
|
|
|
|
|
sjInfo: {},
|
2026-05-27 15:45:10 +08:00
|
|
|
|
workSpaceSJClassList: [],
|
|
|
|
|
|
workHourSJClassList: [],
|
2026-03-24 11:45:13 +08:00
|
|
|
|
},
|
|
|
|
|
|
mutations: {
|
2026-05-27 15:45:10 +08:00
|
|
|
|
// 写入底部消息数量
|
2026-03-25 13:34:16 +08:00
|
|
|
|
setMessageNum(state, newval) {
|
|
|
|
|
|
state.messageNum = newval;
|
|
|
|
|
|
},
|
2026-05-27 15:45:10 +08:00
|
|
|
|
// ========== 新增:设置全局当前选中 tab 索引 ==========
|
|
|
|
|
|
SET_CURRENT_TAB_INDEX(state, index) {
|
|
|
|
|
|
state.currentTabIndex = index;
|
|
|
|
|
|
},
|
|
|
|
|
|
// ==============================================
|
2026-03-24 11:45:13 +08:00
|
|
|
|
clearServiceState(state) {
|
|
|
|
|
|
state.reservationTime = {};
|
|
|
|
|
|
state.reservationSyr = {};
|
|
|
|
|
|
state.reservationAddress = {};
|
|
|
|
|
|
state.selectStore = {};
|
|
|
|
|
|
},
|
|
|
|
|
|
//写入底部内容
|
|
|
|
|
|
setTabbarList(state, newval) {
|
|
|
|
|
|
state.tabbarList = newval;
|
|
|
|
|
|
},
|
|
|
|
|
|
//写入底部内容
|
|
|
|
|
|
setSjServiceList(state, newval) {
|
|
|
|
|
|
state.sjServiceList = newval;
|
|
|
|
|
|
},
|
|
|
|
|
|
setSelectStore(state, newval) {
|
|
|
|
|
|
state.selectStore = newval;
|
|
|
|
|
|
},
|
|
|
|
|
|
//、存储预约时刻信息
|
|
|
|
|
|
setreservationTime(state, newval) {
|
|
|
|
|
|
state.reservationTime = newval;
|
|
|
|
|
|
},
|
|
|
|
|
|
//存储预约手艺人人信息
|
|
|
|
|
|
setreservationSyr(state, newval) {
|
|
|
|
|
|
state.reservationSyr = newval;
|
|
|
|
|
|
state.reservationTime = {};
|
|
|
|
|
|
},
|
|
|
|
|
|
//存储预约地址信息
|
|
|
|
|
|
setreservationAddress(state, newval) {
|
|
|
|
|
|
state.reservationAddress = newval;
|
|
|
|
|
|
state.reservationTime = {};
|
|
|
|
|
|
state.reservationSyr = {};
|
|
|
|
|
|
},
|
|
|
|
|
|
//存储预约地址信息,不清除信息
|
|
|
|
|
|
setreservationAddress2(state, newval) {
|
|
|
|
|
|
state.reservationAddress = newval;
|
|
|
|
|
|
},
|
|
|
|
|
|
setLocation(state, newval) {
|
|
|
|
|
|
state.isLocation = newval;
|
|
|
|
|
|
},
|
|
|
|
|
|
//相当于同步的操作
|
|
|
|
|
|
unpdateCity(state, newval) {
|
|
|
|
|
|
state.searchCity.center = newval.center;
|
|
|
|
|
|
state.searchCity.name = newval.name;
|
|
|
|
|
|
},
|
|
|
|
|
|
//存储app信息
|
|
|
|
|
|
setBaseUrl(state, newval) {
|
|
|
|
|
|
state.baseUrl = newval;
|
|
|
|
|
|
},
|
|
|
|
|
|
//存储app信息
|
|
|
|
|
|
setVersion(state, newval) {
|
|
|
|
|
|
state.version = newval;
|
|
|
|
|
|
},
|
|
|
|
|
|
//存储商家信息
|
|
|
|
|
|
setSjInfo(state, newval) {
|
|
|
|
|
|
state.sjInfo = newval;
|
|
|
|
|
|
},
|
|
|
|
|
|
//存储商家工位分类列表
|
|
|
|
|
|
setWorkSpaceSJClassList(state, newval) {
|
|
|
|
|
|
state.workSpaceSJClassList = newval;
|
|
|
|
|
|
},
|
|
|
|
|
|
//存储商家工时分类列表
|
|
|
|
|
|
setworkHourSJClassList(state, newval) {
|
|
|
|
|
|
state.workHourSJClassList = newval;
|
|
|
|
|
|
},
|
|
|
|
|
|
// setLocation(state, newval) {
|
|
|
|
|
|
// state.isLocation = newval;
|
|
|
|
|
|
// }
|
|
|
|
|
|
},
|
|
|
|
|
|
actions: {
|
|
|
|
|
|
//相当于异步的操作,不能直接改变state的值,只能通过触发mutations的方法才能改变
|
|
|
|
|
|
},
|
|
|
|
|
|
// plugins: [
|
|
|
|
|
|
// createPersistedState({
|
|
|
|
|
|
// //默认使用localStorage
|
|
|
|
|
|
// // storage: window.sessionStorage,//设置存储成sessionStorage存储
|
|
|
|
|
|
// // key是存储数据的键名
|
|
|
|
|
|
// key: 'mrr_vuex',
|
|
|
|
|
|
// // paths是存储state中的那些数据,如果是模块下具体的数据需要加上模块名称,例如user.name
|
|
|
|
|
|
// // paths: ['user', 'cart'],
|
|
|
|
|
|
// // reducer(value) {
|
|
|
|
|
|
// // //只存储state.user.name的值
|
|
|
|
|
|
// // return {
|
|
|
|
|
|
// // name: value.user.name
|
|
|
|
|
|
// // }
|
|
|
|
|
|
// // }
|
|
|
|
|
|
// })
|
|
|
|
|
|
// ]
|
|
|
|
|
|
});
|
|
|
|
|
|
export default store;
|