You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
export default {
|
|
|
|
// 类似 vue 的 data
|
|
|
|
state: {
|
|
|
|
userInfo: {}, //保存用户登录信息,
|
|
|
|
toPath: "", //要跳转过去的页面,
|
|
|
|
foodInfo:"", //美食套餐信息
|
|
|
|
},
|
|
|
|
coupon: "",//下单选择优惠券
|
|
|
|
// 类似 vue 里的 mothods(同步方法)
|
|
|
|
mutations: {
|
|
|
|
//改变用户信息,自动保存到本地的COOKIE
|
|
|
|
changeUserInfo(state, data) {
|
|
|
|
state.userInfo = data;
|
|
|
|
uni.setStorageSync('userInfo', JSON.stringify(data))
|
|
|
|
},
|
|
|
|
changeLoginPath(state) {
|
|
|
|
var pages = getCurrentPages() //获取加载的页面
|
|
|
|
var currentPage = pages[pages.length - 1] //获取当前页面的对象
|
|
|
|
state.toPath = currentPage.$page.fullPath
|
|
|
|
if(state.toPath == '/pages/login/login') return;
|
|
|
|
// 登录
|
|
|
|
uni.navigateTo({
|
|
|
|
url: '/pages/login/login'
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 线路下单
|
|
|
|
changeFoodInfo(state, data){
|
|
|
|
state.foodInfo = data
|
|
|
|
},
|
|
|
|
// 选择优惠券
|
|
|
|
choseCoupon(state, data) {
|
|
|
|
state.coupon = data
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|