jmash-core-mp 0.1.53 → 0.1.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,57 @@
1
+ export interface ShopInfoModel {
2
+ shopId?: string;
3
+ shopName?: string;
4
+ shopType?: boolean;
5
+ contacts?: string;
6
+ mobilePhone?: string;
7
+ mobilePhoneIns?: string;
8
+ picUrl?: string;
9
+ city?: string;
10
+ country?: string;
11
+ province?: string;
12
+ address?: string;
13
+ longitude?: string;
14
+ latitude?: string;
15
+ note?: string;
16
+ businessPicUrl?: string;
17
+ idCard?: string;
18
+ idCardIns?: string;
19
+ mchName?: string;
20
+ bankName?: string;
21
+ bankCode?: string;
22
+ bankCodeIns?: string;
23
+ status?: boolean;
24
+ businessId?: string;
25
+ regionCode?: string;
26
+ adPics?: string;
27
+ accountName?: string;
28
+ organId?: string;
29
+ organTenant?: string;
30
+ }
31
+ export interface BranchModel {
32
+ tenantId?: string;
33
+ branchId?: string;
34
+ shopId?: string;
35
+ facadeName?: string;
36
+ isHq?: boolean;
37
+ contacts?: string;
38
+ mobilePhone?: string;
39
+ mobilePhoneIns?: string;
40
+ businessPicUrl?: string;
41
+ picUrl?: string;
42
+ regionCode?: string;
43
+ regionName?: string;
44
+ address?: string;
45
+ longitude?: string;
46
+ latitude?: string;
47
+ note?: string;
48
+ businessStartHour?: string;
49
+ businessEndHour?: string;
50
+ status?: boolean;
51
+ createBy?: string;
52
+ createTime?: string;
53
+ category?: string;
54
+ isBusiness?: boolean;
55
+ distanceMeter?: string;
56
+ organTenant?: string;
57
+ }
@@ -0,0 +1 @@
1
+ export {};
package/lib/index.d.ts CHANGED
@@ -6,12 +6,14 @@ export { EntryDict, EnumDict, EntryLayDict, CustomBizDict } from "./api/dicts";
6
6
  export type { FileInfo, FileBase64Req, FileDownInfo, FileWebReq, } from "./api/files/types";
7
7
  export type { DictRegionList, DictRegionReq, DictRegionModel, } from "./api/region/types";
8
8
  export type { StorageOrganInfoReq, StorageOrganInfoList, StorageOrganInfoModel, ShopBrowserUserList, ShopBrowserUserModel, StorageOrganBrowserUpdateReq, StorageOrganBrowserModel, } from "./api/storage/types";
9
+ export type { ShopInfoModel, BranchModel } from "./api/shop/types";
9
10
  export { mpxFetch } from "./utils/request";
10
11
  export { config, initConfig, setConfig } from "./utils/config";
11
12
  export { grpc } from "./utils/grpc";
12
13
  export { db } from "./utils/db";
13
14
  export { useUserStore } from "./store/user";
14
15
  export { useOrganStore } from "./store/organ";
16
+ export { useShopStore } from "./store/shop";
15
17
  export { authApi } from "./api/auth";
16
18
  export { cmsApi } from "./api/cms";
17
19
  export { dictApi } from "./api/dict";
package/lib/index.js CHANGED
@@ -6,6 +6,7 @@ export { grpc } from "./utils/grpc";
6
6
  export { db } from "./utils/db";
7
7
  export { useUserStore } from "./store/user";
8
8
  export { useOrganStore } from "./store/organ";
9
+ export { useShopStore } from "./store/shop";
9
10
  export { authApi } from "./api/auth";
10
11
  export { cmsApi } from "./api/cms";
11
12
  export { dictApi } from "./api/dict";
@@ -0,0 +1,13 @@
1
+ import type { ShopInfoModel } from "../api/shop/types";
2
+ import type { BranchModel } from "../api/shop/types";
3
+ interface ShopState {
4
+ shopInfo: ShopInfoModel;
5
+ branchInfo: BranchModel;
6
+ isShop: boolean;
7
+ }
8
+ export declare const useShopStore: import("@mpxjs/pinia").StoreDefinition<"shop", ShopState, {}, {
9
+ switchShopBranch(shopInfo: ShopInfoModel, branchInfo: BranchModel): void;
10
+ switchShop(shopInfo: ShopInfoModel): void;
11
+ switchBranch(branchInfo: BranchModel): void;
12
+ }>;
13
+ export {};
@@ -0,0 +1,41 @@
1
+ import { defineStore } from "@mpxjs/pinia";
2
+ import { db } from "../utils/db";
3
+ export const useShopStore = defineStore("shop", {
4
+ state: () => ({
5
+ shopInfo: db.getShopInfo() || {},
6
+ branchInfo: db.getBranchInfo() || {},
7
+ isShop: db.getIsShop() || false,
8
+ }),
9
+ actions: {
10
+ // 切换商户门店
11
+ switchShopBranch(shopInfo, branchInfo) {
12
+ this.shopInfo = shopInfo;
13
+ this.branchInfo = branchInfo;
14
+ this.isShop = false;
15
+ // 切换商户门店
16
+ db.setShopInfo(shopInfo);
17
+ db.setBranchInfo(branchInfo);
18
+ db.setIsShop(false);
19
+ },
20
+ // 切换商户
21
+ switchShop(shopInfo) {
22
+ this.shopInfo = shopInfo;
23
+ this.branchInfo = {};
24
+ this.isShop = true;
25
+ // 切换商户
26
+ db.setShopInfo(shopInfo);
27
+ db.setBranchInfo({});
28
+ db.setIsShop(true);
29
+ },
30
+ // 切换门店
31
+ switchBranch(branchInfo) {
32
+ this.shopInfo = {};
33
+ this.branchInfo = branchInfo;
34
+ this.isShop = false;
35
+ // 切换门店
36
+ db.setShopInfo({});
37
+ db.setBranchInfo(branchInfo);
38
+ db.setIsShop(false);
39
+ },
40
+ },
41
+ });
package/lib/utils/db.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { TokenModel, UserInfo } from "../api/auth/types";
2
2
  import { StorageOrganInfoModel } from "../api/storage/types";
3
+ import { ShopInfoModel, BranchModel } from "../api/shop/types";
3
4
  declare class LocalStorage {
4
5
  getToken(): string;
5
6
  getUserTenant(): string;
@@ -30,6 +31,12 @@ declare class LocalStorage {
30
31
  setOrganTenant(organTenant: string): void;
31
32
  getOrganInfo(): StorageOrganInfoModel;
32
33
  setOrganInfo(data: StorageOrganInfoModel): void;
34
+ getShopInfo(): ShopInfoModel;
35
+ setShopInfo(data: ShopInfoModel): void;
36
+ getBranchInfo(): BranchModel;
37
+ setBranchInfo(data: BranchModel): void;
38
+ getIsShop(): boolean;
39
+ setIsShop(isShop: boolean): void;
33
40
  }
34
41
  declare const db: LocalStorage;
35
42
  export { db };
package/lib/utils/db.js CHANGED
@@ -113,6 +113,30 @@ class LocalStorage {
113
113
  setOrganInfo(data) {
114
114
  mpx.setStorageSync("organInfo", data);
115
115
  }
116
+ // 获取商铺信息
117
+ getShopInfo() {
118
+ return mpx.getStorageSync("shopInfo");
119
+ }
120
+ // 设置商铺信息
121
+ setShopInfo(data) {
122
+ mpx.setStorageSync("shopInfo", data);
123
+ }
124
+ // 获取门店信息
125
+ getBranchInfo() {
126
+ return mpx.getStorageSync("branchInfo");
127
+ }
128
+ // 设置门店信息
129
+ setBranchInfo(data) {
130
+ mpx.setStorageSync("branchInfo", data);
131
+ }
132
+ // 获取是否是商户
133
+ getIsShop() {
134
+ return mpx.getStorageSync("isShop");
135
+ }
136
+ // 设置是否是商户
137
+ setIsShop(isShop) {
138
+ mpx.setStorageSync("isShop", isShop);
139
+ }
116
140
  }
117
141
  const db = new LocalStorage();
118
142
  export { db };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmash-core-mp",
3
- "version": "0.1.53",
3
+ "version": "0.1.55",
4
4
  "private": false,
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -0,0 +1,113 @@
1
+ // 店铺管理实体
2
+ export interface ShopInfoModel {
3
+ // 店铺ID
4
+ shopId?: string;
5
+ // 店铺名称
6
+ shopName?: string;
7
+ // 是否自营
8
+ shopType?: boolean;
9
+ // 联系人
10
+ contacts?: string;
11
+ // 联系电话
12
+ mobilePhone?: string;
13
+ // 联系电话脱敏
14
+ mobilePhoneIns?: string;
15
+ // 店铺图片
16
+ picUrl?: string;
17
+ // 所在城市
18
+ city?: string;
19
+ // 所在国家
20
+ country?: string;
21
+ // 所在省份
22
+ province?: string;
23
+ // 详细地址
24
+ address?: string;
25
+ // 经度
26
+ longitude?: string;
27
+ // 纬度
28
+ latitude?: string;
29
+ // 店铺介绍
30
+ note?: string;
31
+ // 营业执照
32
+ businessPicUrl?: string;
33
+ // 法人身份证
34
+ idCard?: string;
35
+ // 法人身份证脱敏
36
+ idCardIns?: string;
37
+ // 商户名称
38
+ mchName?: string;
39
+ // 开户行
40
+ bankName?: string;
41
+ // 银行账号
42
+ bankCode?: string;
43
+ // 银行账号脱敏
44
+ bankCodeIns?: string;
45
+ // 状态
46
+ status?: boolean;
47
+ // 商户ID
48
+ businessId?: string;
49
+ // 地区编码
50
+ regionCode?: string;
51
+ // 店铺广告位图片
52
+ adPics?: string;
53
+ // 账号名称
54
+ accountName?: string;
55
+ // 组织ID
56
+ organId?: string;
57
+ // 组织租户
58
+ organTenant?: string;
59
+ }
60
+
61
+ // 门店管理实体
62
+ export interface BranchModel {
63
+ // 租户ID
64
+ tenantId?: string;
65
+ // 门店ID
66
+ branchId?: string;
67
+ // 店铺ID
68
+ shopId?: string;
69
+ // 门店名称
70
+ facadeName?: string;
71
+ // 是否是总部
72
+ isHq?: boolean;
73
+ // 联系人
74
+ contacts?: string;
75
+ // 联系电话
76
+ mobilePhone?: string;
77
+ // 联系电话脱敏
78
+ mobilePhoneIns?: string;
79
+ // 营业执照
80
+ businessPicUrl?: string;
81
+ // 门店图片
82
+ picUrl?: string;
83
+ // 地区编码
84
+ regionCode?: string;
85
+ // 地区名称
86
+ regionName?: string;
87
+ // 详细地址
88
+ address?: string;
89
+ // 经度
90
+ longitude?: string;
91
+ // 纬度
92
+ latitude?: string;
93
+ // 门店介绍
94
+ note?: string;
95
+ // 营业开始时间
96
+ businessStartHour?: string;
97
+ // 营业结束时间
98
+ businessEndHour?: string;
99
+ // 状态
100
+ status?: boolean;
101
+ // 创建人
102
+ createBy?: string;
103
+ // 创建时间
104
+ createTime?: string;
105
+ // 门店分类
106
+ category?: string;
107
+ // 是否营业
108
+ isBusiness?: boolean;
109
+ // 距离米
110
+ distanceMeter?: string;
111
+ // 组织租户
112
+ organTenant?: string;
113
+ }
package/src/index.ts CHANGED
@@ -54,6 +54,7 @@ export type {
54
54
  StorageOrganBrowserUpdateReq,
55
55
  StorageOrganBrowserModel,
56
56
  } from "./api/storage/types";
57
+ export type { ShopInfoModel, BranchModel } from "./api/shop/types";
57
58
 
58
59
  export { mpxFetch } from "./utils/request";
59
60
  export { config, initConfig, setConfig } from "./utils/config";
@@ -62,6 +63,7 @@ export { grpc } from "./utils/grpc";
62
63
  export { db } from "./utils/db";
63
64
  export { useUserStore } from "./store/user";
64
65
  export { useOrganStore } from "./store/organ";
66
+ export { useShopStore } from "./store/shop";
65
67
  export { authApi } from "./api/auth";
66
68
  export { cmsApi } from "./api/cms";
67
69
  export { dictApi } from "./api/dict";
@@ -0,0 +1,54 @@
1
+ import { defineStore } from "@mpxjs/pinia";
2
+ import type { ShopInfoModel } from "../api/shop/types";
3
+ import type { BranchModel } from "../api/shop/types";
4
+ import { db } from "../utils/db";
5
+
6
+ // 商户状态
7
+ interface ShopState {
8
+ //商户信息
9
+ shopInfo: ShopInfoModel;
10
+ //门店信息
11
+ branchInfo: BranchModel;
12
+ //是否是商户
13
+ isShop: boolean;
14
+ }
15
+
16
+ export const useShopStore = defineStore("shop", {
17
+ state: (): ShopState => ({
18
+ shopInfo: db.getShopInfo() || {},
19
+ branchInfo: db.getBranchInfo() || {},
20
+ isShop: db.getIsShop() || false,
21
+ }),
22
+ actions: {
23
+ // 切换商户门店
24
+ switchShopBranch(shopInfo: ShopInfoModel, branchInfo: BranchModel) {
25
+ this.shopInfo = shopInfo;
26
+ this.branchInfo = branchInfo;
27
+ this.isShop = false;
28
+ // 切换商户门店
29
+ db.setShopInfo(shopInfo);
30
+ db.setBranchInfo(branchInfo);
31
+ db.setIsShop(false);
32
+ },
33
+ // 切换商户
34
+ switchShop(shopInfo: ShopInfoModel) {
35
+ this.shopInfo = shopInfo;
36
+ this.branchInfo = {};
37
+ this.isShop = true;
38
+ // 切换商户
39
+ db.setShopInfo(shopInfo);
40
+ db.setBranchInfo({});
41
+ db.setIsShop(true);
42
+ },
43
+ // 切换门店
44
+ switchBranch(branchInfo: BranchModel) {
45
+ this.shopInfo = {};
46
+ this.branchInfo = branchInfo;
47
+ this.isShop = false;
48
+ // 切换门店
49
+ db.setShopInfo({});
50
+ db.setBranchInfo(branchInfo);
51
+ db.setIsShop(false);
52
+ },
53
+ },
54
+ });
package/src/utils/db.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import mpx from "@mpxjs/core";
2
2
  import type { TokenModel, UserInfo } from "../api/auth/types";
3
3
  import { StorageOrganInfoModel } from "../api/storage/types";
4
+ import { ShopInfoModel, BranchModel } from "../api/shop/types";
4
5
 
5
6
  // 本地存储
6
7
  class LocalStorage {
@@ -132,6 +133,31 @@ class LocalStorage {
132
133
  setOrganInfo(data: StorageOrganInfoModel) {
133
134
  mpx.setStorageSync("organInfo", data);
134
135
  }
136
+
137
+ // 获取商铺信息
138
+ getShopInfo(): ShopInfoModel {
139
+ return mpx.getStorageSync("shopInfo");
140
+ }
141
+ // 设置商铺信息
142
+ setShopInfo(data: ShopInfoModel) {
143
+ mpx.setStorageSync("shopInfo", data);
144
+ }
145
+ // 获取门店信息
146
+ getBranchInfo(): BranchModel {
147
+ return mpx.getStorageSync("branchInfo");
148
+ }
149
+ // 设置门店信息
150
+ setBranchInfo(data: BranchModel) {
151
+ mpx.setStorageSync("branchInfo", data);
152
+ }
153
+ // 获取是否是商户
154
+ getIsShop(): boolean {
155
+ return mpx.getStorageSync("isShop");
156
+ }
157
+ // 设置是否是商户
158
+ setIsShop(isShop: boolean): void {
159
+ mpx.setStorageSync("isShop", isShop);
160
+ }
135
161
  }
136
162
 
137
163
  const db = new LocalStorage();