@tplc/business 0.1.11 → 0.1.13
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 +49 -0
- package/action.d.ts +1 -1
- package/components/lcb-image/Image/index.vue +2 -1
- package/components/lcb-list/components/FilterList/index.vue +9 -4
- package/components/lcb-list/components/FilterList/mockData.ts +575 -0
- package/components/lcb-list/lcb-list.vue +28 -16
- package/components/lcb-list/types.ts +0 -13
- package/components/lcb-product/lcb-product.vue +37 -33
- package/components/lcb-product-item/components/ItemValue.vue +103 -22
- package/components/lcb-product-item/lcb-product-item.vue +249 -70
- package/components/lcb-product-item/types.ts +15 -14
- package/package.json +1 -1
- package/types/components/lcb-list/components/FilterList/mockData.d.ts +63 -0
- package/types/components/lcb-list/lcb-list.vue.d.ts +7 -3
- package/types/components/lcb-list/types.d.ts +0 -1
- package/types/components/lcb-product/lcb-product.vue.d.ts +2 -22
- package/types/components/lcb-product-item/components/ItemValue.vue.d.ts +26 -8
- package/types/components/lcb-product-item/lcb-product-item.vue.d.ts +63 -23
- package/types/components/lcb-product-item/types.d.ts +14 -13
|
@@ -71,18 +71,17 @@
|
|
|
71
71
|
<FilterList v-bind="{ ...info.listInfo, listType, filter, ...attrs }">
|
|
72
72
|
<template #default="{ items }">
|
|
73
73
|
<slot name="list" :items="items">
|
|
74
|
-
|
|
75
|
-
<template #item="
|
|
76
|
-
<slot name="item"
|
|
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
77
|
</template>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
</lcb-product> -->
|
|
78
|
+
</lcb-product>
|
|
79
|
+
<lcb-product
|
|
80
|
+
v-bind="{ ...attrs }"
|
|
81
|
+
:listType="listType"
|
|
82
|
+
:items="items"
|
|
83
|
+
v-else
|
|
84
|
+
></lcb-product>
|
|
86
85
|
</slot>
|
|
87
86
|
</template>
|
|
88
87
|
</FilterList>
|
|
@@ -91,7 +90,7 @@
|
|
|
91
90
|
|
|
92
91
|
<script setup lang="ts">
|
|
93
92
|
import { computed, inject, Ref, ref, watch, useAttrs } from 'vue'
|
|
94
|
-
import { LcbListProps
|
|
93
|
+
import { LcbListProps } from './types'
|
|
95
94
|
import { FilterComponent, getFilterDetail, LcbFilterResult } from './api'
|
|
96
95
|
import FilterSelect from './components/FilterSelect/index.vue'
|
|
97
96
|
import TreeSelect from './components/TreeSelect/index.vue'
|
|
@@ -99,14 +98,11 @@ import ComponentGroup from './components/ComponentGroup/index.vue'
|
|
|
99
98
|
import TagSelect from './components/TagSelect/index.vue'
|
|
100
99
|
import FilterList from './components/FilterList/index.vue'
|
|
101
100
|
import FilterTabs from './components/FilterTabs/index.vue'
|
|
102
|
-
import { lcbProductItemContentTypes } from '../lcb-product-item/types'
|
|
103
101
|
|
|
104
102
|
import './index.scss'
|
|
105
103
|
import { FORM_KEY } from '../../constants'
|
|
106
104
|
const attrs = useAttrs()
|
|
107
105
|
|
|
108
|
-
const slotNames = [...lcbProductItemContentTypes, 'item']
|
|
109
|
-
|
|
110
106
|
defineOptions({
|
|
111
107
|
name: 'LcbList',
|
|
112
108
|
options: {
|
|
@@ -117,7 +113,18 @@ defineOptions({
|
|
|
117
113
|
})
|
|
118
114
|
const form = inject<Ref<Record<string, any>>>(FORM_KEY)
|
|
119
115
|
const dropMenu = ref()
|
|
120
|
-
const props = withDefaults(defineProps<LcbListProps>(),
|
|
116
|
+
const props = withDefaults(defineProps<LcbListProps>(), {
|
|
117
|
+
pageFilterType: 'hotelTravelFilter',
|
|
118
|
+
border: true,
|
|
119
|
+
styleMode: 'default',
|
|
120
|
+
listType: 'list',
|
|
121
|
+
// @ts-ignore
|
|
122
|
+
pageListProps: () => ({
|
|
123
|
+
productProps: {
|
|
124
|
+
// listType: 'list',
|
|
125
|
+
},
|
|
126
|
+
}),
|
|
127
|
+
} as LcbListProps as any)
|
|
121
128
|
const info = ref<LcbFilterResult>()
|
|
122
129
|
const filter = ref<Record<string, any>>({})
|
|
123
130
|
const titleObj = ref<Record<string, any>>({})
|
|
@@ -191,6 +198,11 @@ watch(
|
|
|
191
198
|
deep: true,
|
|
192
199
|
},
|
|
193
200
|
)
|
|
201
|
+
|
|
202
|
+
defineSlots<{
|
|
203
|
+
list(props: { items: any }): any
|
|
204
|
+
item(props: { item: any }): any
|
|
205
|
+
}>()
|
|
194
206
|
</script>
|
|
195
207
|
|
|
196
208
|
<style lang="scss" scoped>
|
|
@@ -24,16 +24,3 @@ export interface FilterItemProps {
|
|
|
24
24
|
options?: Option[]
|
|
25
25
|
test?: 1
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
export const defaultLcbListProps: LcbListProps = {
|
|
29
|
-
pageFilterType: 'hotelTravelFilter',
|
|
30
|
-
border: true,
|
|
31
|
-
styleMode: 'default',
|
|
32
|
-
listType: 'list',
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
pageListProps: () => ({
|
|
35
|
-
productProps: {
|
|
36
|
-
// listType: 'list',
|
|
37
|
-
},
|
|
38
|
-
}),
|
|
39
|
-
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, useAttrs } from 'vue'
|
|
3
3
|
import { LcbProductProps } from './types'
|
|
4
|
-
import { lcbProductItemContentTypes } from '../lcb-product-item/types'
|
|
5
4
|
|
|
6
5
|
const attrs = useAttrs()
|
|
7
6
|
defineOptions({
|
|
@@ -20,17 +19,7 @@ const props = withDefaults(defineProps<LcbProductProps>(), {
|
|
|
20
19
|
itemHeight: 560,
|
|
21
20
|
} as any)
|
|
22
21
|
defineSlots<{
|
|
23
|
-
|
|
24
|
-
title(): any
|
|
25
|
-
subTitle(): any
|
|
26
|
-
price(): any
|
|
27
|
-
priceUnit(): any
|
|
28
|
-
priceSuffix(): any
|
|
29
|
-
originPrice(): any
|
|
30
|
-
originPriceUnit(): any
|
|
31
|
-
tags(): any
|
|
32
|
-
location(): any
|
|
33
|
-
distance(): any
|
|
22
|
+
item(props: { item: any }): any
|
|
34
23
|
}>()
|
|
35
24
|
</script>
|
|
36
25
|
|
|
@@ -43,13 +32,31 @@ defineSlots<{
|
|
|
43
32
|
v-bind="{ ...item, ...attrs }"
|
|
44
33
|
:imageStyle="{ width: `${imageWidthPercent}%` }"
|
|
45
34
|
>
|
|
46
|
-
<template
|
|
47
|
-
|
|
48
|
-
:key="slotName"
|
|
49
|
-
#[slotName]="slotContext"
|
|
50
|
-
>
|
|
51
|
-
<slot :name="slotName" v-bind="slotContext" />
|
|
35
|
+
<!-- <template #itemTopSection>
|
|
36
|
+
<view class="min-w-10 min-h-10 bg-red-500/50"></view>
|
|
52
37
|
</template>
|
|
38
|
+
<template #itemBottomSection>
|
|
39
|
+
<view class="min-w-10 min-h-10 bg-yellow-500/50"></view>
|
|
40
|
+
</template>
|
|
41
|
+
<template #itemLeftSection>
|
|
42
|
+
<view class="min-w-10 min-h-10 bg-blue-500/50"></view>
|
|
43
|
+
</template>
|
|
44
|
+
<template #itemRightSection>
|
|
45
|
+
<view class="min-w-10 min-h-10 bg-green-500/50"></view>
|
|
46
|
+
</template> -->
|
|
47
|
+
|
|
48
|
+
<!-- <template #imageSection>
|
|
49
|
+
<view class="min-w-5 min-h-5 bg-yellow-400 right-1 top-1 absolute z-10"></view>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<template #itemSection>
|
|
53
|
+
<view class="min-w-10 min-h-10 bg-blue-500/50 right-0 top-0 absolute z-10"></view>
|
|
54
|
+
</template>
|
|
55
|
+
<template #contentSection>
|
|
56
|
+
<view
|
|
57
|
+
class="min-w-15 min-h-15 bg-gray-500/20 right-10 top-10 absolute z-10 rounded-full"
|
|
58
|
+
></view>
|
|
59
|
+
</template> -->
|
|
53
60
|
</lcb-product-item>
|
|
54
61
|
</slot>
|
|
55
62
|
</view>
|
|
@@ -66,13 +73,18 @@ defineSlots<{
|
|
|
66
73
|
className="!h-full"
|
|
67
74
|
:imageStyle="{ height: `${imageHeightPercent}%` }"
|
|
68
75
|
>
|
|
69
|
-
<template
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
<slot :name="slotName" v-bind="slotContext" />
|
|
76
|
+
<!-- <template #itemTopSection>
|
|
77
|
+
<view class="min-w-10 min-h-10 bg-red-500/50"></view>
|
|
78
|
+
</template>
|
|
79
|
+
<template #itemBottomSection>
|
|
80
|
+
<view class="min-w-10 min-h-10 bg-yellow-500/50"></view>
|
|
75
81
|
</template>
|
|
82
|
+
<template #itemLeftSection>
|
|
83
|
+
<view class="min-w-10 min-h-10 bg-blue-500/50"></view>
|
|
84
|
+
</template>
|
|
85
|
+
<template #itemRightSection>
|
|
86
|
+
<view class="min-w-10 min-h-10 bg-green-500/50"></view>
|
|
87
|
+
</template> -->
|
|
76
88
|
</lcb-product-item>
|
|
77
89
|
</slot>
|
|
78
90
|
</view>
|
|
@@ -88,15 +100,7 @@ defineSlots<{
|
|
|
88
100
|
class="!w-66vw flex-shrink-0"
|
|
89
101
|
>
|
|
90
102
|
<slot name="item" :item="item">
|
|
91
|
-
<lcb-product-item v-bind="item" imageClass="!w-1/2">
|
|
92
|
-
<template
|
|
93
|
-
v-for="slotName in lcbProductItemContentTypes"
|
|
94
|
-
:key="slotName"
|
|
95
|
-
#[slotName]="slotContext"
|
|
96
|
-
>
|
|
97
|
-
<slot :name="slotName" v-bind="slotContext" />
|
|
98
|
-
</template>
|
|
99
|
-
</lcb-product-item>
|
|
103
|
+
<lcb-product-item v-bind="item" imageClass="!w-1/2"></lcb-product-item>
|
|
100
104
|
</slot>
|
|
101
105
|
</view>
|
|
102
106
|
</view>
|
|
@@ -4,7 +4,7 @@ import { isArray } from '@tplc/wot/components/common/util'
|
|
|
4
4
|
|
|
5
5
|
// const attrs = useAttrs()
|
|
6
6
|
|
|
7
|
-
const itemProps = inject('lcb-product-item-props')
|
|
7
|
+
const itemProps: any = inject('lcb-product-item-props')
|
|
8
8
|
|
|
9
9
|
const props = withDefaults(
|
|
10
10
|
defineProps<{
|
|
@@ -14,19 +14,20 @@ const props = withDefaults(
|
|
|
14
14
|
{},
|
|
15
15
|
)
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
defineSlots<{
|
|
18
|
+
image(props: { value: any }): any
|
|
19
|
+
title(props: { value: any }): any
|
|
20
|
+
subTitle(props: { value: any }): any
|
|
21
|
+
price(props: { value: any }): any
|
|
22
|
+
priceUnit(props: { value: any }): any
|
|
23
|
+
priceSuffix(props: { value: any }): any
|
|
24
|
+
originPrice(props: { value: any }): any
|
|
25
|
+
originPriceUnit(props: { value: any }): any
|
|
26
|
+
originPriceSuffix(props: { value: any }): any
|
|
27
|
+
tags(props: { value: any }): any
|
|
28
|
+
location(props: { value: any }): any
|
|
29
|
+
distance(props: { value: any }): any
|
|
30
|
+
}>()
|
|
30
31
|
|
|
31
32
|
const visible = computed(() => {
|
|
32
33
|
return itemProps?.[`${props?.prop}Visible`] ?? true
|
|
@@ -43,17 +44,44 @@ const value = computed(() => {
|
|
|
43
44
|
</script>
|
|
44
45
|
|
|
45
46
|
<template>
|
|
46
|
-
<template
|
|
47
|
+
<template
|
|
48
|
+
v-if="visible && (prop === 'image' || (!!value && (isArray(value) ? value?.length > 0 : true)))"
|
|
49
|
+
>
|
|
47
50
|
<!-- 图片 -->
|
|
48
51
|
<slot :value="value" v-if="prop === 'image'" name="image">
|
|
49
52
|
<view :value="value" :class="className" :style="style">
|
|
50
53
|
<image :src="value" class="w-full h-full" mode="aspectFill" />
|
|
54
|
+
<slot></slot>
|
|
51
55
|
</view>
|
|
52
56
|
</slot>
|
|
53
57
|
|
|
54
58
|
<!-- 标题 -->
|
|
55
59
|
<slot :value="value" v-if="prop === 'title'" name="title">
|
|
56
|
-
<view
|
|
60
|
+
<view
|
|
61
|
+
:class="[
|
|
62
|
+
className,
|
|
63
|
+
'text-ellipsis',
|
|
64
|
+
{
|
|
65
|
+
'line-clamp-1': itemProps?.titleLineClamp === 1,
|
|
66
|
+
'line-clamp-2': itemProps?.titleLineClamp === 2,
|
|
67
|
+
'line-clamp-3': itemProps?.titleLineClamp === 3,
|
|
68
|
+
},
|
|
69
|
+
]"
|
|
70
|
+
:style="style"
|
|
71
|
+
:value="value"
|
|
72
|
+
>
|
|
73
|
+
<view>{{ value }}</view>
|
|
74
|
+
</view>
|
|
75
|
+
</slot>
|
|
76
|
+
|
|
77
|
+
<!-- 副标题 -->
|
|
78
|
+
<slot :value="value" v-if="prop === 'subTitle'" name="subTitle">
|
|
79
|
+
<view
|
|
80
|
+
:class="className"
|
|
81
|
+
:style="style"
|
|
82
|
+
:value="value"
|
|
83
|
+
class="text-22rpx text-gray-500 text-ellipsis line-clamp-1"
|
|
84
|
+
>
|
|
57
85
|
<view>{{ value }}</view>
|
|
58
86
|
</view>
|
|
59
87
|
</slot>
|
|
@@ -67,17 +95,35 @@ const value = computed(() => {
|
|
|
67
95
|
class="text-gray-500 text-22rpx flex gap-3rpx items-center"
|
|
68
96
|
>
|
|
69
97
|
<wd-icon name="location" size="32rpx"></wd-icon>
|
|
70
|
-
<view>{{ value }}</view>
|
|
98
|
+
<view class="text-ellipsis line-clamp-1">{{ value }}</view>
|
|
71
99
|
</view>
|
|
72
100
|
</slot>
|
|
73
101
|
|
|
74
|
-
<!--
|
|
75
|
-
<slot :value="value" v-if="prop === '
|
|
102
|
+
<!-- 距离 -->
|
|
103
|
+
<slot :value="value" v-if="prop === 'distance'" name="distance">
|
|
76
104
|
<view
|
|
77
105
|
:class="className"
|
|
78
106
|
:style="style"
|
|
79
107
|
:value="value"
|
|
80
|
-
class="flex gap-
|
|
108
|
+
class="text-gray-500 text-22rpx flex gap-3rpx items-center"
|
|
109
|
+
>
|
|
110
|
+
<wd-icon name="location" size="32rpx"></wd-icon>
|
|
111
|
+
<view class="text-ellipsis line-clamp-1">
|
|
112
|
+
距您{{ value }}{{ itemProps?.distanceUnit ?? 'km' }}
|
|
113
|
+
</view>
|
|
114
|
+
</view>
|
|
115
|
+
</slot>
|
|
116
|
+
|
|
117
|
+
<!-- 标签 -->
|
|
118
|
+
<slot :value="value" v-if="prop === 'tags'" name="tags">
|
|
119
|
+
<view
|
|
120
|
+
:class="[
|
|
121
|
+
'flex gap-1',
|
|
122
|
+
{
|
|
123
|
+
'whitespace-nowrap overflow-auto': !itemProps?.tagOverflowWrap,
|
|
124
|
+
'flex-wrap': itemProps?.tagOverflowWrap,
|
|
125
|
+
},
|
|
126
|
+
]"
|
|
81
127
|
>
|
|
82
128
|
<wd-tag
|
|
83
129
|
v-for="tag in value"
|
|
@@ -85,8 +131,12 @@ const value = computed(() => {
|
|
|
85
131
|
class="!text-20rpx"
|
|
86
132
|
:class="className"
|
|
87
133
|
:style="style"
|
|
88
|
-
|
|
89
|
-
|
|
134
|
+
:color="itemProps?.tagContentColor"
|
|
135
|
+
:bg-color="itemProps?.tagBgColor"
|
|
136
|
+
:plain="itemProps?.tagPlain ?? true"
|
|
137
|
+
:mark="itemProps?.tagMark ?? false"
|
|
138
|
+
:round="itemProps?.tagRound ?? false"
|
|
139
|
+
:type="itemProps?.tagType ?? 'primary'"
|
|
90
140
|
>
|
|
91
141
|
{{ tag }}
|
|
92
142
|
</wd-tag>
|
|
@@ -123,5 +173,36 @@ const value = computed(() => {
|
|
|
123
173
|
<view>{{ value }}</view>
|
|
124
174
|
</view>
|
|
125
175
|
</slot>
|
|
176
|
+
|
|
177
|
+
<!-- 原始价格单位 -->
|
|
178
|
+
<slot :value="value" v-if="prop === 'originPriceUnit'" name="originPriceUnit">
|
|
179
|
+
<view
|
|
180
|
+
:class="className"
|
|
181
|
+
:style="style"
|
|
182
|
+
:value="value"
|
|
183
|
+
class="text-gray-500 font-bold text-19rpx"
|
|
184
|
+
>
|
|
185
|
+
<view>{{ value }}</view>
|
|
186
|
+
</view>
|
|
187
|
+
</slot>
|
|
188
|
+
|
|
189
|
+
<!-- 原始价格 -->
|
|
190
|
+
<slot :value="value" v-if="prop === 'originPrice'" name="originPrice">
|
|
191
|
+
<view
|
|
192
|
+
:class="className"
|
|
193
|
+
:style="style"
|
|
194
|
+
:value="value"
|
|
195
|
+
class="text-gray-500 font-bold text-20rpx"
|
|
196
|
+
>
|
|
197
|
+
<view>{{ value }}</view>
|
|
198
|
+
</view>
|
|
199
|
+
</slot>
|
|
200
|
+
|
|
201
|
+
<!-- 原始价格后缀 -->
|
|
202
|
+
<slot :value="value" v-if="prop === 'originPriceSuffix'" name="originPriceSuffix">
|
|
203
|
+
<view :class="className" :style="style" :value="value" class="text-gray-500 text-20rpx">
|
|
204
|
+
<view>{{ value }}</view>
|
|
205
|
+
</view>
|
|
206
|
+
</slot>
|
|
126
207
|
</template>
|
|
127
208
|
</template>
|