zszq-celebration-88/src/store/index.js
2022-08-08 16:17:04 +08:00

89 lines
2.8 KiB
JavaScript

import { createStore } from 'vuex';
import h5plugin from "@/utils/plugin.js"
export default createStore({
// 数据源
state: {
userAccount: {
// xglOpenId: 'o9B_fvjtyh2KELQYc2t9A3MEh7JQ', //用户openid
xglOpenId: '', //用户openid
// xglOpenId: h5plugin.getQueryString('openid'), //用户openid
token: h5plugin.getQueryString('token'), //用户token
cardId: h5plugin.getQueryString('cardId'), //carid
nkh: '', //牛卡号
isDraw: false, //是否抽过奖
isHasAccount: false, //是否存在牛卡号
isAddCustomer: 0, //活动期间内是否添加过服务人员
isAddCustomerBefore:0, //活动前是否存在服务人员
isHasPrize: [], //是否存在奖品
participantNum: 0, //活动参与人数
prizeResult: 0, //中奖金额
eqcodeImg: '', //二维码
isBirthMon: 1, //生日是否处于当月
prizeList: [] //奖品列表
},
},
// 计算
getters: {},
// 改变方法(同步):每个 mutation 都有一个字符串的事件类型 (type)和一个回调函数 (handler)
mutations: {
// 更新信广龙openid
updateXGLOpenid(state, val) {
state.userAccount.xglOpenId = val.openid
},
// 更新token
updateToken(state,val){
state.userAccount.token = val.token
},
// 更新牛卡号
updateeNkh(state,val){
state.userAccount.nkh = val.nkh
},
// 更新cardId
updateCardId(state,val){
state.userAccount.cardId = val.cardId
},
// 更新二维码
updateeEqcodeImg(state,val){
state.userAccount.eqcodeImg = val.eqcodeImg
},
// 更新活动参与人数
updateParticipantNum(state,val){
state.userAccount.participantNum = val.participantNum
},
// 更新生日是否处于当月状态
updateBirthMoon(state,val){
state.userAccount.isBirthMon = val.isBirthMon
},
// 更新活动期间内是否添加过企微状态
updateIsAddCustomer(state,val){
state.userAccount.isAddCustomer = val.isAddCustomer
},
// 更新活动前是否存在企微状态
updateisAddCustomerBefore(state,val){
state.userAccount.isAddCustomerBefore = val.isAddCustomerBefore
},
// 更新奖品列表
updatePrizeList(state,val){
state.userAccount.prizeList = val.prizeList
}
},
// 改变方法:异步
actions: {},
// 模块化
modules: {},
})