// 公共
const module = {
    // 开启命名空间
    namespaced: true,

    // 仓库
    state: {
        iphoneX:false,
        curShop:{},
        tabIndex:0,
        editClassify:null,  // manage/classify-form 编辑时保存的临时数据
        specData: null,   // manage/spec-edit 编辑时临时保存
        skuItem: null,   // manage/spec-item-form 编辑时临时保存
        curOrder: null,   // index/refund 售后临时保存
        disparityData:null, // index/disparity 售后临时保存
        couponData:null, // manage/coupon/form 优惠券临时保存
        cashierGoodList:null, // manage/cashier/index 收银临时保存
        closeSelectList:false, //manage/cashier/index 收银临时保存
        cashierRefundData:false, //manage/cashier/Refund 收银退货临时保存
        groupData:null, //assistant/setting/xxx 临时保存
        platformData:null,//assistant/setting2/xxx 临时保存
        billData:null,//wallet/detail/ 临时保存
        welcomeData:null, // assistant/welcome-item 临时保存
        welcomeItemData:null,// assistant/welcome-item 临时保存
        activityData:null,// youxuan/good 临时保存
        tabList:[{
            id: 1,
            name: "订单",
            imgOff: "../../static/tabBar/icon_green_1.png",
            imgOn: "../../static/tabBar/icon_green_1_select.png",
            "url": "/pages/index/index",
            hide:false,
        },
        {
            id: 2,
            name: "管理",
            imgOff: "../../static/tabBar/icon_green_2.png",
            imgOn: "../../static/tabBar/icon_green_2_select.png",
            "url": "/pages/manage/index",
            hide:false,
        },
        {
            id: 3,
            name: "群助理",
            imgOff: "../../static/tabBar/icon_green_4.png",
            imgOn: "../../static/tabBar/icon_green_4_select.png",
            "url": "/pages/assistant/index",
            hide:false,
        }
    ]
    },

    // 同步方法
    mutations: {
        // 更新数据
        update(state, data) {
            for (let key in data) {
                if (data.hasOwnProperty(key)) {
                    state[key] = data[key]
                }
            }
        },

        // 移除数据
        remove(state, name) {
            if (typeof name === 'string') {
                delete state[name]
            } else {
                for (let key in name) {
                    if (name.hasOwnProperty(key)) {
                        delete state[name[key]]
                    }
                }
            }
        },

        // 移除所有数据
        removeAll(state) {
            for (let key in state) {
                if (state.hasOwnProperty(key)) {
                    delete state[key]
                }
            }
        },
    },

    // 异步方法
    actions: {},
}

export default module
