You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
117 lines
3.2 KiB
JavaScript
117 lines
3.2 KiB
JavaScript
import {
|
|
defineStore
|
|
} from 'pinia';
|
|
|
|
export const useStore = defineStore('counter', {
|
|
state: () => ({
|
|
user: {},
|
|
tjbgInfo: [],
|
|
yytjInfo: {},
|
|
config: false,
|
|
groupInfo: {}, // 团检信息
|
|
combo_compare: [], // 套餐对比
|
|
duo_xuan_yi: [], // 多选一
|
|
save: {
|
|
hospital: 1,
|
|
doctor: 1,
|
|
},
|
|
checkup_type: {
|
|
id: ""
|
|
}, // 预约类型
|
|
api_map: {},
|
|
count: 0,
|
|
loading: 0,
|
|
buyInfo: {}, // 购买信息接口配置 预约页面使用 别的地方最好不要用
|
|
}),
|
|
actions: {
|
|
setComboContrast(comboContrast) {
|
|
this.combo_compare = comboContrast;
|
|
uni.setStorageSync('COMBO_CONTRAST', JSON.stringify(this.combo_compare));
|
|
},
|
|
getComboContrast() {
|
|
return JSON.parse(uni.getStorageSync('COMBO_CONTRAST') || '[]') || this.combo_compare;
|
|
},
|
|
setDuoXuanYi(duoXuanYi) {
|
|
this.duo_xuan_yi = duoXuanYi;
|
|
uni.setStorageSync('DUO_XUAN_YI', JSON.stringify(duoXuanYi))
|
|
},
|
|
getDuoXuanYi() {
|
|
return JSON.parse(uni.getStorageSync('DUO_XUAN_YI') || '[]') || this.duo_xuan_yi;
|
|
},
|
|
setTjbgInfo(tjbgInfo) {
|
|
this.tjbgInfo = tjbgInfo;
|
|
uni.setStorageSync('TJBG_INFO', JSON.stringify(tjbgInfo));
|
|
},
|
|
getTjbgInfo() {
|
|
console.log(uni.getStorageSync('TJBG_INFO'))
|
|
return JSON.parse(uni.getStorageSync('TJBG_INFO') || '[]') || this.tjbgInfo;
|
|
},
|
|
getCheckupTypeId() {
|
|
return JSON.parse(uni.getStorageSync('CHECKUP_TYPE') || '{}') || this.checkup_type;
|
|
},
|
|
setCheckupTypeId(data) {
|
|
this.checkup_type = data;
|
|
uni.setStorageSync('CHECKUP_TYPE', JSON.stringify(data));
|
|
},
|
|
setBuyInfo(info) {
|
|
this.buyInfo = info;
|
|
console.log(info);
|
|
uni.setStorageSync('BUY_INFO', JSON.stringify(info));
|
|
},
|
|
getBuyInfo() {
|
|
console.log(uni.getStorageSync('BUY_INFO'));
|
|
return JSON.parse(uni.getStorageSync('BUY_INFO') || "{}") || this.buyInfo;
|
|
},
|
|
setYytjInfo(yytjInfo) {
|
|
this.yytjInfo = yytjInfo;
|
|
uni.setStorageSync('YYTJ_INFO', JSON.stringify(yytjInfo));
|
|
},
|
|
getYytjInfo() {
|
|
console.log(uni.getStorageSync('YYTJ_INFO'));
|
|
return JSON.parse(uni.getStorageSync('YYTJ_INFO') || '{}') || this.yytjInfo;
|
|
},
|
|
setUser(user) {
|
|
this.user = user;
|
|
uni.setStorageSync('USER', JSON.stringify(user));
|
|
},
|
|
getUser() {
|
|
return JSON.parse(uni.getStorageSync('USER') || '{}') || this.user;
|
|
},
|
|
//配偶信息
|
|
setPeiOuUser(user) {
|
|
this.user = user;
|
|
uni.setStorageSync('PEIOU', JSON.stringify(user));
|
|
},
|
|
//获取配偶信息
|
|
getPeiOuUser() {
|
|
return JSON.parse(uni.getStorageSync('PEIOU') || '{}') || this.user;
|
|
},
|
|
setGroupInfo(info) {
|
|
this.groupInfo = info;
|
|
uni.setStorageSync('GROUP_INFO', JSON.stringify(info));
|
|
},
|
|
getGroupInfo() {
|
|
return JSON.parse(uni.getStorageSync('GROUP_INFO') || '{}') || this.groupInfo;
|
|
},
|
|
resetSaveInfo() {
|
|
this.save = {
|
|
hospital: 1,
|
|
doctor: 1,
|
|
}
|
|
uni.setStorageSync('SAVE_INFO', JSON.stringify(this.save))
|
|
},
|
|
saveInfo(data) {
|
|
for (let i in data) {
|
|
this.save[i] = data[i]
|
|
}
|
|
uni.setStorageSync('SAVE_INFO', JSON.stringify(this.save))
|
|
},
|
|
loadingStart() {
|
|
this.loading++
|
|
},
|
|
loadingDone() {
|
|
this.loading--
|
|
if (this.loading < 0) this.loading = 0
|
|
}
|
|
},
|
|
}); |