@tplc/business 0.1.13 → 0.1.15

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.
Files changed (111) hide show
  1. package/CHANGELOG.md +480 -0
  2. package/action.d.ts +2 -0
  3. package/{components/lcb-user-top/api/index.ts → api/user.ts} +1 -0
  4. package/components/lcb-action-view/lcb-action-view.vue +14 -2
  5. package/components/lcb-action-view/types.ts +21 -2
  6. package/components/lcb-advert/lcb-advert.vue +78 -0
  7. package/components/lcb-advert/types.ts +3 -0
  8. package/components/lcb-banner-block/lcb-banner-block.vue +3 -4
  9. package/components/lcb-block/lcb-block.vue +11 -3
  10. package/components/lcb-block/types.ts +5 -1
  11. package/components/lcb-button/lcb-button.vue +32 -0
  12. package/components/lcb-button/types.ts +8 -0
  13. package/components/lcb-calendar-search/lcb-calendar-search.vue +3 -2
  14. package/components/lcb-city-select/components/lcb-city-letter/index.vue +4 -1
  15. package/components/lcb-city-select/components/lcb-city-list/index.vue +6 -1
  16. package/components/lcb-city-select/lcb-city-select.vue +24 -8
  17. package/components/lcb-gap/lcb-gap.vue +15 -7
  18. package/components/lcb-gap/types.ts +4 -2
  19. package/components/lcb-grid/lcb-grid.vue +56 -20
  20. package/components/lcb-grid/types.ts +8 -0
  21. package/components/lcb-home-search/lcb-home-search.vue +44 -20
  22. package/components/lcb-img-nav/lcb-img-nav.vue +51 -30
  23. package/components/lcb-img-nav/types.ts +16 -0
  24. package/components/lcb-list/components/FilterList/index.vue +26 -21
  25. package/components/lcb-list/components/FilterList/type.ts +1 -1
  26. package/components/lcb-list/components/FilterView/index.vue +121 -0
  27. package/components/lcb-list/components/FilterView/type.ts +8 -0
  28. package/components/lcb-list/hooks/useSelect.ts +2 -0
  29. package/components/lcb-list/lcb-list.vue +57 -138
  30. package/components/lcb-list/types.ts +1 -0
  31. package/components/lcb-nav/lcb-nav.vue +22 -9
  32. package/components/lcb-notice/api/index.ts +21 -0
  33. package/components/lcb-notice/lcb-notice.vue +66 -50
  34. package/components/lcb-notice/types.ts +11 -26
  35. package/components/lcb-product/lcb-product.vue +114 -4
  36. package/components/lcb-product/types.ts +3 -0
  37. package/components/lcb-product-item/components/ItemValue.vue +14 -25
  38. package/components/lcb-product-item/lcb-product-item.vue +13 -7
  39. package/components/lcb-rich-text/lcb-rich-text.vue +22 -0
  40. package/components/lcb-rich-text/types.ts +5 -0
  41. package/components/lcb-text/lcb-text.vue +20 -0
  42. package/components/lcb-text/types.ts +5 -0
  43. package/components/lcb-title/lcb-title.vue +33 -6
  44. package/components/lcb-title/types.ts +17 -3
  45. package/components/lcb-user-order/lcb-user-order.vue +48 -61
  46. package/components/lcb-user-order/types.ts +5 -48
  47. package/components/lcb-user-top/Nums/index.vue +3 -2
  48. package/components/lcb-user-top/lcb-user-top.vue +40 -26
  49. package/components/lcb-vip/api/index.ts +35 -0
  50. package/components/lcb-vip/components/InfoDialog/index.vue +65 -0
  51. package/components/lcb-vip/lcb-vip.vue +96 -0
  52. package/components/lcb-vip/types.ts +8 -0
  53. package/constants.ts +2 -0
  54. package/global.d.ts +5 -0
  55. package/iconfonts/index.css +24 -3
  56. package/index.ts +5 -1
  57. package/package.json +18 -13
  58. package/types/{components/lcb-user-top/api/index.d.ts → api/user.d.ts} +2 -1
  59. package/types/components/lcb-action-view/lcb-action-view.vue.d.ts +2 -22
  60. package/types/components/lcb-action-view/types.d.ts +21 -2
  61. package/types/components/lcb-advert/lcb-advert.vue.d.ts +28 -0
  62. package/types/components/lcb-advert/types.d.ts +3 -0
  63. package/types/components/lcb-area-picker/lcb-area-picker.vue.d.ts +1 -1
  64. package/types/components/lcb-banner-block/lcb-banner-block.vue.d.ts +0 -9
  65. package/types/components/lcb-block/lcb-block.vue.d.ts +4 -0
  66. package/types/components/lcb-block/types.d.ts +5 -0
  67. package/types/components/lcb-button/lcb-button.vue.d.ts +42 -0
  68. package/types/components/lcb-button/types.d.ts +7 -0
  69. package/types/components/lcb-calendar-search/lcb-calendar-search.vue.d.ts +6 -4
  70. package/types/components/lcb-gap/types.d.ts +3 -2
  71. package/types/components/lcb-grid/lcb-grid.vue.d.ts +13 -4
  72. package/types/components/lcb-grid/types.d.ts +8 -0
  73. package/types/components/lcb-home-search/lcb-home-search.vue.d.ts +4 -1
  74. package/types/components/lcb-img-nav/lcb-img-nav.vue.d.ts +21 -2
  75. package/types/components/lcb-img-nav/types.d.ts +15 -0
  76. package/types/components/lcb-list/components/FilterList/index.vue.d.ts +12 -4
  77. package/types/components/lcb-list/components/FilterList/type.d.ts +1 -1
  78. package/types/components/lcb-list/components/FilterView/index.vue.d.ts +36 -0
  79. package/types/components/lcb-list/components/FilterView/type.d.ts +7 -0
  80. package/types/components/lcb-list/lcb-list.vue.d.ts +2 -1
  81. package/types/components/lcb-list/types.d.ts +1 -0
  82. package/types/components/lcb-nav/lcb-nav.vue.d.ts +0 -3
  83. package/types/components/lcb-notice/api/index.d.ts +19 -0
  84. package/types/components/lcb-notice/lcb-notice.vue.d.ts +25 -19
  85. package/types/components/lcb-notice/types.d.ts +11 -24
  86. package/types/components/lcb-product/lcb-product.vue.d.ts +3 -0
  87. package/types/components/lcb-product/types.d.ts +3 -0
  88. package/types/components/lcb-product-item/lcb-product-item.vue.d.ts +2 -2
  89. package/types/components/{lcb-notice/Item/index.vue.d.ts → lcb-rich-text/lcb-rich-text.vue.d.ts} +4 -16
  90. package/types/components/lcb-rich-text/types.d.ts +4 -0
  91. package/types/components/lcb-swiper/lcb-swiper.vue.d.ts +2 -2
  92. package/types/components/lcb-text/lcb-text.vue.d.ts +42 -0
  93. package/types/components/lcb-text/types.d.ts +4 -0
  94. package/types/components/lcb-title/lcb-title.vue.d.ts +27 -1
  95. package/types/components/lcb-title/types.d.ts +15 -3
  96. package/types/components/lcb-user-order/types.d.ts +5 -35
  97. package/types/components/lcb-user-top/Nums/index.vue.d.ts +6 -2
  98. package/types/components/lcb-vip/api/index.d.ts +34 -0
  99. package/types/components/lcb-vip/components/InfoDialog/index.vue.d.ts +38 -0
  100. package/types/components/lcb-vip/lcb-vip.vue.d.ts +68 -0
  101. package/types/components/lcb-vip/types.d.ts +8 -0
  102. package/types/constants.d.ts +2 -0
  103. package/types/index.d.ts +6 -0
  104. package/types/utils/auth.d.ts +2 -0
  105. package/types/utils/transform.d.ts +5 -1
  106. package/types/utils/utils.d.ts +2 -0
  107. package/utils/auth.ts +19 -0
  108. package/utils/transform.ts +13 -2
  109. package/utils/utils.ts +6 -1
  110. package/components/lcb-notice/Item/index.vue +0 -112
  111. package/types/components/lcb-list/components/FilterList/mockData.d.ts +0 -63
@@ -15,6 +15,7 @@
15
15
  <view
16
16
  :style="{
17
17
  gridTemplateColumns: `repeat(${pictureDistribution}, minmax(0, 1fr))`,
18
+ gap: transformValueUnit(itemGap),
18
19
  }"
19
20
  :class="[
20
21
  {
@@ -28,42 +29,65 @@
28
29
  v-for="item in items"
29
30
  :key="item.title"
30
31
  v-bind="item.link"
31
- custom-class="!flex flex-col justify-center items-center item"
32
+ @click="onItemClick(item)"
32
33
  >
33
34
  <view
34
- class="overflow-hidden"
35
+ class="!flex justify-center items-center item"
35
36
  :style="{
36
- marginBottom: iconTextMargin + 'rpx',
37
+ backgroundColor: itemBgColor,
38
+ borderRadius: transformValueUnit(itemRadius),
39
+ padding: `${transformValueUnit(itemVerticalPadding)} ${transformValueUnit(itemHorizontalPadding)}`,
40
+ flexDirection: itemFlexMode,
41
+ gap: transformValueUnit(iconTextMargin),
42
+ boxShadow:
43
+ itemShadowColor && itemShadowSize
44
+ ? `0px 0px ${itemBlurSize}px ${itemShadowSize}px ${itemShadowColor}`
45
+ : '',
46
+ marginRight: styleGroup === 1 ? transformValueUnit(itemGap) : 0,
37
47
  }"
38
48
  >
39
- <wd-icon
40
- v-if="iconType === 0"
41
- class-prefix="lcb"
42
- :name="item.icon!"
43
- :size="iconSize + 'rpx'"
44
- :color="iconColor"
45
- />
46
- <img
47
- v-else
48
- class="block"
49
+ <view class="overflow-hidden">
50
+ <wd-icon
51
+ v-if="iconType === 0"
52
+ class-prefix="lcb"
53
+ :name="item.icon!"
54
+ :size="iconSize + 'rpx'"
55
+ :color="iconColor"
56
+ />
57
+ <img
58
+ v-else
59
+ class="block"
60
+ :style="{
61
+ borderRadius: iconRadius + 'rpx',
62
+ height: iconSize + 'rpx',
63
+ width: iconSize + 'rpx',
64
+ }"
65
+ :src="item[urlKey]"
66
+ />
67
+ </view>
68
+ <view
69
+ class="title"
49
70
  :style="{
50
- borderRadius: iconRadius + 'rpx',
51
- height: iconSize + 'rpx',
52
- width: iconSize + 'rpx',
71
+ fontSize: transformValueUnit(textSize),
53
72
  }"
54
- :src="item.url"
55
- />
73
+ >
74
+ {{ item[titleKey] }}
75
+ </view>
76
+ <wd-icon v-if="styleGroup === 3" name="chevron-right" size="22"></wd-icon>
56
77
  </view>
57
- <view class="title">{{ item.title }}</view>
58
- <wd-icon v-if="styleGroup === 3" name="chevron-right" size="22"></wd-icon>
59
78
  </lcb-action-view>
60
79
  </view>
61
80
  </lcb-block>
62
81
  </template>
63
82
 
64
83
  <script lang="ts" setup>
84
+ import { ActionView } from '../../action'
85
+ import { transformValueUnit } from '../../utils/transform'
65
86
  import { LcbImgNavProps } from './types'
66
-
87
+ const emits = defineEmits(['click'])
88
+ const onItemClick = (item: ActionView) => {
89
+ emits('click', item)
90
+ }
67
91
  defineOptions({
68
92
  name: 'LcbImgNav',
69
93
  options: {
@@ -82,20 +106,19 @@ withDefaults(defineProps<LcbImgNavProps>(), {
82
106
  paddingHorizontal: 0,
83
107
  iconTextMargin: 4,
84
108
  pictureDistribution: 4,
109
+ textSize: 28,
110
+ urlKey: 'url',
111
+ titleKey: 'title',
112
+ itemFlexMode: 'column',
113
+ itemGap: 24,
85
114
  })
86
115
  </script>
87
116
 
88
117
  <style lang="scss" scoped>
89
118
  .single {
90
- display: flex;
91
- gap: 24rpx;
92
- width: 100%;
93
119
  overflow-x: auto;
94
120
  white-space: nowrap;
95
-
96
- > view {
97
- display: inline-flex;
98
- }
121
+ width: 100%;
99
122
  }
100
123
 
101
124
  .mutil {
@@ -116,9 +139,7 @@ withDefaults(defineProps<LcbImgNavProps>(), {
116
139
  }
117
140
  }
118
141
  .title {
119
- width: 68px;
120
142
  overflow: hidden;
121
- font-size: 28rpx;
122
143
  line-height: 1;
123
144
  text-align: center;
124
145
  letter-spacing: 0;
@@ -30,4 +30,20 @@ export interface LcbImgNavProps extends LcbBlockProps {
30
30
  fontSize?: number
31
31
  color?: string
32
32
  titlePadding?: number
33
+ textSize?: number
34
+ urlKey?: string
35
+ titleKey?: string
36
+
37
+ itemBgColor?: string
38
+ itemRadius?: number
39
+ itemVerticalPadding?: number
40
+ itemHorizontalPadding?: number
41
+ itemGap?: number
42
+ itemFlexMode?: 'row' | 'column'
43
+ /** 阴影颜色 */
44
+ itemShadowColor?: string
45
+ /** 阴影大小 */
46
+ itemShadowSize?: number
47
+ /** 模糊大小 */
48
+ itemBlurSize?: number
33
49
  }
@@ -1,23 +1,25 @@
1
1
  <template>
2
+ <view id="pagingTop"></view>
2
3
  <z-paging
3
4
  ref="paging"
4
5
  :empty-view-z-index="0"
5
6
  :auto="true"
6
7
  v-model="dataList"
7
8
  @query="queryList"
8
- use-page-scroll
9
+ :fixed="false"
10
+ :use-page-scroll="!autoHeight"
11
+ :height="autoHeight ? height : ''"
9
12
  >
10
- <slot :items="normalizeDataList"></slot>
13
+ <slot />
11
14
  </z-paging>
12
15
  </template>
13
16
 
14
17
  <script setup lang="ts">
15
- import { computed, ref, watch, useAttrs } from 'vue'
18
+ import { computed, getCurrentInstance, onMounted, ref, watch, watchEffect } from 'vue'
16
19
  import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging'
17
20
  import { LcbFilterListProps } from './type'
18
21
  import { formatJson } from '../../../../utils/utils'
19
- import mockData from './mockData'
20
- const attrs = useAttrs()
22
+ import { getRect, isH5 } from '@tplc/wot/components/common/util'
21
23
 
22
24
  defineOptions({
23
25
  name: 'FilterList',
@@ -30,28 +32,27 @@ defineOptions({
30
32
  const props = defineProps<LcbFilterListProps>()
31
33
  const dataList = ref<unknown[]>([])
32
34
  const paging = ref()
35
+ const viewPageHeight = uni.getSystemInfoSync().windowHeight
36
+ const height = ref('')
33
37
  useZPaging(paging)
34
-
35
- const normalizeDataList = computed(() => {
38
+ const modelValue = defineModel<unknown[]>({
39
+ default: [],
40
+ })
41
+ watchEffect(() => {
36
42
  const list = dataList.value?.map?.((item: any) => {
37
43
  const imgArr = formatJson(item.coverImg, [])
38
44
  const tags = formatJson(item.tags, [])
39
45
  return {
40
46
  image: imgArr?.[1] || imgArr?.[0],
41
47
  title: item?.productName,
42
- // subTitle: item?.poiName,
43
48
  location: item?.address,
44
49
  price: item?.price,
45
50
  priceSuffix: item?.behindUnit,
46
- // originPrice: item?.price,
47
- // originPriceSuffix: item?.behindUnit,
48
51
  ...item,
49
52
  tags,
50
53
  }
51
54
  })
52
- // console.log('list', list)
53
-
54
- return list
55
+ modelValue.value = list
55
56
  })
56
57
 
57
58
  watch(
@@ -80,7 +81,6 @@ watch(
80
81
  )
81
82
  const queryList = async (page: number, limit: number) => {
82
83
  try {
83
- // const { data } = mockData
84
84
  const { data } = await uni.$lcb.http.post(props.url, {
85
85
  ...props.baseParam,
86
86
  ...props.filter,
@@ -94,13 +94,17 @@ const queryList = async (page: number, limit: number) => {
94
94
  paging.value.complete(false)
95
95
  }
96
96
  }
97
-
98
- // watch(
99
- // () => dataList.value,
100
- // () => {
101
- // console.log('dataList', dataList.value)
102
- // },
103
- // )
97
+ const { proxy } = getCurrentInstance() as any
98
+ const isTabBar = uni.$lcb.getIsTabbar()
99
+ onMounted(() => {
100
+ getRect(`#pagingTop`, false, proxy).then((res) => {
101
+ if (!isTabBar || isH5) {
102
+ height.value = `${viewPageHeight - (res.top || 0)}px`
103
+ } else {
104
+ height.value = `calc(${viewPageHeight - (res.top || 0)}px - var(--window-bottom) - env(safe-area-inset-bottom))`
105
+ }
106
+ })
107
+ })
104
108
  </script>
105
109
  <style lang="scss" scoped>
106
110
  .action-view {
@@ -111,6 +115,7 @@ const queryList = async (page: number, limit: number) => {
111
115
  gap: 50rpx;
112
116
  padding: 20rpx 52rpx;
113
117
  box-sizing: border-box;
118
+
114
119
  :deep(.wd-button) {
115
120
  height: 100%;
116
121
  line-height: 100%;
@@ -7,5 +7,5 @@ export interface PageListProps {
7
7
  }
8
8
  export interface LcbFilterListProps extends PageListProps, LcbListInfo {
9
9
  filter?: Record<string, any>
10
- test?: any
10
+ autoHeight?: boolean
11
11
  }
@@ -0,0 +1,121 @@
1
+ <template>
2
+ <view
3
+ :class="{
4
+ 'lcb-filter__border-top': showPlain ? false : border,
5
+ 'lcb-filter__plain': showPlain,
6
+ 'lcb-filter__view': !showPlain,
7
+ }"
8
+ class="w-100vw"
9
+ >
10
+ <FilterTabs
11
+ v-model="filter[info?.filterTabs?.valueName]"
12
+ v-bind="info?.filterTabs?.componentProps"
13
+ v-if="info?.filterTabs"
14
+ />
15
+ <wd-drop-menu>
16
+ <wd-drop-menu-item
17
+ v-for="(item, index) in info?.filterComponent"
18
+ :key="item.valueName"
19
+ :title="titleObj[item.valueName] || item.filterName"
20
+ icon="caret-down-small"
21
+ icon-size="26rpx"
22
+ :selected="getSelect(item)"
23
+ ref="dropMenu"
24
+ @opened="handleOpened"
25
+ >
26
+ <view class="lcb-filter__popup">
27
+ <FilterSelect
28
+ v-if="item.component === 'select'"
29
+ v-bind="item.componentProps"
30
+ v-model="filter[item.valueName]"
31
+ v-model:title="titleObj[item.valueName]"
32
+ @submit="onSubmit(index)"
33
+ />
34
+ <TreeSelect
35
+ v-else-if="item.component === 'treeSelect'"
36
+ v-bind="item.componentProps"
37
+ v-model="filter[item.valueName]"
38
+ v-model:title="titleObj[item.valueName]"
39
+ @submit="onSubmit(index)"
40
+ />
41
+ <ComponentGroup
42
+ v-else-if="item.component === 'componentGroup'"
43
+ v-bind="item.componentProps"
44
+ :filter="filter"
45
+ @submit="onSubmit(index, $event)"
46
+ />
47
+ </view>
48
+ </wd-drop-menu-item>
49
+ </wd-drop-menu>
50
+ <view
51
+ v-if="info?.filterTags || info.btnComponent"
52
+ class="px-3 pb-2 box-border flex items-center"
53
+ :class="{
54
+ 'mt-2': showPlain,
55
+ }"
56
+ >
57
+ <view class="flex gap-3.5 flex-1">
58
+ <TagSelect
59
+ v-if="info.filterTags"
60
+ size="small"
61
+ v-bind="info.filterTags.componentProps"
62
+ v-model="filter[info.filterTags.valueName]"
63
+ />
64
+ </view>
65
+ <wd-button v-if="info?.btnComponent" custom-class="!h-60rpx opacity-primary">
66
+ {{ info?.btnComponent?.postRequest }}
67
+ </wd-button>
68
+ </view>
69
+ </view>
70
+ </template>
71
+
72
+ <script setup lang="ts">
73
+ import { computed, ref } from 'vue'
74
+ import { FilterComponent } from '../../../lcb-list/api'
75
+ import ComponentGroup from '../ComponentGroup/index.vue'
76
+ import FilterSelect from '../FilterSelect/index.vue'
77
+ import FilterTabs from '../FilterTabs/index.vue'
78
+ import TagSelect from '../TagSelect/index.vue'
79
+ import TreeSelect from '../TreeSelect/index.vue'
80
+ import { FilterViewProps } from './type'
81
+
82
+ defineOptions({
83
+ name: 'FilterView',
84
+ options: {
85
+ addGlobalClass: true,
86
+ virtualHost: true,
87
+ styleIsolation: 'shared',
88
+ },
89
+ })
90
+ const dropMenu = ref()
91
+ const props = defineProps<FilterViewProps>()
92
+
93
+ const filter = defineModel<Record<string, any>>({
94
+ default: {},
95
+ })
96
+ const showPlain = computed(() => {
97
+ return props.styleMode === 'plain' && !props.sticky
98
+ })
99
+
100
+ const onSubmit = (index: number, filterObj?: Record<string, any>) => {
101
+ dropMenu.value?.[index]?.close()
102
+ if (filterObj) {
103
+ filter.value = {
104
+ ...filter.value,
105
+ ...filterObj,
106
+ }
107
+ }
108
+ }
109
+ const getSelect = (item: FilterComponent) => {
110
+ if (item.component === 'componentGroup') {
111
+ return item.componentProps.componentList?.some((v) => filter.value[v.valueName])
112
+ } else {
113
+ return Boolean(filter.value[item.valueName])
114
+ }
115
+ }
116
+
117
+ const handleOpened = () => {
118
+ uni.$emit('drop-opened')
119
+ }
120
+ </script>
121
+ <style lang="scss" scoped></style>
@@ -0,0 +1,8 @@
1
+ import { LcbFilterResult } from '../../../lcb-list/api'
2
+ import { LcbListProps } from '../../types'
3
+
4
+ export interface FilterViewProps extends LcbListProps {
5
+ info: LcbFilterResult
6
+ titleObj: Record<string, any>
7
+ sticky: boolean
8
+ }
@@ -16,6 +16,8 @@ const useSelect = (
16
16
  } else {
17
17
  model.value = [...(model.value || []), item.value as string]
18
18
  }
19
+ } else if (model.value === item.value) {
20
+ model.value = undefined
19
21
  } else {
20
22
  model.value = item.value
21
23
  }
@@ -1,108 +1,54 @@
1
1
  <template>
2
- <view v-if="info" class="bg-gray-100">
3
- <wd-sticky @sticky="sticky = $event" :offset-top="0.0001">
4
- <view
5
- :class="{
6
- 'lcb-filter__border-top': showPlain ? false : border,
7
- 'lcb-filter__plain': showPlain,
8
- 'lcb-filter__view': !showPlain,
9
- }"
10
- class="w-100vw"
11
- >
12
- <FilterTabs
13
- v-model="filter[info?.filterTabs?.valueName]"
14
- v-bind="info?.filterTabs?.componentProps"
15
- v-if="info?.filterTabs"
16
- />
17
- <wd-drop-menu>
18
- <wd-drop-menu-item
19
- v-for="(item, index) in info?.filterComponent"
20
- :key="item.valueName"
21
- :title="titleObj[item.valueName] || item.filterName"
22
- icon="caret-down-small"
23
- icon-size="26px"
24
- :selected="getSelect(item)"
25
- ref="dropMenu"
26
- @opened="handleOpened"
27
- >
28
- <view class="lcb-filter__popup">
29
- <FilterSelect
30
- v-if="item.component === 'select'"
31
- v-bind="item.componentProps"
32
- v-model="filter[item.valueName]"
33
- v-model:title="titleObj[item.valueName]"
34
- @submit="onSubmit(index)"
35
- />
36
- <TreeSelect
37
- v-else-if="item.component === 'treeSelect'"
38
- v-bind="item.componentProps"
39
- v-model="filter[item.valueName]"
40
- v-model:title="titleObj[item.valueName]"
41
- @submit="onSubmit(index)"
42
- />
43
- <ComponentGroup
44
- v-else-if="item.component === 'componentGroup'"
45
- v-bind="item.componentProps"
46
- :filter="filter"
47
- @submit="onSubmit(index, $event)"
48
- />
49
- </view>
50
- </wd-drop-menu-item>
51
- </wd-drop-menu>
52
- <view
53
- v-if="info?.filterTags || info.btnComponent"
54
- class="bg-white px-3 pb-2 box-border flex items-center"
55
- >
56
- <view class="flex gap-3.5 flex-1">
57
- <TagSelect
58
- v-if="info.filterTags"
59
- size="small"
60
- v-bind="info.filterTags.componentProps"
61
- v-model="filter[info.filterTags.valueName]"
62
- />
63
- </view>
64
- <wd-button v-if="info.btnComponent" custom-class="!h-60rpx opacity-primary">
65
- {{ info.btnComponent?.postRequest }}
66
- </wd-button>
67
- </view>
68
- </view>
2
+ <template v-if="info">
3
+ <wd-sticky @sticky="sticky = $event" :offset-top="0.0001" v-if="isSticky">
4
+ <FilterView
5
+ v-bind="$props"
6
+ :info="info"
7
+ v-model="filter"
8
+ :titleObj="titleObj"
9
+ :sticky="sticky"
10
+ />
69
11
  </wd-sticky>
12
+ <FilterView
13
+ v-else
14
+ v-bind="$props"
15
+ :info="info"
16
+ v-model="filter"
17
+ :titleObj="titleObj"
18
+ :sticky="sticky"
19
+ />
70
20
 
71
- <FilterList v-bind="{ ...info.listInfo, listType, filter, ...attrs }">
72
- <template #default="{ items }">
73
- <slot name="list" :items="items">
74
- <lcb-product v-bind="{ ...attrs }" :listType="listType" :items="items" v-if="$slots.item">
75
- <template #item="{ item }">
76
- <slot name="item" :item="item"></slot>
77
- </template>
78
- </lcb-product>
79
- <lcb-product
80
- v-bind="{ ...attrs }"
81
- :listType="listType"
82
- :items="items"
83
- v-else
84
- ></lcb-product>
85
- </slot>
21
+ <FilterList
22
+ v-bind="{ ...info.listInfo, listType, filter, ...attrs }"
23
+ :autoHeight="!isSticky"
24
+ v-model="items"
25
+ >
26
+ <slot name="list" :items="items" v-if="$slots.list" />
27
+ <template v-else>
28
+ <lcb-product v-bind="{ ...attrs }" :listType="listType" :items="items" v-if="$slots.item">
29
+ <template #item="{ item }">
30
+ <slot name="item" :item="item"></slot>
31
+ </template>
32
+ </lcb-product>
33
+ <lcb-product v-bind="{ ...attrs }" :listType="listType" :items="items" v-else></lcb-product>
86
34
  </template>
87
35
  </FilterList>
88
- </view>
36
+ </template>
89
37
  </template>
90
38
 
91
39
  <script setup lang="ts">
92
- import { computed, inject, Ref, ref, watch, useAttrs } from 'vue'
93
- import { LcbListProps } from './types'
94
- import { FilterComponent, getFilterDetail, LcbFilterResult } from './api'
95
- import FilterSelect from './components/FilterSelect/index.vue'
96
- import TreeSelect from './components/TreeSelect/index.vue'
97
- import ComponentGroup from './components/ComponentGroup/index.vue'
98
- import TagSelect from './components/TagSelect/index.vue'
40
+ import { inject, Ref, ref, useAttrs, watch } from 'vue'
41
+ import { getFilterDetail, LcbFilterResult } from './api'
99
42
  import FilterList from './components/FilterList/index.vue'
100
- import FilterTabs from './components/FilterTabs/index.vue'
43
+ import FilterView from './components/FilterView/index.vue'
44
+ import { LcbListProps } from './types'
101
45
 
102
- import './index.scss'
103
46
  import { FORM_KEY } from '../../constants'
47
+ import './index.scss'
104
48
  const attrs = useAttrs()
105
-
49
+ /** 是否悬停 */
50
+ const sticky = ref(false)
51
+ const items = ref([])
106
52
  defineOptions({
107
53
  name: 'LcbList',
108
54
  options: {
@@ -111,13 +57,15 @@ defineOptions({
111
57
  styleIsolation: 'shared',
112
58
  },
113
59
  })
60
+ const titleObj = ref<Record<string, any>>({})
114
61
  const form = inject<Ref<Record<string, any>>>(FORM_KEY)
115
- const dropMenu = ref()
62
+ const filter = ref<Record<string, any>>({})
116
63
  const props = withDefaults(defineProps<LcbListProps>(), {
117
64
  pageFilterType: 'hotelTravelFilter',
118
65
  border: true,
119
66
  styleMode: 'default',
120
67
  listType: 'list',
68
+ isSticky: true,
121
69
  // @ts-ignore
122
70
  pageListProps: () => ({
123
71
  productProps: {
@@ -126,14 +74,21 @@ const props = withDefaults(defineProps<LcbListProps>(), {
126
74
  }),
127
75
  } as LcbListProps as any)
128
76
  const info = ref<LcbFilterResult>()
129
- const filter = ref<Record<string, any>>({})
130
- const titleObj = ref<Record<string, any>>({})
131
- /** 是否悬停 */
132
- const sticky = ref(false)
133
- const showPlain = computed(() => {
134
- // console.log(props.styleMode, sticky.value, 'showPlain')
135
- return props.styleMode === 'plain' && !sticky.value
136
- })
77
+ watch(
78
+ () => filter.value,
79
+ async (val) => {
80
+ if (form && Object.keys(val).length) {
81
+ form.value = {
82
+ ...form.value,
83
+ ...val,
84
+ }
85
+ }
86
+ },
87
+ {
88
+ immediate: true,
89
+ deep: true,
90
+ },
91
+ )
137
92
  watch(
138
93
  () => props.pageFilterType,
139
94
  async (val) => {
@@ -163,42 +118,6 @@ watch(
163
118
  immediate: true,
164
119
  },
165
120
  )
166
- const onSubmit = (index: number, filterObj?: Record<string, any>) => {
167
- dropMenu.value?.[index]?.close()
168
- if (filterObj) {
169
- filter.value = {
170
- ...filter.value,
171
- ...filterObj,
172
- }
173
- }
174
- }
175
- const getSelect = (item: FilterComponent) => {
176
- if (item.component === 'componentGroup') {
177
- return item.componentProps.componentList?.some((v) => filter.value[v.valueName])
178
- } else {
179
- return Boolean(filter.value[item.valueName])
180
- }
181
- }
182
- const handleOpened = () => {
183
- uni.$emit('drop-opened')
184
- }
185
-
186
- watch(
187
- () => filter.value,
188
- async (val) => {
189
- if (form && Object.keys(val).length) {
190
- form.value = {
191
- ...form.value,
192
- ...val,
193
- }
194
- }
195
- },
196
- {
197
- immediate: true,
198
- deep: true,
199
- },
200
- )
201
-
202
121
  defineSlots<{
203
122
  list(props: { items: any }): any
204
123
  item(props: { item: any }): any
@@ -7,6 +7,7 @@ export interface LcbListProps {
7
7
  border?: boolean
8
8
  styleMode?: 'default' | 'plain'
9
9
  listType?: LcbProductProps['listType']
10
+ isSticky?: boolean
10
11
  }
11
12
  export interface Option {
12
13
  label: string