@tplc/business 0.4.18 → 0.4.19

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,20 @@
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.4.19](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.16...v0.4.19) (2025-03-26)
6
+
7
+
8
+ ### 🚀 Chore | 构建/工程依赖/工具
9
+
10
+ * **release:** 0.4.17 ([ce6bc59](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ce6bc595a36d996eeed159f9782bcb9cbd4f68b7))
11
+ * **release:** 0.4.18 ([62dd680](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/62dd6803d3965fbd1cad206f3528063992a94103))
12
+
13
+
14
+ ### ✨ Features | 新功能
15
+
16
+ * 同步字段 ([706fd2b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/706fd2bbd2f52f6e3e1c4d994e099fc64631d998))
17
+ * 新增provinceId ([c3651bf](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c3651bf906a82f19b3ced7d6d4279d54e6a073c2))
18
+
5
19
  ### [0.4.18](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.17...v0.4.18) (2025-03-25)
6
20
 
7
21
 
@@ -4,7 +4,14 @@
4
4
  class="flex flex-1 text-[var(--content-color)] rounded-16rpx bg-#F5F5F7 h-78rpx flex items-center px-3 text-[28rpx]"
5
5
  >
6
6
  <lcb-city-select :location="userLocation" v-model="addressCity">
7
- <view class="max-w-13 truncate">{{ addressCity?.addressName || '全国' }}</view>
7
+ <view
8
+ class="max-w-13 truncate"
9
+ :style="{
10
+ fontSize: (addressCity?.addressName?.length || 0) > 3 ? '20rpx' : '28rpx',
11
+ }"
12
+ >
13
+ {{ addressCity?.addressName || '全国' }}
14
+ </view>
8
15
  </lcb-city-select>
9
16
  <view class="v-line"></view>
10
17
  <lcb-calendar v-model="dayRange">
@@ -21,8 +28,8 @@
21
28
  </lcb-calendar>
22
29
 
23
30
  <view class="v-line"></view>
24
- <view class="flex-1 flex items-center gap-2">
25
- <wd-icon name="search" size="34rpx" color="#999999" />
31
+ <view class="flex-1 flex items-center gap-2 w-0">
32
+ <wd-icon name="sousuo_search" class-prefix="lcb" size="38rpx" color="#999999" />
26
33
  <input
27
34
  class="text-[var(--content-color)]"
28
35
  :placeholder="placeholder"
@@ -34,10 +41,11 @@
34
41
  <lcb-action-view
35
42
  v-else
36
43
  v-bind="inputLink"
37
- custom-class="!w-full"
44
+ custom-class="!w-full !truncate !pr-2"
38
45
  :customStyle="{
39
46
  color: form.keywords ? 'var(--content-color)' : '#969696',
40
47
  }"
48
+ :url-params="urlParams"
41
49
  >
42
50
  {{ form.keywords || placeholder }}
43
51
  </lcb-action-view>
@@ -53,7 +61,7 @@
53
61
  import { useTranslate } from '@tplc/wot'
54
62
  import dayjs from 'dayjs/esm'
55
63
  import useLocation from '../../hooks/useLocation'
56
- import { inject, onMounted, Ref, ref, watch } from 'vue'
64
+ import { computed, inject, onMounted, Ref, ref, watch } from 'vue'
57
65
  import { LcbCalendarSearchProps } from './types'
58
66
  import { LcbAddress } from '../lcb-city-select/api'
59
67
  import { FORM_KEY } from '../../constants'
@@ -76,7 +84,13 @@ withDefaults(defineProps<LcbCalendarSearchProps>(), {
76
84
  icon: 'search',
77
85
  mode: 'search',
78
86
  })
79
-
87
+ const urlParams = computed(() => {
88
+ return stringify({
89
+ startDate: form.value.startDate,
90
+ endDate: form.value.endDate,
91
+ keywords: form.value.keywords,
92
+ })
93
+ })
80
94
  const form = inject(FORM_KEY) as Ref<Record<string, any>>
81
95
  const addressCity = ref<LcbAddress | undefined>(
82
96
  (form.value.cityId || form.value.areaId || form.value.provinceId
@@ -59,7 +59,7 @@
59
59
  </template>
60
60
 
61
61
  <script setup lang="ts">
62
- import { ref, watch, provide } from 'vue'
62
+ import { ref, watch, provide, onMounted, onUnmounted } from 'vue'
63
63
  import { ChildHotAddress, getAddressList, LcbAddress } from './api'
64
64
  import LcbCityLetter from './components/lcb-city-letter/index.vue'
65
65
  import LcbCityList from './components/lcb-city-list/index.vue'
@@ -97,13 +97,7 @@ const onCancel = () => {
97
97
  }
98
98
 
99
99
  const onAddressClick = (item: LcbAddress) => {
100
- // if (item.addrFlag) {
101
100
  modelValue.value = item as ChildHotAddress
102
- // } else {
103
- // uni.navigateTo({
104
- // url: `/pages/residentialHotel/index?${qs.stringify(item)}`,
105
- // })
106
- // }
107
101
  onCancel()
108
102
  show.value = false
109
103
  }
@@ -130,6 +124,7 @@ watch(
130
124
  () => {
131
125
  setHistoryCity(modelValue.value)
132
126
  show.value = false
127
+ uni.$emit('lcb-city-select-change', modelValue.value)
133
128
  },
134
129
  )
135
130
 
@@ -167,6 +162,18 @@ watch(
167
162
  deep: true,
168
163
  },
169
164
  )
165
+
166
+ const onSelectChange = (val: ChildHotAddress) => {
167
+ if (JSON.stringify(val) !== JSON.stringify(modelValue.value)) {
168
+ modelValue.value = val
169
+ }
170
+ }
171
+ onMounted(() => {
172
+ uni.$on('lcb-city-select-change', onSelectChange)
173
+ })
174
+ onUnmounted(() => {
175
+ uni.$off('lcb-city-select-change', onSelectChange)
176
+ })
170
177
  </script>
171
178
 
172
179
  <style lang="scss" scoped>
@@ -17,7 +17,7 @@
17
17
  </template>
18
18
 
19
19
  <script setup lang="ts">
20
- import { inject, Ref, ref, watch, watchEffect, onMounted } from 'vue'
20
+ import { inject, Ref, ref, watch, watchEffect, onMounted, onUnmounted } from 'vue'
21
21
  import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging'
22
22
  import { FORM_KEY } from '../../../../constants'
23
23
  import { getCurrentPage } from '../../../../utils/utils'
@@ -77,10 +77,14 @@ const onRefresh = async () => {
77
77
  refreshed.value = true
78
78
  emits('refresh')
79
79
  }
80
+ const onReload = () => {
81
+ paging.value?.reload()
82
+ }
80
83
  onMounted(() => {
81
- uni.$on(`${getCurrentPage().fullPath}_reload`, () => {
82
- paging.value?.reload()
83
- })
84
+ uni.$on(`${getCurrentPage().fullPath}_reload`, onReload)
85
+ })
86
+ onUnmounted(() => {
87
+ uni.$off(`${getCurrentPage().fullPath}_reload`, onReload)
84
88
  })
85
89
  </script>
86
90
  <style lang="scss" scoped>
@@ -22,7 +22,8 @@
22
22
  <img
23
23
  :src="item.productTypeIcon"
24
24
  v-if="item.productTypeIcon"
25
- class="mt-0.5 mr-2 w-3.5 h-3.5 object-cover"
25
+ class="mt-0.5 mr-2 w-3.5 h-auto"
26
+ mode="widthFix"
26
27
  />
27
28
  <view class="w-full">
28
29
  <view class="flex items-center">
@@ -36,7 +37,12 @@
36
37
  {{ textPart.text }}
37
38
  </text>
38
39
  </view>
39
- <img :src="item.titleIcon" v-if="item.titleIcon" class="ml-1 w-3 h-3 object-cover" />
40
+ <img
41
+ :src="item.titleIcon"
42
+ v-if="item.titleIcon"
43
+ class="ml-1 w-3 h-auto"
44
+ mode="widthFix"
45
+ />
40
46
  </view>
41
47
  <view v-if="item.price">
42
48
  <text class="font-600 text-primary text-3.5">¥{{ item.price }}</text>
@@ -149,6 +155,10 @@ const highlightText = (text: string) => {
149
155
 
150
156
  return parts
151
157
  }
158
+
159
+ defineExpose({
160
+ getList: () => dataList.value,
161
+ })
152
162
  </script>
153
163
  <style lang="scss" scoped>
154
164
  .border-b {
@@ -1,76 +1,107 @@
1
1
  <template>
2
- <lcb-block
3
- v-bind="$props"
4
- customClass="border-solid"
5
- :customStyle="{
6
- borderWidth: `${borderWidth}px`,
7
- }"
8
- >
9
- <view
10
- class="flex items-center"
11
- :style="{
12
- gap: transformValueUnit(gap),
2
+ <view class="flex w-full items-center">
3
+ <lcb-block
4
+ v-bind="$props"
5
+ customClass="border-solid"
6
+ :customStyle="{
7
+ borderWidth: `${borderWidth}px`,
8
+ flex: 1,
13
9
  }"
14
10
  >
15
- <!-- v-if="city" -->
16
- <lcb-city-select :location="userLocation" v-model="addressCity" v-if="city">
17
- <view class="flex items-center h-full gap-1">
18
- <wd-icon
19
- name="location"
20
- :size="transformValueUnit(cityIconSize)"
21
- :color="cityIconColor"
22
- />
23
- <view
24
- class="max-w-13 truncate"
25
- :style="{
26
- color: cityColor,
27
- fontSize: transformValueUnit(citySize),
28
- }"
29
- >
30
- {{ addressCity?.addressName || '全国' }}
11
+ <view
12
+ class="flex items-center"
13
+ :style="{
14
+ gap: transformValueUnit(gap),
15
+ }"
16
+ >
17
+ <!-- v-if="city" -->
18
+ <lcb-city-select :location="userLocation" v-model="addressCity" v-if="city">
19
+ <view class="flex items-center h-full gap-1">
20
+ <wd-icon
21
+ name="location"
22
+ :size="transformValueUnit(cityIconSize)"
23
+ :color="cityIconColor"
24
+ />
25
+ <view
26
+ class="max-w-13 truncate"
27
+ :style="{
28
+ color: cityColor,
29
+ fontSize:
30
+ (addressCity?.addressName?.length || 0) > 3
31
+ ? transformValueUnit(citySize - 8)
32
+ : transformValueUnit(citySize),
33
+ }"
34
+ >
35
+ {{ addressCity?.addressName || '全国' }}
36
+ </view>
37
+ <view
38
+ :style="{
39
+ backgroundColor: lineColor,
40
+ width: transformValueUnit(lineWidth),
41
+ margin: `0 ${transformValueUnit(linePadding)}`,
42
+ height: transformValueUnit(lineHeight),
43
+ }"
44
+ ></view>
31
45
  </view>
32
- <view
46
+ </lcb-city-select>
47
+
48
+ <lcb-icon
49
+ v-if="icon || url"
50
+ :url="url"
51
+ :size="iconSize"
52
+ :color="iconColor"
53
+ :icon="icon"
54
+ class-prefix="lcb"
55
+ :iconType="iconType"
56
+ />
57
+ <view v-if="mode === 'search'" class="flex-1 flex items-center">
58
+ <input
59
+ class="search-input"
33
60
  :style="{
34
- backgroundColor: lineColor,
35
- width: transformValueUnit(lineWidth),
36
- margin: `0 ${transformValueUnit(linePadding)}`,
37
- height: transformValueUnit(lineHeight),
61
+ fontSize: transformValueUnit(fontSize),
38
62
  }"
39
- ></view>
63
+ confirm-type="search"
64
+ :placeholder="placeholder"
65
+ v-model="form.keywords"
66
+ @confirm="onSearch"
67
+ focus
68
+ />
69
+ <wd-icon
70
+ name="close-circle"
71
+ :size="iconSize"
72
+ :color="iconColor"
73
+ v-if="form.keywords"
74
+ @click="form.keywords = ''"
75
+ />
40
76
  </view>
41
- </lcb-city-select>
42
-
43
- <lcb-icon
44
- v-if="icon || url"
45
- :url="url"
46
- :size="iconSize"
47
- :color="iconColor"
48
- :icon="icon"
49
- class-prefix="lcb"
50
- :iconType="iconType"
51
- />
52
- <input
53
- v-if="mode === 'search'"
54
- class="search-input"
55
- :style="{
56
- fontSize: transformValueUnit(fontSize),
57
- }"
58
- confirm-type="search"
59
- :placeholder="placeholder"
60
- @confirm="onSearch"
61
- />
62
- <lcb-action-view v-bind="link" :urlParams="stringify(addressCity)" v-else>
63
- {{ placeholder }}
64
- </lcb-action-view>
77
+ <lcb-action-view v-bind="link" :urlParams="stringify(addressCity)" v-else>
78
+ {{ placeholder }}
79
+ </lcb-action-view>
80
+ </view>
81
+ </lcb-block>
82
+ <view
83
+ class="mr-3"
84
+ @click="onCancel"
85
+ v-if="mode === 'search'"
86
+ :style="{
87
+ fontSize: transformValueUnit(fontSize),
88
+ }"
89
+ >
90
+ 取消
65
91
  </view>
66
- </lcb-block>
92
+ </view>
67
93
  <view id="searchPagingTop"></view>
68
94
  <view
69
95
  class="fixed left-0 w-full z-1 bg-white"
70
96
  :style="{ height: height, top: top }"
71
- v-if="form?.keywords && productTypeList"
97
+ v-if="form?.keywords && productTypeList && top"
72
98
  >
73
- <lcb-search-list :productTypeList="productTypeList" @select="onSelect" :height="height" />
99
+ <lcb-search-list
100
+ :productTypeList="productTypeList"
101
+ @select="onSelect"
102
+ :height="height"
103
+ ref="searchListRef"
104
+ />
74
105
  </view>
75
106
  <lcb-search-history
76
107
  :historyKey="historyKey"
@@ -87,7 +118,7 @@ import { ChildHotAddress } from '../lcb-city-select/api'
87
118
  import useLocation from '../../hooks/useLocation'
88
119
  import { getHistoryCity } from '../../utils/history'
89
120
  import { parse, stringify } from 'qs'
90
- import { inject, Ref, ref } from 'vue'
121
+ import { inject, Ref, ref, watchEffect } from 'vue'
91
122
  import { FORM_KEY } from '../../constants'
92
123
  import LcbSearchHistory from './components/SearchHistory/index.vue'
93
124
  import LcbSearchList from './components/SearchList/index.vue'
@@ -102,7 +133,7 @@ defineOptions({
102
133
  styleIsolation: 'shared',
103
134
  },
104
135
  })
105
- withDefaults(defineProps<LcbSearchProps>(), {
136
+ const props = withDefaults(defineProps<LcbSearchProps>(), {
106
137
  placeholder: '搜索',
107
138
  iconSize: '16',
108
139
  borderWidth: 1,
@@ -127,17 +158,20 @@ withDefaults(defineProps<LcbSearchProps>(), {
127
158
  fontSize: 24,
128
159
  })
129
160
  const searchHistoryRef = ref<InstanceType<typeof LcbSearchHistory>>()
161
+ const searchListRef = ref<InstanceType<typeof LcbSearchList>>()
130
162
  const { height, top } = useAutoHeight('searchPagingTop')
131
163
  const { getLocation, userLocation } = useLocation()
132
164
  const addressCity = ref<ChildHotAddress | undefined>(getHistoryCity())
165
+ const popupProvide = inject('wd-popup', {
166
+ value: false,
167
+ })
133
168
  getLocation()
134
- const form = inject<Ref<Record<string, any>>>(FORM_KEY)
169
+ const form = inject(FORM_KEY) as Ref<Record<string, any>>
135
170
  const onSearch = async (e: { detail: { value: string } }) => {
136
- if (form) {
137
- form.value.keywords = e.detail.value
138
- }
171
+ onSelect(searchListRef.value?.getList()?.[0])
139
172
  }
140
- const onSelect = (keyword: ProductInfo) => {
173
+ const onSelect = (keyword?: ProductInfo) => {
174
+ if (!keyword) return
141
175
  searchHistoryRef.value?.saveHistory(keyword)
142
176
  const [path, query] = keyword.link.jumpUrl.split('?')
143
177
  let queryParams = query ? parse(query) : {}
@@ -168,6 +202,12 @@ const onSelect = (keyword: ProductInfo) => {
168
202
  })
169
203
  }
170
204
  }
205
+ const onCancel = () => {
206
+ uni.navigateBack()
207
+ }
208
+ watchEffect(() => {
209
+ popupProvide.value = form.value?.keywords && props.productTypeList && top
210
+ })
171
211
  </script>
172
212
 
173
213
  <style lang="scss" scoped>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.4.18",
3
+ "version": "0.4.19",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -7,7 +7,27 @@ declare const _default: import('vue').DefineComponent<
7
7
  type: StringConstructor
8
8
  }
9
9
  },
10
- {},
10
+ {
11
+ getList: () => {
12
+ productImg: string
13
+ productName: string
14
+ address: string
15
+ tags: string
16
+ price: number
17
+ priceSuffix: string
18
+ addressIntro: string
19
+ scoreAvg: number
20
+ productType: string
21
+ titleIcon: string
22
+ distanceTips: string
23
+ productTypeIcon: string
24
+ searchResultTips: string
25
+ link: {
26
+ jumpUrl: string
27
+ }
28
+ productInfoId: string
29
+ }[]
30
+ },
11
31
  unknown,
12
32
  {},
13
33
  {},