代客下单修改,登录页面修改,部分页面调整,请求封装调整

This commit is contained in:
2025-11-27 18:02:28 +08:00
parent f9cc02e93f
commit 3bb09ef0b1
45 changed files with 4934 additions and 1054 deletions

47
stores/account.js Normal file
View File

@@ -0,0 +1,47 @@
import { defineStore } from "pinia";
import { shopStaffInfo } from "@/http/yskApi/account/shopStaff";
import { login, getCodeImg } from "@/http/yskApi/login.js";
export const useAccountStore = defineStore("account", {
state: () => {
return {
shopInfo: {},
//员工信息
shopStaff: {},
//员工账号
staffUserName: "",
loginInfo: {},
tokenInfo: {},
shopId: "",
loginType: "",
};
},
getters: {},
actions: {
//获取员工信息
async getShopStaffInfo() {
const res = await shopStaffInfo();
if (res) {
this.shopStaffInfo = res;
}
},
async login(params) {
const res = await login(params);
if (res) {
this.loginInfo = res;
this.shopInfo = res.shopInfo;
this.tokenInfo = res.tokenInfo;
this.shopId = res.shopInfo.id;
this.loginType = res.loginType;
this.shopStaff = res.shopStaff;
this.staffUserName = params.staffUserName
uni.setStorageSync("shopInfo", res.shopInfo);
uni.setStorageSync("tokenInfo", res.tokenInfo);
uni.setStorageSync("shopId", res.shopInfo.id);
uni.setStorageSync("loginType", res.loginType);
}
return res;
},
},
unistorage: true, // 开启后对 state 的数据读写都将持久化
});