From 0e644c507fc220134b2e429d1933ef29abf9059d Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Mon, 24 Feb 2025 09:51:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=99=BB=E5=BD=95=EF=BC=8C?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=88=B7=E6=96=B0=E8=8E=B7=E5=8F=96=E5=BA=97?= =?UTF-8?q?=E9=93=BA=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/account/shop.ts | 213 ++++++++++++++++++++++++++++++++++++++ src/store/modules/user.ts | 8 +- src/views/login/index.vue | 2 +- 3 files changed, 220 insertions(+), 3 deletions(-) diff --git a/src/api/account/shop.ts b/src/api/account/shop.ts index 225dca8..45ecba8 100644 --- a/src/api/account/shop.ts +++ b/src/api/account/shop.ts @@ -24,9 +24,23 @@ const ShopApi = { data, }); }, + get(params: getRequest) { + return request({ + url: `${baseURL}/detail`, + method: "get", + params + }); + } }; export default ShopApi; +export interface getRequest { + /** + * 店铺id,可不传,不传递则为获取当前用户店铺 + */ + id?: string | number; + [property: string]: any; +} /** * ShopInfoEditDTO @@ -58,3 +72,202 @@ export interface PageQuery { status?: number; [property: string]: any; } + + +/** +* ShopInfo +*/ +export interface ShopInfo { + /** + * 详细地址 + */ + address?: null | string; + /** + * 项目分类 + */ + article?: null | string; + /** + * 背景图 + */ + backImg?: null | string; + /** + * 开票系统账号 + */ + bindAccount?: null | string; + /** + * 台桌预订短信 + */ + bookingSms?: null | string; + /** + * 营业时间(周结束) + */ + businessEndDay?: null | string; + /** + * 营业时间(周开始) + */ + businessStartDay?: null | string; + /** + * 营业时间 + */ + businessTime?: null | string; + /** + * 连锁店扩展店名 + */ + chainName?: null | string; + /** + * 市 + */ + cities?: null | string; + /** + * 积分群体 all-所有 vip-仅针对会员 + */ + consumeColony?: null | string; + /** + * 联系人姓名 + */ + contactName?: null | string; + /** + * 封面图 + */ + coverImg?: null | string; + createTime?: null | string; + /** + * 店铺简介 + */ + detail?: null | string; + /** + * 区/县 + */ + districts?: null | string; + /** + * 就餐模式 堂食 dine-in 外带 take-out + */ + eatModel?: null | string; + /** + * 到期时间 + */ + expireTime?: null | string; + /** + * 门头照 + */ + frontImg?: null | string; + /** + * 使用系统用户 sys_user id + */ + id?: number | null; + /** + * 是否开启会员余额支付 + */ + isAccountPay?: number | null; + /** + * 是否允许会员自定义金额 1 允许 0 不允许 + */ + isCustomAmount?: number | null; + /** + * 是否开启会员充值密码 1 启用 0 禁用 + */ + isMemberInPwd?: number | null; + /** + * 是否启用会员价 0否1是 + */ + isMemberPrice?: number | null; + /** + * 是否开启会员退款密码 1 启用 0 禁用 + */ + isMemberReturnPwd?: number | null; + /** + * 是否开启退款密码 1 启用 0 禁用 + */ + isReturnPwd?: number | null; + /** + * 是否免除桌位费 0否1是 + */ + isTableFee?: number | null; + /** + * 经纬度 + */ + lat?: null | string; + /** + * 经纬度 + */ + lng?: null | string; + /** + * 店铺logo + */ + logo?: null | string; + /** + * 主店id + */ + mainId?: number | null; + /** + * 0停业 1,正常营业 2,网上售卖 + */ + onSale?: number | null; + /** + * 操作密码 + */ + operationPwd?: null | string; + /** + * 店铺收款码 + */ + paymentQrcode?: null | string; + /** + * 联系电话 + */ + phone?: null | string; + /** + * trial试用版,release正式 + */ + profiles?: null | string; + /** + * 省 + */ + provinces?: null | string; + registerType?: null | string; + /** + * 数电发票类型 + */ + sdType?: null | string; + /** + * 店铺名称 + */ + shopName?: null | string; + /** + * 商家二维码 + */ + shopQrcode?: null | string; + /** + * 店铺类型 单店--only 连锁店--chain--加盟店join (对应原来 type) + */ + shopType?: null | string; + /** + * 小程序码(零点八零首页) + */ + smallQrcode?: null | string; + /** + * -1 平台禁用 0-过期,1正式营业, + */ + status?: number | null; + /** + * 店铺口号 + */ + subTitle?: null | string; + /** + * 桌位费 + */ + tableFee?: number | null; + /** + * 商家标签 + */ + tag?: null | string; + /** + * 税率 + */ + taxAmount?: null | string; + /** + * 管理 0否 1是, 1 为直接管理 可切换店铺 0 不可以切换 + */ + tubeType?: number | null; + updateTime?: null | string; + [property: string]: any; +} \ No newline at end of file diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 28fc8e4..ad8fac9 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -3,6 +3,7 @@ import { usePermissionStoreHook } from "@/store/modules/permission"; import { useDictStoreHook } from "@/store/modules/dict"; import AuthAPI, { type loginRequest } from "@/api/account/login"; +import ShopApi from "@/api/account/shop"; import UserAPI, { type UserInfo } from "@/api/system/user"; import { setToken, setRefreshToken, getRefreshToken, clearToken } from "@/utils/auth"; @@ -12,7 +13,9 @@ export const useUserStore = defineStore("user", () => { const promissionList = useStorage("promissionList", [] as string[]); localStorage.setItem("shopId", "" + userInfo.value.shopId); - + if (userInfo.value.shopId) { + getUserInfo() + } /** * 登录 * @@ -43,13 +46,14 @@ export const useUserStore = defineStore("user", () => { */ function getUserInfo() { return new Promise((resolve, reject) => { - UserAPI.getInfo(userInfo.value.shopId) + ShopApi.get({ id: userInfo.value.shopId }) .then((data) => { if (!data) { reject("Verification failed, please Login again."); return; } localStorage.setItem("shopId", "" + userInfo.value.shopId); + console.log("获取用户信息", data); Object.assign(userInfo.value, { ...data }); resolve(data); }) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 3c33e78..136b833 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -181,7 +181,7 @@ function handleLogin() { userStore .login(user) .then(async (res) => { - // await userStore.getUserInfo(); + await userStore.getUserInfo(); const { path, queryParams } = parseRedirect(); console.log(res, "Denglv返回"); router.push({ path: path, query: queryParams });