tradeScreen/src/store/index.js

44 lines
931 B
JavaScript
Raw Normal View History

2023-12-08 18:51:02 +08:00
import {
defineStore
} from 'pinia'
export const areaObj = defineStore('counter', {
state: () => ({
2023-12-11 18:35:55 +08:00
userInfo: {},
// 普通用户请求的参数
2023-12-08 18:51:02 +08:00
area: {
2023-12-08 23:00:43 +08:00
// areaCode: 510524,
// streetCode: 51052410
2023-12-08 18:51:02 +08:00
2023-12-11 18:35:55 +08:00
},
// 商户请求的参数
store: {
areaCode: "",
streetCode: "",
mer_id: ""
2023-12-08 18:51:02 +08:00
}
}),
getters: {},
actions: {
changeArea(obj) {
this.area = obj
2023-12-08 23:00:43 +08:00
},
2023-12-11 18:35:55 +08:00
changeUserInfo(obj) {
this.userInfo = obj
if (obj?.user?.merchant) {
let { area_id, mer_id, street_id } = obj.user.merchant
this.store.areaCode = area_id
this.store.streetCode = street_id
this.store.mer_id = mer_id
}
2023-12-18 18:49:23 +08:00
},
storeLogin(obj) {
this.userInfo.user = obj
2023-12-11 18:35:55 +08:00
}
2023-12-08 18:51:02 +08:00
}
})