jmash-core-mp 0.1.58 → 0.1.59
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.
- package/lib/api/shop/types.d.ts +2 -0
- package/lib/store/shop.d.ts +3 -3
- package/lib/store/shop.js +7 -0
- package/lib/utils/db.js +4 -2
- package/package.json +1 -1
- package/src/api/shop/types.ts +4 -0
- package/src/components/shop/branch-item.mpx +2 -5
- package/src/components/shop/shop-selected-item.mpx +88 -0
- package/src/pages/tabbar/home.mpx +3 -1
- package/src/store/shop.ts +13 -3
- package/src/utils/db.ts +4 -2
- package/lib/app.mpx.d.ts +0 -1
- package/lib/components/organ/browser-organ-list.mpx.d.ts +0 -1
- package/lib/components/organ/my-organ-list.mpx.d.ts +0 -1
- package/lib/components/shop/branch-item.mpx.d.ts +0 -1
- package/lib/components/shop/branch-search.mpx.d.ts +0 -1
- package/lib/pages/branch-search.mpx.d.ts +0 -1
- package/lib/pages/organ.mpx.d.ts +0 -1
package/lib/api/shop/types.d.ts
CHANGED
package/lib/store/shop.d.ts
CHANGED
|
@@ -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):
|
|
10
|
-
switchShop(shopInfo: ShopInfoModel):
|
|
11
|
-
switchBranch(branchInfo: BranchModel):
|
|
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
|
-
|
|
110
|
+
const config = getApp().globalData.config;
|
|
111
|
+
return mpx.getStorageSync("OrganInfo:" + config.tenant) || {};
|
|
111
112
|
}
|
|
112
113
|
//设置组织信息
|
|
113
114
|
setOrganInfo(data) {
|
|
114
|
-
|
|
115
|
+
const config = getApp().globalData.config;
|
|
116
|
+
mpx.setStorageSync("OrganInfo:" + config.tenant, data);
|
|
115
117
|
}
|
|
116
118
|
// 获取商铺信息
|
|
117
119
|
getShopInfo() {
|
package/package.json
CHANGED
package/src/api/shop/types.ts
CHANGED
|
@@ -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
|
-
|
|
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"
|
|
@@ -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>
|
|
@@ -1,5 +1,6 @@
|
|
|
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
5
|
<view class="logout-section">
|
|
5
6
|
<button type="warn" bind:tap="loginOut">退出登录</button>
|
|
@@ -88,7 +89,8 @@ createPage({
|
|
|
88
89
|
<script type="application/json">
|
|
89
90
|
{
|
|
90
91
|
"usingComponents": {
|
|
91
|
-
"jmash-menu": "../../components/common/jmash-menu.mpx"
|
|
92
|
+
"jmash-menu": "../../components/common/jmash-menu.mpx",
|
|
93
|
+
"shop-selected-item": "../../components/shop/shop-selected-item.mpx"
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
96
|
</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(
|
|
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
|
-
|
|
130
|
+
const config = getApp().globalData.config;
|
|
131
|
+
return mpx.getStorageSync("OrganInfo:" + config.tenant) || {};
|
|
131
132
|
}
|
|
132
133
|
//设置组织信息
|
|
133
134
|
setOrganInfo(data: StorageOrganInfoModel) {
|
|
134
|
-
|
|
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 {};
|
package/lib/pages/organ.mpx.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|