jmash-core-mp 0.1.58 → 0.1.60

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.
@@ -1,7 +1,8 @@
1
1
  import { ResponseData } from "../../api/types";
2
- import { BranchPage, BranchPageReq } from "./types";
2
+ import { BranchPage, BranchPageReq, ShopInfoModel } from "./types";
3
3
  declare class ShopApiImpl {
4
4
  findShopBranchPage(data: BranchPageReq): Promise<ResponseData<BranchPage>>;
5
+ findShopInfoById(organTenant: string): Promise<ResponseData<ShopInfoModel>>;
5
6
  }
6
7
  declare const shopApi: ShopApiImpl;
7
8
  export { shopApi };
@@ -11,6 +11,13 @@ class ShopApiImpl {
11
11
  header: { Authorization: false },
12
12
  });
13
13
  }
14
+ // 查询店铺管理
15
+ findShopInfoById(organTenant) {
16
+ return mpx.xfetch.fetch({
17
+ url: "/v1/front/shop/info/shop_info/" + organTenant,
18
+ method: "GET",
19
+ });
20
+ }
14
21
  }
15
22
  const shopApi = new ShopApiImpl();
16
23
  export { shopApi };
@@ -27,6 +27,8 @@ export interface ShopInfoModel {
27
27
  accountName?: string;
28
28
  organId?: string;
29
29
  organTenant?: string;
30
+ createBy?: string;
31
+ createTime?: string;
30
32
  }
31
33
  export interface BranchModel {
32
34
  tenantId?: string;
@@ -6,8 +6,8 @@ interface ShopState {
6
6
  isShop: boolean;
7
7
  }
8
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;
9
+ switchShopBranch(shopInfo: ShopInfoModel, branchInfo: BranchModel): Promise<boolean>;
10
+ switchShop(shopInfo: ShopInfoModel): Promise<boolean>;
11
+ switchBranch(branchInfo: BranchModel): Promise<boolean>;
12
12
  }>;
13
13
  export {};
package/lib/store/shop.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { defineStore } from "@mpxjs/pinia";
2
2
  import { db } from "../utils/db";
3
+ import { useOrganStore } from "./organ";
3
4
  export const useShopStore = defineStore("shop", {
4
5
  state: () => ({
5
6
  shopInfo: db.getShopInfo() || {},
@@ -16,6 +17,8 @@ export const useShopStore = defineStore("shop", {
16
17
  db.setShopInfo(shopInfo);
17
18
  db.setBranchInfo(branchInfo);
18
19
  db.setIsShop(false);
20
+ const organStore = useOrganStore();
21
+ return organStore.setOrganTenant(branchInfo.organTenant || "");
19
22
  },
20
23
  // 切换商户
21
24
  switchShop(shopInfo) {
@@ -26,6 +29,8 @@ export const useShopStore = defineStore("shop", {
26
29
  db.setShopInfo(shopInfo);
27
30
  db.setBranchInfo({});
28
31
  db.setIsShop(true);
32
+ const organStore = useOrganStore();
33
+ return organStore.setOrganTenant(shopInfo.organTenant || "");
29
34
  },
30
35
  // 切换门店
31
36
  switchBranch(branchInfo) {
@@ -36,6 +41,8 @@ export const useShopStore = defineStore("shop", {
36
41
  db.setShopInfo({});
37
42
  db.setBranchInfo(branchInfo);
38
43
  db.setIsShop(false);
44
+ const organStore = useOrganStore();
45
+ return organStore.setOrganTenant(branchInfo.organTenant || "");
39
46
  },
40
47
  },
41
48
  });
package/lib/utils/db.js CHANGED
@@ -107,11 +107,13 @@ class LocalStorage {
107
107
  }
108
108
  //获取组织信息 TODO
109
109
  getOrganInfo() {
110
- return mpx.getStorageSync("organInfo") || {};
110
+ const config = getApp().globalData.config;
111
+ return mpx.getStorageSync("OrganInfo:" + config.tenant) || {};
111
112
  }
112
113
  //设置组织信息
113
114
  setOrganInfo(data) {
114
- mpx.setStorageSync("organInfo", data);
115
+ const config = getApp().globalData.config;
116
+ mpx.setStorageSync("OrganInfo:" + config.tenant, data);
115
117
  }
116
118
  // 获取商铺信息
117
119
  getShopInfo() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmash-core-mp",
3
- "version": "0.1.58",
3
+ "version": "0.1.60",
4
4
  "private": false,
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  import mpx from "@mpxjs/core";
2
2
  import { ResponseData } from "../../api/types";
3
- import { BranchPage, BranchPageReq } from "./types";
3
+ import { BranchPage, BranchPageReq, ShopInfoModel } from "./types";
4
4
 
5
5
  class ShopApiImpl {
6
6
  // 查询分页信息门店管理
@@ -14,6 +14,14 @@ class ShopApiImpl {
14
14
  header: { Authorization: false },
15
15
  });
16
16
  }
17
+
18
+ // 查询店铺管理
19
+ findShopInfoById(organTenant: string): Promise<ResponseData<ShopInfoModel>> {
20
+ return mpx.xfetch.fetch({
21
+ url: "/v1/front/shop/info/shop_info/" + organTenant,
22
+ method: "GET",
23
+ });
24
+ }
17
25
  }
18
26
 
19
27
  const shopApi = new ShopApiImpl();
@@ -56,6 +56,10 @@ export interface ShopInfoModel {
56
56
  organId?: string;
57
57
  // 组织租户
58
58
  organTenant?: string;
59
+ // 创建人
60
+ createBy?: string;
61
+ // 创建时间
62
+ createTime?: string;
59
63
  }
60
64
 
61
65
  // 门店管理实体
package/src/app.mpx CHANGED
@@ -35,6 +35,7 @@ createApp({
35
35
  "./pages/tabbar/my",
36
36
  "./pages/organ",
37
37
  "./pages/organ-search",
38
+ "./pages/shop-search",
38
39
  "./pages/branch-search",
39
40
  ],
40
41
  "packages": [
@@ -24,7 +24,6 @@ import mpx, { createComponent } from "@mpxjs/core";
24
24
  import type { EventBase } from "../../api/types";
25
25
  import type { BranchModel } from "../../api/shop/types";
26
26
  import { useShopStore } from "../../store/shop";
27
- import { useOrganStore } from "../../store/organ";
28
27
 
29
28
  createComponent({
30
29
  properties: {
@@ -49,11 +48,9 @@ createComponent({
49
48
  methods: {
50
49
  // 店铺详情
51
50
  handleInfo(e: EventBase) {
52
- console.log("选择门店", this.branchInfo);
51
+ //console.log("选择门店", this.branchInfo);
53
52
  const shopStore = useShopStore();
54
- const organStore = useOrganStore();
55
- shopStore.switchBranch(this.branchInfo as BranchModel);
56
- organStore.setOrganTenant(this.branchInfo.organTenant).then(() => {
53
+ shopStore.switchBranch(this.branchInfo as BranchModel).then(() => {
57
54
  if (this.defaultClick) {
58
55
  mpx.reLaunch({
59
56
  url: "/pages/tabbar/home"
@@ -43,7 +43,7 @@ createComponent({
43
43
  // 搜索框占位符
44
44
  placeholder: {
45
45
  type: String,
46
- value: "搜索店铺"
46
+ value: "搜索门店"
47
47
  },
48
48
  // 是否默认点击跳转
49
49
  defaultClick: {
@@ -0,0 +1,118 @@
1
+ /**
2
+ * 组织组件
3
+ * @props organInfo 组织信息
4
+ * @props defaultClick 是否默认点击跳转
5
+ * @events click 组织详情事件,参数为组织信息
6
+ */
7
+ <template>
8
+ <view class="organ-item" data-id="{{ organInfo.storageId }}" data-tenant="{{ organInfo.organTenant }}"
9
+ bind:tap="handleInfo">
10
+ <image wx:if="{{ baseUrl && organInfo.logoUrl }}" class="organ-logo" src="{{ baseUrl + organInfo.logoUrl }}"
11
+ mode="aspectFit" />
12
+ <image wx:if="{{ resourceUrl && !organInfo.logoUrl }}" class="organ-logo"
13
+ src="{{ resourceUrl + 'gray_logo_upload.png' }}" mode="aspectFit" />
14
+ <view class="organ-item-right">
15
+ <view class="organ-item-title">
16
+ <text class="organ-title-c">{{ organInfo.organName }}</text>
17
+ <text>{{ organInfo.createTime }}</text>
18
+ </view>
19
+ <view>{{ organInfo.remark }}</view>
20
+ </view>
21
+ </view>
22
+ </template>
23
+
24
+ <script lang="ts">
25
+ import mpx, { createComponent } from "@mpxjs/core";
26
+ import type { EventBase } from "../../api/types";
27
+ import { useShopStore } from "../../store/shop";
28
+ import { shopApi } from "../../api/shop/index";
29
+
30
+ createComponent({
31
+ properties: {
32
+ // 组织信息
33
+ organInfo: {
34
+ type: Object,
35
+ value: {}
36
+ },
37
+ defaultClick: {
38
+ type: Boolean,
39
+ value: true
40
+ }
41
+ },
42
+ setup() {
43
+ const config = getApp().globalData.config;
44
+ // 资源路径
45
+ let resourceUrl = config.resourceUrl + "/images/components/";
46
+ // 图片路径
47
+ let baseUrl = config.baseUrl + "/v1/file/image/resize/100/100/";
48
+ return { resourceUrl, baseUrl }
49
+ },
50
+ methods: {
51
+ // 店铺详情
52
+ handleInfo(e: EventBase) {
53
+ console.log("选择店铺", this.organInfo);
54
+ const shopStore = useShopStore();
55
+ shopApi.findShopInfoById(this.organInfo.organTenant).then((res) => {
56
+ if (res.statusCode === 200) {
57
+ shopStore.switchShop(res.data).then(() => {
58
+ if (this.defaultClick) {
59
+ mpx.reLaunch({
60
+ url: "/pages/tabbar/home"
61
+ });
62
+ }
63
+ this.triggerEvent("click", res.data);
64
+ });
65
+ }
66
+ });
67
+ }
68
+ }
69
+ })
70
+ </script>
71
+
72
+ <style lang="scss">
73
+ @use "../../styles/index.scss" as *;
74
+
75
+ .organ-item {
76
+ background-color: $white-color;
77
+ border-radius: $border-radius;
78
+ padding: 20rpx 30rpx;
79
+ display: flex;
80
+ align-items: center;
81
+ gap: 20rpx;
82
+ margin-bottom: 20rpx;
83
+ box-shadow: 0 8rpx 24rpx 0 rgba(44, 19, 19, 0.08);
84
+ }
85
+
86
+ .organ-logo {
87
+ width: 80rpx;
88
+ height: 80rpx;
89
+ }
90
+
91
+ .organ-item-right {
92
+ width: 90%;
93
+ display: flex;
94
+ flex-direction: column;
95
+ gap: 10rpx;
96
+ color: $font-color-grey;
97
+ font-size: $font-size-mini;
98
+ font-weight: 400;
99
+
100
+ .organ-item-title {
101
+ display: flex;
102
+ justify-content: space-between;
103
+
104
+ .organ-title-c {
105
+ color: $font-color;
106
+ font-size: $font-size;
107
+ font-weight: bold;
108
+ }
109
+ }
110
+ }
111
+ </style>
112
+
113
+ <script type="application/json">
114
+ {
115
+ "component": true,
116
+ "usingComponents": {}
117
+ }
118
+ </script>
@@ -0,0 +1,148 @@
1
+ /**
2
+ * 店铺搜索组件
3
+ * @param top 顶部安全距离(px)Number 默认0
4
+ * @param placeholder 搜索框占位符 String 默认"搜索店铺"
5
+ * @events click 店铺点击事件,参数为当前店铺租户 tenant
6
+ */
7
+ <template>
8
+ <view class="organ-main" style="margin-top: {{ top }}px; height: calc(100vh - 100px - {{ top }}px);">
9
+ <!-- 搜索框 -->
10
+ <view class="search-box">
11
+ <jmash-search placeholder="{{ placeholder }}" isSearchBtn="{{ true }}"
12
+ likeName="{{ queryParams.likeOrganName }}" bind:handleSearch="searchEvent">
13
+ <button class="search-right" bind:tap="querySearchStorageList">搜索</button>
14
+ </jmash-search>
15
+ </view>
16
+ <!-- 搜索店铺列表 -->
17
+ <scroll-view class="organ-content-h" scroll-y>
18
+ <view class="organ-content">
19
+ <view wx:if="{{ mySearchList.length > 0 }}">
20
+ <shop-item wx:for="{{ mySearchList }}" wx:key="index" organInfo="{{ item }}"
21
+ defaultClick="{{ defaultClick }}" bind:click="handleItemClick" />
22
+ </view>
23
+ <jmash-none-data wx:else imgUrl="/mall/no-data.png" content="暂无搜索内容" contentColor="#5A94F1" />
24
+ </view>
25
+ </scroll-view>
26
+ </view>
27
+ </template>
28
+
29
+ <script lang="ts">
30
+ import { createComponent, ref } from "@mpxjs/core";
31
+ import { formatDateTime } from "../../utils/common";
32
+ import type { StorageOrganInfoModel } from "../../api/storage/types";
33
+ import { storageApi } from "../../api/storage/index";
34
+ import type { EventBase } from "../../api/types";
35
+
36
+ createComponent({
37
+ properties: {
38
+ // 顶部安全距离
39
+ top: {
40
+ type: Number,
41
+ value: 0
42
+ },
43
+ // 搜索框占位符
44
+ placeholder: {
45
+ type: String,
46
+ value: "搜索店铺"
47
+ },
48
+ // 服务类型
49
+ serviceType: {
50
+ type: String,
51
+ value: "mall"
52
+ },
53
+ // 是否默认点击跳转
54
+ defaultClick: {
55
+ type: Boolean,
56
+ value: true
57
+ }
58
+ },
59
+ setup(props) {
60
+ // 搜索参数
61
+ let queryParams = ref({
62
+ serviceType: props.serviceType,
63
+ likeOrganName: "",
64
+ });
65
+ // 搜索店铺列表
66
+ let mySearchList = ref([] as StorageOrganInfoModel[]);
67
+
68
+ // 搜索店铺列表
69
+ function querySearchStorageList() {
70
+ storageApi.findStorageOrganInfoList(queryParams.value).then(({ data }) => {
71
+ data.results.forEach((item) => {
72
+ item.createTime = formatDateTime(item.createTime as string, "YYYY-MM-DD")
73
+ });
74
+ mySearchList.value = data.results;
75
+ });
76
+ };
77
+ // 输入搜索关键字
78
+ function searchEvent(e: EventBase) {
79
+ queryParams.value.likeOrganName = e.detail;
80
+ };
81
+
82
+ // 主动刷新列表(供外部调用)
83
+ function refresh() {
84
+ querySearchStorageList();
85
+ };
86
+
87
+ // 初始化加载
88
+ querySearchStorageList();
89
+
90
+ return {
91
+ queryParams,
92
+ mySearchList,
93
+ querySearchStorageList,
94
+ searchEvent,
95
+ refresh,
96
+ }
97
+ },
98
+ methods: {
99
+ // 店铺点击事件,向上抛出 tenant
100
+ handleItemClick(item: StorageOrganInfoModel) {
101
+ this.triggerEvent("click", item);
102
+ }
103
+ }
104
+ })
105
+ </script>
106
+
107
+ <style lang="scss">
108
+ @use "../../styles/index.scss" as *;
109
+
110
+ .organ-main {
111
+ padding: 40rpx 0;
112
+ box-sizing: border-box;
113
+
114
+ .search-box {
115
+ padding: 0 30rpx;
116
+
117
+ .search-right {
118
+ background: linear-gradient(#3B82F6, #2563EB);
119
+ color: $white-color;
120
+ font-size: $font-size-mini;
121
+ padding: 0 60rpx;
122
+ border-radius: 40rpx;
123
+ height: 54rpx;
124
+ line-height: 54rpx;
125
+ }
126
+ }
127
+
128
+ .organ-content-h {
129
+ height: 90%;
130
+ padding-top: 20rpx;
131
+ }
132
+
133
+ .organ-content {
134
+ margin: 0 30rpx;
135
+ }
136
+ }
137
+ </style>
138
+
139
+ <script type="application/json">
140
+ {
141
+ "component": true,
142
+ "usingComponents": {
143
+ "jmash-search": "../common/jmash-search",
144
+ "jmash-none-data": "../common/jmash-none-data",
145
+ "shop-item": "./shop-item"
146
+ }
147
+ }
148
+ </script>
@@ -0,0 +1,88 @@
1
+ <template>
2
+ <view wx:if="{{ branchInfo.branchId || shopInfo.shopId }}" class="organ-item"
3
+ data-id="{{ branchInfo.branchId || shopInfo.shopId }}"
4
+ data-tenant="{{ branchInfo.organTenant || shopInfo.organTenant }}">
5
+ <image wx:if="{{ baseUrl && branchInfo.picUrl }}" class="organ-logo" src="{{ baseUrl + branchInfo.picUrl }}"
6
+ mode="aspectFit" />
7
+ <image wx:if="{{ baseUrl && shopInfo.picUrl }}" class="organ-logo" src="{{ baseUrl + shopInfo.picUrl }}"
8
+ mode="aspectFit" />
9
+ <image wx:if="{{ resourceUrl && !branchInfo.picUrl && !shopInfo.picUrl }}" class="organ-logo"
10
+ src="{{ resourceUrl + 'gray_logo_upload.png' }}" mode="aspectFit" />
11
+ <view class="organ-item-right">
12
+ <view class="organ-item-title">
13
+ <text class="organ-title-c">{{ branchInfo.facadeName || shopInfo.shopName }}</text>
14
+ <text>{{ branchInfo.createTime || shopInfo.createTime }}</text>
15
+ </view>
16
+ <view>{{ branchInfo.note || shopInfo.note }}</view>
17
+ </view>
18
+ </view>
19
+ </template>
20
+
21
+ <script lang="ts">
22
+ import { createComponent } from "@mpxjs/core";
23
+ import { useShopStore } from "../../store/shop";
24
+
25
+ createComponent({
26
+ setup() {
27
+ const config = getApp().globalData.config;
28
+ // 资源路径
29
+ let resourceUrl = config.resourceUrl + "/images/components/";
30
+ // 图片路径
31
+ let baseUrl = config.baseUrl + "/v1/file/image/resize/100/100/";
32
+ const shopStore = useShopStore();
33
+ let branchInfo = shopStore.branchInfo;
34
+ let shopInfo = shopStore.shopInfo;
35
+ return { resourceUrl, baseUrl, branchInfo, shopInfo }
36
+ },
37
+ methods: {
38
+ }
39
+ })
40
+ </script>
41
+
42
+ <style lang="scss">
43
+ @use "../../styles/index.scss" as *;
44
+
45
+ .organ-item {
46
+ background-color: $white-color;
47
+ border-radius: $border-radius;
48
+ padding: 20rpx 30rpx;
49
+ display: flex;
50
+ align-items: center;
51
+ gap: 20rpx;
52
+ margin-bottom: 20rpx;
53
+ box-shadow: 0 8rpx 24rpx 0 rgba(44, 19, 19, 0.08);
54
+ }
55
+
56
+ .organ-logo {
57
+ width: 80rpx;
58
+ height: 80rpx;
59
+ }
60
+
61
+ .organ-item-right {
62
+ width: 90%;
63
+ display: flex;
64
+ flex-direction: column;
65
+ gap: 10rpx;
66
+ color: $font-color-grey;
67
+ font-size: $font-size-mini;
68
+ font-weight: 400;
69
+
70
+ .organ-item-title {
71
+ display: flex;
72
+ justify-content: space-between;
73
+
74
+ .organ-title-c {
75
+ color: $font-color;
76
+ font-size: $font-size;
77
+ font-weight: bold;
78
+ }
79
+ }
80
+ }
81
+ </style>
82
+
83
+ <script type="application/json">
84
+ {
85
+ "component": true,
86
+ "usingComponents": {}
87
+ }
88
+ </script>
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <!-- 搜索店铺 -->
3
+ <jmash-top-navigation id="nav" indexBg title="{{ navigationTitle }}" leftIcon="back" />
4
+
5
+ <shop-search id="shop-search" top="{{ top }}" />
6
+ </template>
7
+
8
+ <script lang="ts">
9
+ import { createPage, ref } from "@mpxjs/core";
10
+ import { getHeight } from "../utils/common";
11
+
12
+ createPage({
13
+
14
+ setup() {
15
+ let config = getApp().globalData.config;
16
+ // 顶部安全距离
17
+ let top = ref(getHeight().MenuButtonBottom);
18
+ // 小程序名称
19
+ let navigationTitle = ref(config.xcxName);
20
+
21
+ return {
22
+ top,
23
+ navigationTitle,
24
+ }
25
+ },
26
+
27
+ /**
28
+ * 页面显示时刷新搜索列表
29
+ */
30
+ onShow() {
31
+ const comp = this.selectComponent('#branch-search');
32
+ comp && comp.refresh();
33
+ },
34
+
35
+ /**
36
+ * 页面滚动时调用
37
+ */
38
+ onPageScroll(e) {
39
+ this.selectComponent('#nav').calculateOpacity(e.scrollTop);
40
+ },
41
+ })
42
+ </script>
43
+
44
+ <style lang="scss">
45
+ @use "../styles/index.scss" as *;
46
+
47
+ page {
48
+ background: linear-gradient(#EDF5FF, $white-color);
49
+ }
50
+ </style>
51
+
52
+ <script type="application/json">
53
+ {
54
+ "usingComponents": {
55
+ "jmash-top-navigation": "../components/common/jmash-top-navigation",
56
+ "shop-search": "../components/shop/shop-search"
57
+ },
58
+ "navigationStyle": "custom"
59
+ }
60
+ </script>
@@ -1,9 +1,7 @@
1
1
  <template>
2
2
  <view class="page-body">
3
+ <shop-selected-item></shop-selected-item>
3
4
  <jmash-menu menuGroups="{{ menuGroups }}" bind:itemClick="handleMenuClick"></jmash-menu>
4
- <view class="logout-section">
5
- <button type="warn" bind:tap="loginOut">退出登录</button>
6
- </view>
7
5
  </view>
8
6
  </template>
9
7
 
@@ -19,11 +17,11 @@ createPage({
19
17
  id: 1,
20
18
  items: [
21
19
  { key: 'organ', title: '选择组织', icon: '🏠', iconBg: '#409eff', path: '/pages/organ' },
22
- { key: 'branch', title: '选择店铺', icon: '🏠', iconBg: '#409eff', path: '/pages/branch-search' },
20
+ { key: 'shop', title: '选择店铺', icon: '🏠', iconBg: '#409eff', path: '/pages/shop-search' },
21
+ { key: 'branch', title: '选择门店', icon: '🏠', iconBg: '#409eff', path: '/pages/branch-search' },
23
22
  { key: 'home', title: '主页(全屏登录检查)', icon: '🏠', iconBg: '#409eff', path: '/pages/home' },
24
23
  { key: 'home2', title: '主页(全屏登录)', icon: '🏠', iconBg: '#67c23a', path: '/pages/home2' },
25
24
  { key: 'half-home', title: '主页(半屏登录)', icon: '🏠', iconBg: '#e6a23c', path: '/pages/half-home' },
26
- { key: 'comp-test', title: '组件演示', icon: '🧩', iconBg: '#f56c6c', path: '/pages/basic-component' },
27
25
  {
28
26
  key: 'cms-location-list', title: '位置列表', icon: '📝', iconBg: '#409eff', path: '/jmash/pages/cms/cms-location-list'
29
27
  },
@@ -54,13 +52,6 @@ createPage({
54
52
  mpx.navigateTo({ url: item.path })
55
53
  }
56
54
  },
57
- loginOut() {
58
- this.userStore.logout();
59
- mpx.showToast({
60
- title: '已退出登录',
61
- icon: 'success'
62
- })
63
- }
64
55
  }
65
56
  })
66
57
  </script>
@@ -88,7 +79,8 @@ createPage({
88
79
  <script type="application/json">
89
80
  {
90
81
  "usingComponents": {
91
- "jmash-menu": "../../components/common/jmash-menu.mpx"
82
+ "jmash-menu": "../../components/common/jmash-menu.mpx",
83
+ "shop-selected-item": "../../components/shop/shop-selected-item.mpx"
92
84
  }
93
85
  }
94
86
  </script>
package/src/store/shop.ts CHANGED
@@ -2,6 +2,7 @@ import { defineStore } from "@mpxjs/pinia";
2
2
  import type { ShopInfoModel } from "../api/shop/types";
3
3
  import type { BranchModel } from "../api/shop/types";
4
4
  import { db } from "../utils/db";
5
+ import { useOrganStore } from "./organ";
5
6
 
6
7
  // 商户状态
7
8
  interface ShopState {
@@ -21,7 +22,10 @@ export const useShopStore = defineStore("shop", {
21
22
  }),
22
23
  actions: {
23
24
  // 切换商户门店
24
- switchShopBranch(shopInfo: ShopInfoModel, branchInfo: BranchModel) {
25
+ switchShopBranch(
26
+ shopInfo: ShopInfoModel,
27
+ branchInfo: BranchModel
28
+ ): Promise<boolean> {
25
29
  this.shopInfo = shopInfo;
26
30
  this.branchInfo = branchInfo;
27
31
  this.isShop = false;
@@ -29,9 +33,11 @@ export const useShopStore = defineStore("shop", {
29
33
  db.setShopInfo(shopInfo);
30
34
  db.setBranchInfo(branchInfo);
31
35
  db.setIsShop(false);
36
+ const organStore = useOrganStore();
37
+ return organStore.setOrganTenant(branchInfo.organTenant || "");
32
38
  },
33
39
  // 切换商户
34
- switchShop(shopInfo: ShopInfoModel) {
40
+ switchShop(shopInfo: ShopInfoModel): Promise<boolean> {
35
41
  this.shopInfo = shopInfo;
36
42
  this.branchInfo = {};
37
43
  this.isShop = true;
@@ -39,9 +45,11 @@ export const useShopStore = defineStore("shop", {
39
45
  db.setShopInfo(shopInfo);
40
46
  db.setBranchInfo({});
41
47
  db.setIsShop(true);
48
+ const organStore = useOrganStore();
49
+ return organStore.setOrganTenant(shopInfo.organTenant || "");
42
50
  },
43
51
  // 切换门店
44
- switchBranch(branchInfo: BranchModel) {
52
+ switchBranch(branchInfo: BranchModel): Promise<boolean> {
45
53
  this.shopInfo = {};
46
54
  this.branchInfo = branchInfo;
47
55
  this.isShop = false;
@@ -49,6 +57,8 @@ export const useShopStore = defineStore("shop", {
49
57
  db.setShopInfo({});
50
58
  db.setBranchInfo(branchInfo);
51
59
  db.setIsShop(false);
60
+ const organStore = useOrganStore();
61
+ return organStore.setOrganTenant(branchInfo.organTenant || "");
52
62
  },
53
63
  },
54
64
  });
package/src/utils/db.ts CHANGED
@@ -127,11 +127,13 @@ class LocalStorage {
127
127
  }
128
128
  //获取组织信息 TODO
129
129
  getOrganInfo(): StorageOrganInfoModel {
130
- return mpx.getStorageSync("organInfo") || {};
130
+ const config = getApp().globalData.config;
131
+ return mpx.getStorageSync("OrganInfo:" + config.tenant) || {};
131
132
  }
132
133
  //设置组织信息
133
134
  setOrganInfo(data: StorageOrganInfoModel) {
134
- mpx.setStorageSync("organInfo", data);
135
+ const config = getApp().globalData.config;
136
+ mpx.setStorageSync("OrganInfo:" + config.tenant, data);
135
137
  }
136
138
 
137
139
  // 获取商铺信息
package/lib/app.mpx.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};