@tplc/business 0.7.3 → 0.7.4

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.7.4](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.7.3...v0.7.4) (2025-12-12)
6
+
7
+
8
+ ### ✨ Features | 新功能
9
+
10
+ * 支持切换模式 ([2983347](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/2983347d57b86c5cb99e0a7a93550c438bbd829c))
11
+
5
12
  ### [0.7.3](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.7.2...v0.7.3) (2025-12-12)
6
13
 
7
14
 
package/action.d.ts CHANGED
@@ -73,7 +73,7 @@ export interface LcbGlobal {
73
73
  mainConfig?: Record<string, any>
74
74
  otherConfig?: Record<string, any>
75
75
  addressId?: string
76
- setAddressId: (addressId: string, switchType?: 'current' | 'global') => void
76
+ setAddressId: (addressId: string, switchType?: 'merchant' | 'address') => void
77
77
  getAddressId: () => string
78
78
  }
79
79
  messageStore?: () => {
@@ -40,13 +40,20 @@ const props = withDefaults(defineProps<AddressCommunityProps>(), {
40
40
  width: 240,
41
41
  mode: 'normal',
42
42
  popupWidth: 240,
43
- switchType: 'global',
43
+ switchType: 'address',
44
44
  })
45
+ type Merchant = { merchantName: string; pageDecorationId: string }
45
46
  const value = defineModel<string>('')
46
47
  const constantsStore = uni.$lcb.constantsStore?.()
47
48
  const title = ref<string>('')
49
+ const merchantList = ref<Merchant[]>([])
48
50
  const options = computed(() => {
49
- return constantsStore?.mainConfig?.addressList
51
+ return props.switchType === 'merchant'
52
+ ? (merchantList.value || []).map((item) => ({
53
+ addressName: item.merchantName,
54
+ addressId: item.pageDecorationId,
55
+ }))
56
+ : constantsStore?.mainConfig?.addressList
50
57
  })
51
58
  const setCurrentAddress = (address: { addressName: string; addressId: string }) => {
52
59
  if (address) {
@@ -64,6 +71,18 @@ watch(
64
71
  deep: true,
65
72
  },
66
73
  )
74
+ watch(
75
+ () => props.switchType,
76
+ (switchType) => {
77
+ if (switchType === 'merchant') {
78
+ getMerchantList()
79
+ }
80
+ },
81
+ {
82
+ immediate: true,
83
+ deep: true,
84
+ },
85
+ )
67
86
 
68
87
  const handleChange = (e: any) => {
69
88
  uni.$lcb.constantsStore?.()?.setAddressId(e.selectedItem.addressId, props.switchType)
@@ -71,7 +90,11 @@ const handleChange = (e: any) => {
71
90
 
72
91
  const onChooseAddress = () => {
73
92
  if (props.mode === 'normal') {
74
- uni.$lcb.navigateTo(`/pages-sub/index/store?switchType=${props.switchType}`)
93
+ if (props.switchType === 'address') {
94
+ uni.$lcb.navigateTo(`/pages-sub/index/store`)
95
+ } else if (props.switchType === 'merchant') {
96
+ uni.$lcb.navigateTo(`/pages-sub/index/merchant?switchMode=current`)
97
+ }
75
98
  }
76
99
  }
77
100
  const containerStyle = computed(() => {
@@ -84,6 +107,15 @@ const containerStyle = computed(() => {
84
107
  [props.mode === 'normal' ? 'max-width' : 'width']: `${props.width}rpx`,
85
108
  }
86
109
  })
110
+ const getMerchantList = async () => {
111
+ const { data } = await uni.$lcb.http.post('/merchant/page', {
112
+ pageSearch: {
113
+ limit: 1000,
114
+ page: 1,
115
+ },
116
+ })
117
+ merchantList.value = data as Merchant[]
118
+ }
87
119
  </script>
88
120
 
89
121
  <style lang="scss" scoped>
@@ -24,7 +24,7 @@ export interface AddressCommunityProps {
24
24
  width?: number
25
25
  mode: 'normal' | 'menu'
26
26
  popupWidth?: number
27
- switchType?: 'current' | 'global'
27
+ switchType?: 'merchant' | 'address'
28
28
  }
29
29
 
30
30
  export interface NavTitleProps {
package/package.json CHANGED
@@ -1,26 +1,17 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
7
7
  "type": "module",
8
- "scripts": {
9
- "pub": "pnpm dts && pnpm publish --no-git-checks",
10
- "dts": "rm -rf types && vue-tsc --project ./tsconfig.dts.json && pnpm prettier --write types",
11
- "release-major": "standard-version --release-as major ",
12
- "release-minor": "standard-version --release-as minor",
13
- "release-patch": "standard-version --release-as patch ",
14
- "generateComponent": "node ./scripts/createComponent.mjs",
15
- "generateGlobalDts": "node ./scripts/generateGlobalDts.mjs"
16
- },
17
8
  "publishConfig": {
18
9
  "access": "public",
19
10
  "registry": "https://registry.npmjs.org/"
20
11
  },
21
12
  "peerDependencies": {
22
- "@tplc/wot": "workspace:*",
23
- "vue": ">=3.2.47"
13
+ "vue": ">=3.2.47",
14
+ "@tplc/wot": "1.0.14"
24
15
  },
25
16
  "engines": {
26
17
  "node": ">=18",
@@ -33,5 +24,14 @@
33
24
  },
34
25
  "devDependencies": {
35
26
  "standard-version": "^9.5.0"
27
+ },
28
+ "scripts": {
29
+ "pub": "pnpm dts && pnpm publish --no-git-checks",
30
+ "dts": "rm -rf types && vue-tsc --project ./tsconfig.dts.json && pnpm prettier --write types",
31
+ "release-major": "standard-version --release-as major ",
32
+ "release-minor": "standard-version --release-as minor",
33
+ "release-patch": "standard-version --release-as patch ",
34
+ "generateComponent": "node ./scripts/createComponent.mjs",
35
+ "generateGlobalDts": "node ./scripts/generateGlobalDts.mjs"
36
36
  }
37
- }
37
+ }
@@ -33,7 +33,7 @@ declare const _default: import('vue').DefineComponent<
33
33
  color: string
34
34
  fontSize: number
35
35
  popupWidth: number
36
- switchType: 'current' | 'global'
36
+ switchType: 'merchant' | 'address'
37
37
  },
38
38
  {}
39
39
  >
@@ -22,7 +22,7 @@ export interface AddressCommunityProps {
22
22
  width?: number
23
23
  mode: 'normal' | 'menu'
24
24
  popupWidth?: number
25
- switchType?: 'current' | 'global'
25
+ switchType?: 'merchant' | 'address'
26
26
  }
27
27
  export interface NavTitleProps {
28
28
  /** 模式 */