@tplc/business 0.2.33 → 0.2.35

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.2.35](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.34...v0.2.35) (2024-12-26)
6
+
7
+
8
+ ### 🐛 Bug Fixes | Bug 修复
9
+
10
+ * 修改样式错误 ([a4d5aab](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/a4d5aab85ac0e92fba75a964846eb62045b18239))
11
+
12
+ ### [0.2.34](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.33...v0.2.34) (2024-12-25)
13
+
14
+
15
+ ### ✨ Features | 新功能
16
+
17
+ * version update ([7c02961](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/7c02961426faa5f1c6628e8222777bc406bdca78))
18
+
5
19
  ### [0.2.33](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.32...v0.2.33) (2024-12-25)
6
20
 
7
21
 
@@ -39,6 +39,7 @@ import { LcbActionViewProps } from './types'
39
39
  import { uploadFile } from '../../hooks/useUpload'
40
40
  import mpHtml from 'mp-html/src/uni-app/components/mp-html/mp-html.vue'
41
41
  import { PAGE_ANCHOR_PROVIDE_KEY } from '../../constants'
42
+ import { getFinalUrl } from '../../utils/utils'
42
43
  defineOptions({
43
44
  name: 'LcbActionView',
44
45
  options: {
@@ -70,12 +71,14 @@ const openType = computed(() => {
70
71
  }[props.jumpType || '']
71
72
  })
72
73
  const onActionClick = async () => {
73
- const { jumpUrl: url, jumpType } = props
74
+ const { jumpUrl, jumpType } = props
74
75
  /**
75
76
  * 跳转类型 1: 网页 2: 小程序内页 10: 跳转小程序 11: 跳转半屏小程序 12: 小程序客服
76
77
  * 13: 退出登录 14: 小程序弹框 21: 新窗口跳到页面 22: 切换TAB页 23: 重启进入某页面
77
78
  * 24: 回到上一层 25: 关闭当前页面 26: 关闭当前窗口 30: 拨打电话 88: 授权手机号
78
79
  */
80
+ const url = getFinalUrl(jumpUrl || '', props.urlParams)
81
+ console.log('url', url)
79
82
  switch (jumpType) {
80
83
  /** 网页 */
81
84
  case 1:
@@ -1,6 +1,7 @@
1
1
  export type LcbActionViewProps = {
2
2
  /** 跳转路径 */
3
3
  jumpUrl?: string
4
+ urlParams?: string
4
5
  } & (
5
6
  | {
6
7
  /**
@@ -4,7 +4,6 @@
4
4
  @confirm="handleConfirm"
5
5
  type="daterange"
6
6
  use-default-slot
7
- allow-same-day
8
7
  :formatter="formatter"
9
8
  :min-date="minDate"
10
9
  :max-date="maxDate"
@@ -3,7 +3,7 @@
3
3
  <view class="flex w-full search-view overflow-hidden">
4
4
  <view
5
5
  v-for="(item, index) in tabs"
6
- :key="item"
6
+ :key="index"
7
7
  class="search-tab"
8
8
  @click="current = index"
9
9
  :class="{
@@ -18,7 +18,7 @@
18
18
  : `rgba(245,246,249,${opacity ?? 1})`,
19
19
  }"
20
20
  >
21
- {{ item }}
21
+ {{ item.label }}
22
22
  </view>
23
23
  </view>
24
24
  <view
@@ -46,9 +46,12 @@
46
46
  :style="{
47
47
  backgroundColor: `rgba(241,241, 241, ${opacity})`,
48
48
  }"
49
- ></view>
50
- <view class="text-#999 text-28rpx">{{ placeholder }}</view>
51
- <view class="flex-1"></view>
49
+ />
50
+ <input
51
+ class="text-#333 text-28rpx flex-1 mr-3"
52
+ :placeholder="placeholder"
53
+ v-model="form.keywords"
54
+ />
52
55
  <view class="justify-center flex flex-col items-center" @click="getLocation">
53
56
  <wd-loading size="30rpx" v-if="locationIng" />
54
57
  <img
@@ -79,9 +82,11 @@
79
82
  <view class="tag">{{ translate('共') }}{{ nightCount }}{{ translate('晚') }}</view>
80
83
  </view>
81
84
  </lcb-calendar>
82
- <wd-button type="primary" customClass="!w-full my-42rpx" size="large">
83
- {{ btnText }}
84
- </wd-button>
85
+ <lcb-action-view v-bind="link" :urlParams="stringify(form)">
86
+ <wd-button type="primary" customClass="!w-full my-42rpx" size="large">
87
+ {{ btnText }}
88
+ </wd-button>
89
+ </lcb-action-view>
85
90
  <view
86
91
  class="px-50rpx flex justify-between items-center pb-42rpx text-#000 text-28rpx"
87
92
  v-if="items?.length"
@@ -101,12 +106,13 @@
101
106
  </template>
102
107
 
103
108
  <script setup lang="ts">
104
- import { computed, ref } from 'vue'
109
+ import { computed, ref, reactive, watchEffect } from 'vue'
105
110
  import { LcbHomeSearch } from './types'
106
111
  import dayjs from 'dayjs/esm'
107
112
  import useLocation from '../../hooks/useLocation'
108
113
  import { useTranslate } from '@tplc/wot'
109
114
  import { ChildHotAddress } from '../lcb-city-select/api'
115
+ import { stringify } from 'qs'
110
116
  const dayRange = ref([dayjs().valueOf(), dayjs().add(1, 'day').valueOf()])
111
117
  const { translate } = useTranslate()
112
118
  const { getLocation, userLocation, locationIng } = useLocation()
@@ -123,8 +129,7 @@ defineOptions({
123
129
  styleIsolation: 'shared',
124
130
  },
125
131
  })
126
-
127
- withDefaults(defineProps<LcbHomeSearch>(), {
132
+ const props = withDefaults(defineProps<LcbHomeSearch>(), {
128
133
  marginHorizontal: 24,
129
134
  backgroundColor: '#ffffff',
130
135
  radius: 16,
@@ -132,8 +137,16 @@ withDefaults(defineProps<LcbHomeSearch>(), {
132
137
  btnText: '搜索酒店',
133
138
  opacity: 1,
134
139
  })
135
- const tabs = ['全部', '酒店', '民宿']
140
+
136
141
  const current = ref(0)
142
+ const form = reactive({
143
+ categoryTags: '',
144
+ keywords: '',
145
+ startDate: '',
146
+ endDate: '',
147
+ hotAddressId: '',
148
+ })
149
+
137
150
  // 今天 明天 后天 周...
138
151
  const getDayName = (time: number) => {
139
152
  const day = dayjs(time).day()
@@ -147,6 +160,21 @@ const getDayName = (time: number) => {
147
160
  return `周${'日一二三四五六'[day]}`
148
161
  }
149
162
  }
163
+
164
+ watchEffect(() => {
165
+ form.categoryTags = props.tabs[current.value].value
166
+ })
167
+
168
+ watchEffect(() => {
169
+ form.startDate = dayjs(dayRange.value[0]).format('YYYY-MM-DD')
170
+ form.endDate = dayjs(dayRange.value[1]).format('YYYY-MM-DD')
171
+ })
172
+
173
+ watchEffect(() => {
174
+ if (addressCity.value) {
175
+ form.hotAddressId = addressCity.value.hotAddressId
176
+ }
177
+ })
150
178
  </script>
151
179
  <style lang="scss" scoped>
152
180
  @import '@tplc/wot/components/common/abstracts/variable';
@@ -165,14 +193,6 @@ const getDayName = (time: number) => {
165
193
  .active {
166
194
  color: $-color-theme;
167
195
  font-weight: bold;
168
- // border-top-left-radius: 16rpx;
169
- // border-top-right-radius: 16rpx;
170
- // &-left {
171
- // border-bottom-right-radius: 16rpx;
172
- // }
173
- // &-right {
174
- // border-bottom-left-radius: 16rpx;
175
- // }
176
196
  }
177
197
  }
178
198
 
@@ -1,8 +1,14 @@
1
1
  import { ActionView } from 'action'
2
2
  import { LcbBlockProps } from '../lcb-block/types'
3
+ import { LcbActionViewProps } from '../lcb-action-view/types'
3
4
 
4
5
  export interface LcbHomeSearch extends LcbBlockProps {
5
6
  placeholder?: string
6
7
  items?: ActionView[]
7
8
  btnText?: string
9
+ tabs: {
10
+ label: string
11
+ value: string
12
+ }[]
13
+ link?: LcbActionViewProps
8
14
  }
@@ -17,11 +17,11 @@ const itemProps: any = inject('lcb-product-item-props')
17
17
  const props = withDefaults(
18
18
  defineProps<{
19
19
  prop: string
20
- className?: string
20
+ customClass?: string
21
21
  }>(),
22
22
  {},
23
23
  )
24
-
24
+ console.log('itemProps', itemProps, props)
25
25
  defineSlots<{
26
26
  coverImg(props: { value: any }): any
27
27
  productName(props: { value: any }): any
@@ -49,7 +49,7 @@ const visible = computed(() => {
49
49
  return itemProps?.[`${props?.prop}Visible`] ?? true
50
50
  })
51
51
  const className = computed(() => {
52
- return `${itemProps?.[`${props?.prop}Class`] ?? ''} ${props?.className}`
52
+ return `${itemProps?.[`${props?.prop}Class`] ?? ''} ${props?.customClass}`
53
53
  })
54
54
  const style = computed(() => {
55
55
  return itemProps?.[`${props?.prop}Style`] ?? ''
@@ -77,8 +77,16 @@ const value = computed(() => {
77
77
  >
78
78
  <!-- 图片 -->
79
79
  <slot :value="value" v-if="prop === 'coverImg'" name="coverImg">
80
- <view :class="className" :style="style">
80
+ <view :class="`relative ${className}`" :style="style">
81
81
  <image :src="value" class="w-full h-full" mode="aspectFill" />
82
+ <!-- imgBottomIcon -->
83
+ <view class="absolute bottom-0 left-0 w-full z-1" v-if="itemProps.imgBottomIcon">
84
+ <image :src="itemProps.imgBottomIcon" class="w-full h-auto block" mode="widthFix" />
85
+ </view>
86
+ <!-- imgCornerIcon -->
87
+ <view class="absolute top-0 left-0 h-8 z-1" v-if="itemProps.imgCornerIcon">
88
+ <image :src="itemProps.imgCornerIcon" class="w-auto h-full block" mode="heightFix" />
89
+ </view>
82
90
  <slot></slot>
83
91
  </view>
84
92
  </slot>
@@ -255,18 +263,6 @@ const value = computed(() => {
255
263
  </view>
256
264
  </slot>
257
265
 
258
- <slot :value="value" v-if="prop === 'imgCornerIcon'" name="imgCornerIcon">
259
- <view :class="className" :style="style" class="">
260
- <view>{{ value }}</view>
261
- </view>
262
- </slot>
263
-
264
- <slot :value="value" v-if="prop === 'imgBottomIcon'" name="imgBottomIcon">
265
- <view :class="className" :style="style" class="">
266
- <view>{{ value }}</view>
267
- </view>
268
- </slot>
269
-
270
266
  <slot :value="value" v-if="prop === 'orderTips'" name="orderTips">
271
267
  <view :class="className" :style="style" class="text-22rpx text-gray-500">
272
268
  <view>{{ value }}</view>
@@ -99,7 +99,7 @@ defineSlots<{
99
99
  <ItemValue
100
100
  v-if="!!$slots?.['coverImg']"
101
101
  prop="coverImg"
102
- className="w-1/3 h-[360rpx] bg-gray-100 rounded-sm overflow-hidden relative"
102
+ customClass="w-1/3 h-[360rpx] bg-gray-100 rounded-sm overflow-hidden relative"
103
103
  >
104
104
  <template #default>
105
105
  <slot name="coverImgSection" />
@@ -111,7 +111,7 @@ defineSlots<{
111
111
  <ItemValue
112
112
  v-else
113
113
  prop="coverImg"
114
- className="w-1/3 h-[360rpx] bg-gray-100 rounded-sm overflow-hidden relative"
114
+ customClass="w-1/3 h-[360rpx] bg-gray-100 rounded-sm overflow-hidden relative"
115
115
  >
116
116
  <template #default>
117
117
  <slot name="coverImgSection" />
@@ -159,7 +159,7 @@ defineSlots<{
159
159
  </ItemValue>
160
160
  </view>
161
161
 
162
- <view className="flex gap-1 items-center">
162
+ <view class="flex gap-1 items-center">
163
163
  <ItemValue prop="scoreAvg">
164
164
  <!-- <template #scoreAvg="{ value }"><slot name="scoreAvg" :value="value" /></template> -->
165
165
  </ItemValue>
@@ -255,7 +255,11 @@ defineSlots<{
255
255
  <slot name="itemLeftSection" />
256
256
  <view class="flex-1 flex flex-col w-full overflow-hidden">
257
257
  <slot name="itemTopSection" />
258
- <ItemValue v-if="!!$slots?.['coverImg']" prop="coverImg" className="overflow-hidden relative">
258
+ <ItemValue
259
+ v-if="!!$slots?.['coverImg']"
260
+ prop="coverImg"
261
+ customClass="overflow-hidden relative"
262
+ >
259
263
  <template #default>
260
264
  <slot name="coverImgSection" />
261
265
  </template>
@@ -263,7 +267,7 @@ defineSlots<{
263
267
  <slot name="coverImg" :value="value" />
264
268
  </template>
265
269
  </ItemValue>
266
- <ItemValue v-else prop="coverImg" className="overflow-hidden relative">
270
+ <ItemValue v-else prop="coverImg" customClass="overflow-hidden relative">
267
271
  <template #default>
268
272
  <slot name="coverImgSection" />
269
273
  </template>
@@ -310,7 +314,7 @@ defineSlots<{
310
314
  </ItemValue>
311
315
  </view>
312
316
 
313
- <view className="flex gap-1 items-center">
317
+ <view class="flex gap-1 items-center">
314
318
  <ItemValue prop="scoreAvg">
315
319
  <!-- <template #="{ value }"><slot name="scoreAvg" :value="value" /></template> -->
316
320
  </ItemValue>
@@ -16,7 +16,7 @@ export interface LcbProductItemProps {
16
16
  distanceUnit?: string
17
17
 
18
18
  coverImg?: any
19
- title?: any
19
+ productName?: any
20
20
  subTitle?: any
21
21
  price?: any
22
22
  priceUnit?: any
@@ -28,7 +28,7 @@ export interface LcbProductItemProps {
28
28
  tags?: any
29
29
  addressIntro?: any
30
30
  distance?: any
31
- score?: any
31
+ scoreAvg?: any
32
32
  scoreTips?: any
33
33
  level?: any
34
34
  imgCornerIcon?: any
@@ -15,16 +15,16 @@
15
15
 
16
16
  export interface LcbTagsProps {
17
17
  // Define the component's prop types here
18
- items?: any,
19
- mode?: 1 | 2 //1是不换行滚动 这是加在大部分产品里的用法 2是自然换行
18
+ items?: any
19
+ mode?: 1 | 2 // 1是不换行滚动 这是加在大部分产品里的用法 2是自然换行
20
20
  tagRadius?: number
21
21
  fontSize?: number
22
22
  tagColor?: string
23
23
  }
24
24
 
25
25
  export interface LcbTagsItemProps {
26
- items: object[],
26
+ items: object[]
27
27
  tagRadius?: number
28
28
  fontSize?: number
29
29
  tagColor?: string
30
- }
30
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.2.33",
3
+ "version": "0.2.35",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -1,6 +1,7 @@
1
1
  export type LcbActionViewProps = {
2
2
  /** 跳转路径 */
3
3
  jumpUrl?: string
4
+ urlParams?: string
4
5
  } & (
5
6
  | {
6
7
  /**
@@ -1,7 +1,13 @@
1
1
  import { ActionView } from 'action'
2
2
  import { LcbBlockProps } from '../lcb-block/types'
3
+ import { LcbActionViewProps } from '../lcb-action-view/types'
3
4
  export interface LcbHomeSearch extends LcbBlockProps {
4
5
  placeholder?: string
5
6
  items?: ActionView[]
6
7
  btnText?: string
8
+ tabs: {
9
+ label: string
10
+ value: string
11
+ }[]
12
+ link?: LcbActionViewProps
7
13
  }
@@ -45,7 +45,7 @@ declare const __VLS_component: import('vue').DefineComponent<
45
45
  __VLS_WithDefaults<
46
46
  __VLS_TypePropsToOption<{
47
47
  prop: string
48
- className?: string
48
+ customClass?: string
49
49
  }>,
50
50
  {}
51
51
  >,
@@ -63,7 +63,7 @@ declare const __VLS_component: import('vue').DefineComponent<
63
63
  __VLS_WithDefaults<
64
64
  __VLS_TypePropsToOption<{
65
65
  prop: string
66
- className?: string
66
+ customClass?: string
67
67
  }>,
68
68
  {}
69
69
  >
@@ -13,7 +13,7 @@ export interface LcbProductItemProps {
13
13
  tagRound?: boolean
14
14
  distanceUnit?: string
15
15
  coverImg?: any
16
- title?: any
16
+ productName?: any
17
17
  subTitle?: any
18
18
  price?: any
19
19
  priceUnit?: any
@@ -25,7 +25,7 @@ export interface LcbProductItemProps {
25
25
  tags?: any
26
26
  addressIntro?: any
27
27
  distance?: any
28
- score?: any
28
+ scoreAvg?: any
29
29
  scoreTips?: any
30
30
  level?: any
31
31
  imgCornerIcon?: any
@@ -2,3 +2,5 @@ export declare function formatJson(str: string | object | undefined, defVal?: {}
2
2
  /** 获取上个页面Exposed */
3
3
  export declare const getExposed: () => any
4
4
  export declare const getPageOptions: () => Record<string, any>
5
+ /** 合并url参数 url = /pages/data/index?id=1&name=2 urlParams = id=1&name=2&type=1 */
6
+ export declare const getFinalUrl: (url: string, urlParams?: string) => string
package/utils/utils.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { parse, stringify } from 'qs'
1
2
  export function formatJson(str: string | object | undefined, defVal = {}) {
2
3
  if (!str) return defVal
3
4
  if (typeof str === 'object') return str
@@ -22,3 +23,14 @@ export const getPageOptions = () => {
22
23
  }
23
24
  return currentPage.options
24
25
  }
26
+ /** 合并url参数 url = /pages/data/index?id=1&name=2 urlParams = id=1&name=2&type=1 */
27
+ export const getFinalUrl = (url: string, urlParams?: string) => {
28
+ if (!urlParams) return url
29
+ const params = parse(urlParams)
30
+ const query = parse(url.split('?')[1])
31
+ const path = url.split('?')[0]
32
+ return `${path}?${stringify({
33
+ ...query,
34
+ ...params,
35
+ })}`
36
+ }