@tplc/business 0.0.25 → 0.0.27
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 +27 -0
- package/components/lcb-calendar/api/index.ts +17 -0
- package/components/lcb-calendar/lcb-calendar.vue +116 -0
- package/components/lcb-calendar-search/lcb-calendar-search.vue +69 -0
- package/components/lcb-calendar-search/types.ts +6 -0
- package/components/lcb-city-select/api/index.ts +20 -0
- package/components/lcb-city-select/lcb-city-select.vue +168 -0
- package/components/lcb-city-select/types.ts +7 -0
- package/components/lcb-filter/components/ComponentGroup/index.vue +31 -0
- package/components/lcb-filter/components/TreeSelect/index.vue +3 -2
- package/components/lcb-filter/lcb-filter.vue +19 -1
- package/components/lcb-home-search/lcb-home-search.vue +38 -13
- package/components/lcb-image/Image/index.vue +8 -10
- package/components/lcb-img-nav/lcb-img-nav.vue +9 -1
- package/components/lcb-img-nav/types.ts +4 -0
- package/components/lcb-product/lcb-product.vue +47 -0
- package/components/lcb-product/types.ts +14 -0
- package/components/lcb-product-item/lcb-product-item.vue +85 -0
- package/components/lcb-product-item/types.ts +14 -0
- package/components/lcb-tags/Tag/index.vue +27 -0
- package/components/lcb-tags/lcb-tags.vue +49 -0
- package/components/lcb-tags/types.ts +30 -0
- package/components/lcb-title/lcb-title.vue +14 -8
- package/components/lcb-title/types.ts +5 -0
- package/constants.ts +1 -0
- package/global.d.ts +6 -0
- package/hooks/useLocation.api.ts +7 -0
- package/hooks/useLocation.ts +78 -0
- package/package.json +2 -2
- package/types/components/lcb-calendar/api/index.d.ts +16 -0
- package/types/components/lcb-calendar/lcb-calendar.vue.d.ts +137 -0
- package/types/components/lcb-calendar-search/lcb-calendar-search.vue.d.ts +62 -0
- package/types/components/lcb-calendar-search/types.d.ts +4 -0
- package/types/components/lcb-city-select/api/index.d.ts +19 -0
- package/types/components/lcb-city-select/lcb-city-select.vue.d.ts +68 -0
- package/types/components/lcb-city-select/types.d.ts +5 -0
- package/types/components/lcb-filter/components/ActionView/index.vue.d.ts +1 -1
- package/types/components/lcb-img-nav/lcb-img-nav.vue.d.ts +1 -1
- package/types/components/lcb-img-nav/types.d.ts +4 -0
- package/types/components/lcb-product/lcb-product.vue.d.ts +42 -0
- package/types/components/lcb-product/types.d.ts +13 -0
- package/types/components/lcb-product-item/lcb-product-item.vue.d.ts +62 -0
- package/types/components/lcb-product-item/types.d.ts +13 -0
- package/types/components/lcb-tags/Tag/index.vue.d.ts +44 -0
- package/types/components/lcb-tags/lcb-tags.vue.d.ts +59 -0
- package/types/components/lcb-tags/types.d.ts +13 -0
- package/types/components/lcb-title/types.d.ts +5 -0
- package/types/constants.d.ts +1 -0
- package/types/hooks/useLocation.api.d.ts +9 -0
- package/types/hooks/useLocation.d.ts +7 -0
- package/types/utils/utils.d.ts +1 -0
- package/utils/utils.ts +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,33 @@
|
|
|
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.0.27](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.12...v0.0.27) (2024-10-10)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ✨ Features | 新功能
|
|
9
|
+
|
|
10
|
+
* location ([bbb81cf](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/bbb81cf655d2b4d8ec7d70a7b7cf6fc46e8eb370))
|
|
11
|
+
* search ([ab5bbe7](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ab5bbe7eae9980295cd6b9948ff02b25ed115361))
|
|
12
|
+
* updateVersion ([62d5c5e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/62d5c5e485675414085fb9c153473dc1265f5760))
|
|
13
|
+
* 完善过滤组件 ([1b3b69e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/1b3b69ed67c8203c21b70c99816be9914e1cd025))
|
|
14
|
+
* 新增title更多 ([2ab8a64](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/2ab8a64a63f768717dab13c921a8ff0262580176))
|
|
15
|
+
* 新增城市选择 ([0c54f77](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/0c54f77c56721bb79222f5b6cd98bf3a40451900))
|
|
16
|
+
* 日历 ([b3a6c8f](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/b3a6c8fe24dacdb007322d49e08696a6a26f1eaa))
|
|
17
|
+
* 日历search ([c08044b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c08044bdc2e45923f63faa97ce1a8fc737c61c74))
|
|
18
|
+
* 日历默认9个月 ([28638e7](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/28638e7bb6c16cf77357b167f2bdd104442f0600))
|
|
19
|
+
* 更新地址 ([76998fd](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/76998fd84cacc3ec4c8abcb147a08509b1b3dbcb))
|
|
20
|
+
* 调整类型 ([ea64183](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ea64183b5421158c4580e2200d3abd52201dc728))
|
|
21
|
+
|
|
22
|
+
### [0.0.26](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.10...v0.0.26) (2024-09-27)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### ✨ Features | 新功能
|
|
26
|
+
|
|
27
|
+
* 处理为esm ([3ac1688](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/3ac168860e3345a015b106c3400b7fcee8a80a6a))
|
|
28
|
+
* 支持翻译 ([87a54ee](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/87a54eebb1dfc0df0a907cafde642fa240fd2439))
|
|
29
|
+
* 新增数据同步 ([c1c8a59](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c1c8a5960a1898e8e1b2ace64c561a98ee992324))
|
|
30
|
+
* 翻译本地化 ([8e448a2](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/8e448a2aac46191f6064551b90eec64839452614))
|
|
31
|
+
|
|
5
32
|
### [0.0.25](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.24...v0.0.25) (2024-09-25)
|
|
6
33
|
|
|
7
34
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface LcbHistoryResult {
|
|
2
|
+
date: string
|
|
3
|
+
topText: string
|
|
4
|
+
centerText: string
|
|
5
|
+
bottomText: string
|
|
6
|
+
dateName: string
|
|
7
|
+
price: number
|
|
8
|
+
status: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const queryHolidayInfoList = (data: {
|
|
12
|
+
startDate: string
|
|
13
|
+
endDate: string
|
|
14
|
+
/** 日历数据类型·住宿··hotel..门票·ticket */
|
|
15
|
+
businessType?: string
|
|
16
|
+
businessId?: string
|
|
17
|
+
}) => uni.$lcb.http.post<LcbHistoryResult[]>('/holiday/queryHolidayInfoList', data)
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wd-calendar
|
|
3
|
+
v-model="value"
|
|
4
|
+
@confirm="handleConfirm"
|
|
5
|
+
type="daterange"
|
|
6
|
+
use-default-slot
|
|
7
|
+
allow-same-day
|
|
8
|
+
:formatter="formatter"
|
|
9
|
+
:min-date="minDate"
|
|
10
|
+
:max-date="maxDate"
|
|
11
|
+
>
|
|
12
|
+
<slot />
|
|
13
|
+
</wd-calendar>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import { useTranslate } from '@tplc/wot'
|
|
18
|
+
import dayjs from 'dayjs/esm'
|
|
19
|
+
import { ref } from 'vue'
|
|
20
|
+
import { LcbHistoryResult, queryHolidayInfoList } from './api'
|
|
21
|
+
const { translate } = useTranslate()
|
|
22
|
+
|
|
23
|
+
defineOptions({
|
|
24
|
+
name: 'LcbCalendar',
|
|
25
|
+
options: {
|
|
26
|
+
addGlobalClass: true,
|
|
27
|
+
virtualHost: true,
|
|
28
|
+
styleIsolation: 'shared',
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
const holidayInfo = ref<Record<string, LcbHistoryResult>>({})
|
|
32
|
+
|
|
33
|
+
const props = defineProps({
|
|
34
|
+
customClass: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: '',
|
|
37
|
+
},
|
|
38
|
+
minDate: {
|
|
39
|
+
type: Number,
|
|
40
|
+
default: dayjs().startOf('day').valueOf(),
|
|
41
|
+
},
|
|
42
|
+
maxDate: {
|
|
43
|
+
type: Number,
|
|
44
|
+
default: dayjs().add(9, 'month').startOf('day').valueOf(),
|
|
45
|
+
},
|
|
46
|
+
defaultValue: {
|
|
47
|
+
type: Array<number>,
|
|
48
|
+
/** 最近三个月 number[] */
|
|
49
|
+
default: () => [
|
|
50
|
+
dayjs().startOf('day').valueOf(),
|
|
51
|
+
dayjs().add(1, 'day').startOf('day').valueOf(),
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
const value = ref(props.defaultValue)
|
|
56
|
+
const model = defineModel<number[]>()
|
|
57
|
+
const getDayInfo = async () => {
|
|
58
|
+
const { data } = await queryHolidayInfoList({
|
|
59
|
+
/** 本月的第一天 */
|
|
60
|
+
startDate: dayjs(props.minDate).startOf('month').format('YYYY-MM-DD HH:mm:ss'),
|
|
61
|
+
/** 第三个月最后一天 */
|
|
62
|
+
endDate: dayjs(props.maxDate).endOf('month').format('YYYY-MM-DD HH:mm:ss'),
|
|
63
|
+
})
|
|
64
|
+
holidayInfo.value = data.reduce(
|
|
65
|
+
(acc, cur) => {
|
|
66
|
+
acc[cur.date] = cur
|
|
67
|
+
return acc
|
|
68
|
+
},
|
|
69
|
+
{} as Record<string, LcbHistoryResult>,
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
getDayInfo()
|
|
73
|
+
const formatter = (day: any) => {
|
|
74
|
+
const date = new Date(day.date)
|
|
75
|
+
const now = new Date()
|
|
76
|
+
|
|
77
|
+
const year = date.getFullYear()
|
|
78
|
+
const month = date.getMonth()
|
|
79
|
+
const da = date.getDate()
|
|
80
|
+
const nowYear = now.getFullYear()
|
|
81
|
+
const nowMonth = now.getMonth()
|
|
82
|
+
const nowDa = now.getDate()
|
|
83
|
+
|
|
84
|
+
const info = holidayInfo.value[dayjs(day.date).format('YYYY-MM-DD')]
|
|
85
|
+
if (info.topText) {
|
|
86
|
+
day.topInfo = info.topText
|
|
87
|
+
}
|
|
88
|
+
if (info.bottomText) {
|
|
89
|
+
day.bottomInfo = info.bottomText
|
|
90
|
+
}
|
|
91
|
+
if (info.centerText) {
|
|
92
|
+
day.text = info.centerText
|
|
93
|
+
}
|
|
94
|
+
if (year === nowYear && month === nowMonth && da === nowDa) {
|
|
95
|
+
day.topInfo = translate('今天')
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (day.type === 'start') {
|
|
99
|
+
day.topInfo = translate('开始')
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (day.type === 'end') {
|
|
103
|
+
day.topInfo = translate('结束')
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (day.type === 'same') {
|
|
107
|
+
day.bottomInfo = translate('开始/结束')
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return day
|
|
111
|
+
}
|
|
112
|
+
const handleConfirm = ({ value }: { value: number[] }) => {
|
|
113
|
+
model.value = value
|
|
114
|
+
}
|
|
115
|
+
</script>
|
|
116
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<lcb-block v-bind="$props" customClass="flex items-center">
|
|
3
|
+
<view
|
|
4
|
+
class="flex flex-1 text-#333 rounded-16rpx bg-#F5F5F7 h-78rpx flex items-center px-3 text-[28rpx]"
|
|
5
|
+
>
|
|
6
|
+
<lcb-city-select :location="userLocation">
|
|
7
|
+
<text class="font-bold">{{ userLocation?.cityName || '附近' }}</text>
|
|
8
|
+
</lcb-city-select>
|
|
9
|
+
<view class="v-line"></view>
|
|
10
|
+
<lcb-calendar v-model="dayRange">
|
|
11
|
+
<view class="flex items-center flex-col text-22rpx">
|
|
12
|
+
<view class="flex">
|
|
13
|
+
<view class="title">{{ dayjs(dayRange[0]).format('MM-DD') }}</view>
|
|
14
|
+
<view class="hint ml-2">{{ translate('入住') }}</view>
|
|
15
|
+
</view>
|
|
16
|
+
<view class="flex">
|
|
17
|
+
<view class="title">{{ dayjs(dayRange[1]).format('MM-DD') }}</view>
|
|
18
|
+
<view class="hint ml-2">{{ translate('离店') }}</view>
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
</lcb-calendar>
|
|
22
|
+
|
|
23
|
+
<view class="v-line"></view>
|
|
24
|
+
<view class="flex-1 flex items-center gap-2">
|
|
25
|
+
<wd-icon name="search" size="34rpx" color="#999999" />
|
|
26
|
+
<view class="text-#999999">{{ placeholder }}</view>
|
|
27
|
+
</view>
|
|
28
|
+
</view>
|
|
29
|
+
<wd-icon name="search" size="36rpx" color="#333" custom-class="ml-4" />
|
|
30
|
+
</lcb-block>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script setup lang="ts">
|
|
34
|
+
import { useTranslate } from '@tplc/wot'
|
|
35
|
+
import dayjs from 'dayjs/esm'
|
|
36
|
+
import useLocation from '../../hooks/useLocation'
|
|
37
|
+
import { ref } from 'vue'
|
|
38
|
+
import { LcbCalendarSearchProps } from './types'
|
|
39
|
+
defineOptions({
|
|
40
|
+
name: 'LcbCalendarSearch',
|
|
41
|
+
options: {
|
|
42
|
+
addGlobalClass: true,
|
|
43
|
+
virtualHost: true,
|
|
44
|
+
styleIsolation: 'shared',
|
|
45
|
+
},
|
|
46
|
+
})
|
|
47
|
+
withDefaults(defineProps<LcbCalendarSearchProps>(), {
|
|
48
|
+
marginHorizontal: 24,
|
|
49
|
+
radius: 16,
|
|
50
|
+
placeholder: '城市|地点|品牌',
|
|
51
|
+
})
|
|
52
|
+
const dayRange = ref([dayjs().valueOf(), dayjs().add(1, 'day').valueOf()])
|
|
53
|
+
const { translate } = useTranslate()
|
|
54
|
+
const { getLocation, userLocation } = useLocation()
|
|
55
|
+
getLocation()
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<style lang="scss" scoped>
|
|
59
|
+
.v-line {
|
|
60
|
+
width: 1rpx;
|
|
61
|
+
height: 40rpx;
|
|
62
|
+
background: #999999;
|
|
63
|
+
opacity: 0.5;
|
|
64
|
+
margin: 0 20rpx;
|
|
65
|
+
}
|
|
66
|
+
.hint {
|
|
67
|
+
color: #999;
|
|
68
|
+
}
|
|
69
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface HotAddress {
|
|
2
|
+
categoryName: string
|
|
3
|
+
hint: string
|
|
4
|
+
childHotAddress: ChildHotAddress[]
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface ChildHotAddress {
|
|
8
|
+
addr: string
|
|
9
|
+
addrFlag: boolean
|
|
10
|
+
area: string
|
|
11
|
+
categoryName: string
|
|
12
|
+
createDate?: string
|
|
13
|
+
hotAddressId: string
|
|
14
|
+
lastModifyDate?: string
|
|
15
|
+
latitude?: string
|
|
16
|
+
longitude?: string
|
|
17
|
+
weightSort: string
|
|
18
|
+
addressInfo?: string
|
|
19
|
+
}
|
|
20
|
+
export const getHotAddress = () => uni.$lcb.http.post<HotAddress[]>('/hotAddress/categoryList', {})
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view @click="show = true">
|
|
3
|
+
<slot />
|
|
4
|
+
</view>
|
|
5
|
+
<wd-popup
|
|
6
|
+
v-model="show"
|
|
7
|
+
position="bottom"
|
|
8
|
+
custom-style="height: 90vh;border-top-left-radius: 24rpx;border-top-right-radius: 24rpx;"
|
|
9
|
+
:safe-area-inset-bottom="true"
|
|
10
|
+
>
|
|
11
|
+
<view class="flex flex-col h-full">
|
|
12
|
+
<wd-search hide-cancel :placeholder="placeholder" />
|
|
13
|
+
<view class="h-0 flex-1" v-if="addressRef.length > 0">
|
|
14
|
+
<wd-index-bar>
|
|
15
|
+
<view
|
|
16
|
+
v-for="item in [...locationAddress, ...historyList, ...addressRef]"
|
|
17
|
+
:key="item.categoryName"
|
|
18
|
+
>
|
|
19
|
+
<wd-index-anchor
|
|
20
|
+
:index="item.categoryName"
|
|
21
|
+
:hint="item.hint"
|
|
22
|
+
customClass="!bg-transparent !pb-0 font-bold !text-28rpx !pl-4"
|
|
23
|
+
/>
|
|
24
|
+
<view class="grid grid-cols-4 gap-3 py-3 pl-4 pr-10 box-border">
|
|
25
|
+
<view
|
|
26
|
+
class="address-tag"
|
|
27
|
+
:class="{
|
|
28
|
+
'current-address':
|
|
29
|
+
currentAddress && currentAddress.hotAddressId === city.hotAddressId,
|
|
30
|
+
}"
|
|
31
|
+
v-for="city in item.childHotAddress"
|
|
32
|
+
:key="city.addr"
|
|
33
|
+
@click="onAddrClick(city)"
|
|
34
|
+
>
|
|
35
|
+
{{ city.addr }}
|
|
36
|
+
</view>
|
|
37
|
+
</view>
|
|
38
|
+
</view>
|
|
39
|
+
</wd-index-bar>
|
|
40
|
+
</view>
|
|
41
|
+
</view>
|
|
42
|
+
</wd-popup>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script setup lang="ts">
|
|
46
|
+
import { computed, onMounted, ref, watch } from 'vue'
|
|
47
|
+
import { ChildHotAddress, getHotAddress, HotAddress } from './api'
|
|
48
|
+
import { LcbCitySelectProps } from './types'
|
|
49
|
+
defineOptions({
|
|
50
|
+
name: 'LcbCitySelect',
|
|
51
|
+
options: {
|
|
52
|
+
addGlobalClass: true,
|
|
53
|
+
virtualHost: true,
|
|
54
|
+
styleIsolation: 'shared',
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
const props = withDefaults(defineProps<LcbCitySelectProps>(), {
|
|
58
|
+
placeholder: '搜索城市/区域/景点',
|
|
59
|
+
})
|
|
60
|
+
const addressRef = ref<HotAddress[]>([])
|
|
61
|
+
const historyAddress = ref<ChildHotAddress[]>([])
|
|
62
|
+
const currentAddress = ref<ChildHotAddress | undefined>(
|
|
63
|
+
props.location
|
|
64
|
+
? ({
|
|
65
|
+
addressInfo: props.location.addressInfo,
|
|
66
|
+
addr: props.location.cityName,
|
|
67
|
+
hotAddressId: props.location.cityId,
|
|
68
|
+
} as ChildHotAddress)
|
|
69
|
+
: undefined,
|
|
70
|
+
)
|
|
71
|
+
const show = ref(false)
|
|
72
|
+
onMounted(async () => {
|
|
73
|
+
const { data } = await getHotAddress()
|
|
74
|
+
addressRef.value = data
|
|
75
|
+
})
|
|
76
|
+
const locationAddress = computed<HotAddress[]>(() => {
|
|
77
|
+
return props.location
|
|
78
|
+
? ([
|
|
79
|
+
{
|
|
80
|
+
categoryName: '定位',
|
|
81
|
+
hint: '当前定位',
|
|
82
|
+
childHotAddress: [
|
|
83
|
+
{
|
|
84
|
+
addressInfo: props.location.addressInfo,
|
|
85
|
+
addr: props.location.cityName,
|
|
86
|
+
hotAddressId: props.location.cityId,
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
] as HotAddress[])
|
|
91
|
+
: []
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
const historyList = computed<HotAddress[]>(() => {
|
|
95
|
+
return historyAddress.value.length
|
|
96
|
+
? [
|
|
97
|
+
{
|
|
98
|
+
categoryName: '历史',
|
|
99
|
+
hint: '历史记录',
|
|
100
|
+
childHotAddress: historyAddress.value,
|
|
101
|
+
},
|
|
102
|
+
]
|
|
103
|
+
: []
|
|
104
|
+
})
|
|
105
|
+
watch(
|
|
106
|
+
() => show.value,
|
|
107
|
+
(val) => {
|
|
108
|
+
if (val) {
|
|
109
|
+
historyAddress.value = JSON.parse(uni.getStorageSync('historyAddress') || '[]')
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
immediate: true,
|
|
114
|
+
},
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
watch(
|
|
118
|
+
() => historyAddress.value,
|
|
119
|
+
(val) => {
|
|
120
|
+
if (val.length) {
|
|
121
|
+
uni.setStorageSync('historyAddress', JSON.stringify(val))
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
)
|
|
125
|
+
const onAddrClick = (city: ChildHotAddress) => {
|
|
126
|
+
currentAddress.value = city
|
|
127
|
+
show.value = false
|
|
128
|
+
historyAddress.value = historyAddress.value.filter(
|
|
129
|
+
(item) => item.hotAddressId !== city.hotAddressId,
|
|
130
|
+
)
|
|
131
|
+
if (historyAddress.value.length === 8) {
|
|
132
|
+
historyAddress.value = [city, ...historyAddress.value.slice(0, 7)]
|
|
133
|
+
} else {
|
|
134
|
+
historyAddress.value = [city, ...historyAddress.value]
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
</script>
|
|
138
|
+
|
|
139
|
+
<style lang="scss" scoped>
|
|
140
|
+
@import '@tplc/wot/components/common/abstracts/variable';
|
|
141
|
+
.address-tag {
|
|
142
|
+
background: #f7f7f7;
|
|
143
|
+
height: 80rpx;
|
|
144
|
+
display: flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
justify-content: center;
|
|
147
|
+
padding: 0 16rpx;
|
|
148
|
+
border-radius: 10rpx;
|
|
149
|
+
font-size: 24rpx;
|
|
150
|
+
text-align: center;
|
|
151
|
+
overflow: hidden;
|
|
152
|
+
}
|
|
153
|
+
.current-address {
|
|
154
|
+
color: $-color-theme;
|
|
155
|
+
position: relative;
|
|
156
|
+
&::after {
|
|
157
|
+
content: '';
|
|
158
|
+
position: absolute;
|
|
159
|
+
bottom: 0;
|
|
160
|
+
left: 0;
|
|
161
|
+
width: 100%;
|
|
162
|
+
height: 100%;
|
|
163
|
+
z-index: 1;
|
|
164
|
+
background: $-color-theme;
|
|
165
|
+
opacity: 0.15;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
</style>
|
|
@@ -4,6 +4,15 @@
|
|
|
4
4
|
<view class="lcb-filter__group-title mt2">
|
|
5
5
|
{{ child.fitlerName }}
|
|
6
6
|
<view v-if="child.componentProps.mode === 'multiple'" class="!text-22rpx">可多选</view>
|
|
7
|
+
<view v-if="child.component === 'slider'" class="!text-26rpx slider-title">
|
|
8
|
+
{{
|
|
9
|
+
getSliderTitle(
|
|
10
|
+
innerFilter[child.valueName],
|
|
11
|
+
child.componentProps.max,
|
|
12
|
+
child.componentProps.min,
|
|
13
|
+
)
|
|
14
|
+
}}
|
|
15
|
+
</view>
|
|
7
16
|
</view>
|
|
8
17
|
<view class="grid grid-cols-4 gap-22rpx" v-if="child.component === 'tagSelect'">
|
|
9
18
|
<TagSelect v-bind="child.componentProps" v-model="innerFilter[child.valueName]" />
|
|
@@ -24,6 +33,7 @@ import { ComponentGroupProps } from './type'
|
|
|
24
33
|
import FilterSlider from '../FilterSlider/index.vue'
|
|
25
34
|
import TagSelect from '../TagSelect/index.vue'
|
|
26
35
|
import ActionView from '../ActionView/index.vue'
|
|
36
|
+
import { useTranslate } from '@tplc/wot'
|
|
27
37
|
defineOptions({
|
|
28
38
|
name: 'ComponentGroup',
|
|
29
39
|
options: {
|
|
@@ -32,6 +42,7 @@ defineOptions({
|
|
|
32
42
|
styleIsolation: 'shared',
|
|
33
43
|
},
|
|
34
44
|
})
|
|
45
|
+
const { translate } = useTranslate()
|
|
35
46
|
|
|
36
47
|
const props = defineProps<ComponentGroupProps>()
|
|
37
48
|
const emits = defineEmits(['submit'])
|
|
@@ -65,8 +76,25 @@ const onCancel = () => {
|
|
|
65
76
|
const onSubmit = () => {
|
|
66
77
|
emits('submit', innerFilter.value)
|
|
67
78
|
}
|
|
79
|
+
const getSliderTitle = (value?: number[], max = 0, min = 0) => {
|
|
80
|
+
if (value) {
|
|
81
|
+
const [start, end] = value
|
|
82
|
+
if (start === min && end === max) {
|
|
83
|
+
return translate('不限')
|
|
84
|
+
} else if (end === max) {
|
|
85
|
+
return `¥${start}` + translate('以上')
|
|
86
|
+
} else if (start === min) {
|
|
87
|
+
return `¥${end}` + translate('以下')
|
|
88
|
+
} else {
|
|
89
|
+
return `¥${start}-${end}`
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
return ''
|
|
93
|
+
}
|
|
94
|
+
}
|
|
68
95
|
</script>
|
|
69
96
|
<style lang="scss" scoped>
|
|
97
|
+
@import '@tplc/wot/components/common/abstracts/variable';
|
|
70
98
|
.lcb-filter {
|
|
71
99
|
&__group-title {
|
|
72
100
|
font-size: 30rpx;
|
|
@@ -75,6 +103,9 @@ const onSubmit = () => {
|
|
|
75
103
|
margin-bottom: 24rpx;
|
|
76
104
|
display: flex;
|
|
77
105
|
align-items: center;
|
|
106
|
+
.slider-title {
|
|
107
|
+
color: $-color-theme !important;
|
|
108
|
+
}
|
|
78
109
|
|
|
79
110
|
> view {
|
|
80
111
|
font-size: 24rpx;
|
|
@@ -114,8 +114,9 @@ watch(
|
|
|
114
114
|
query.select(`#grid_${index}`).boundingClientRect()
|
|
115
115
|
})
|
|
116
116
|
query.exec((res) => {
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
itemTopPositions.value = res
|
|
118
|
+
.filter((v) => v)
|
|
119
|
+
.map((rect) => ({ top: rect.top, bottom: rect.bottom }))
|
|
119
120
|
})
|
|
120
121
|
})
|
|
121
122
|
},
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
</template>
|
|
56
56
|
|
|
57
57
|
<script setup lang="ts">
|
|
58
|
-
import { ref, watch } from 'vue'
|
|
58
|
+
import { inject, Ref, ref, watch } from 'vue'
|
|
59
59
|
import { LcbFilterProps } from './types'
|
|
60
60
|
import { FilterComponent, getFilterDetail, LcbFilterResult } from './api'
|
|
61
61
|
import FilterSelect from './components/FilterSelect/index.vue'
|
|
@@ -63,6 +63,7 @@ import TreeSelect from './components/TreeSelect/index.vue'
|
|
|
63
63
|
import ComponentGroup from './components/ComponentGroup/index.vue'
|
|
64
64
|
import TagSelect from './components/TagSelect/index.vue'
|
|
65
65
|
import './index.scss'
|
|
66
|
+
import { FORM_KEY } from '../../constants'
|
|
66
67
|
defineOptions({
|
|
67
68
|
name: 'LcbFilter',
|
|
68
69
|
options: {
|
|
@@ -71,6 +72,7 @@ defineOptions({
|
|
|
71
72
|
styleIsolation: 'shared',
|
|
72
73
|
},
|
|
73
74
|
})
|
|
75
|
+
const form = inject<Ref<Record<string, any>>>(FORM_KEY)
|
|
74
76
|
const dropMenu = ref()
|
|
75
77
|
const props = withDefaults(defineProps<LcbFilterProps>(), {
|
|
76
78
|
pageFilterType: 'hotelTravelFilter',
|
|
@@ -122,6 +124,22 @@ const getSelect = (item: FilterComponent) => {
|
|
|
122
124
|
const handleOpened = () => {
|
|
123
125
|
uni.$emit('drop-opened')
|
|
124
126
|
}
|
|
127
|
+
|
|
128
|
+
watch(
|
|
129
|
+
() => filter.value,
|
|
130
|
+
async (val) => {
|
|
131
|
+
if (form && Object.keys(val).length) {
|
|
132
|
+
form.value = {
|
|
133
|
+
...form.value,
|
|
134
|
+
...val,
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
immediate: true,
|
|
140
|
+
deep: true,
|
|
141
|
+
},
|
|
142
|
+
)
|
|
125
143
|
</script>
|
|
126
144
|
|
|
127
145
|
<style lang="scss" scoped>
|
|
@@ -26,24 +26,31 @@
|
|
|
26
26
|
<view class="h-42rpx w-1px bg-#F1F1F1"></view>
|
|
27
27
|
<view class="text-#999 text-28rpx">{{ placeholder }}</view>
|
|
28
28
|
<view class="flex-1"></view>
|
|
29
|
-
<view class="justify-center flex flex-col items-center">
|
|
29
|
+
<view class="justify-center flex flex-col items-center" @click="getLocation">
|
|
30
|
+
<wd-loading size="30rpx" v-if="locationIng" />
|
|
30
31
|
<img
|
|
31
32
|
class="w-30rpx h-30rpx"
|
|
32
33
|
mode="aspectFit"
|
|
33
34
|
src="https://ddll-lycs.oss-cn-hangzhou.aliyuncs.com/default/1/20240914164707/%E5%BD%A2%E7%8A%B6%2095%402x.png"
|
|
35
|
+
v-else
|
|
34
36
|
/>
|
|
35
|
-
<view class="text-26rpx text-#333 mt-12rpx"
|
|
37
|
+
<view class="text-26rpx text-#333 mt-12rpx">
|
|
38
|
+
{{ locationIng ? translate('定位中...') : translate('当前位置') }}
|
|
39
|
+
</view>
|
|
36
40
|
</view>
|
|
37
41
|
</view>
|
|
38
42
|
<view class="w-full h-1px bg-#F1F1F1 mt-26rpx mb-44rpx"></view>
|
|
39
|
-
<
|
|
40
|
-
<view class="
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
<lcb-calendar v-model="dayRange">
|
|
44
|
+
<view class="flex items-center">
|
|
45
|
+
<view class="title">{{ dayjs(dayRange[0]).format('MM月DD日') }}</view>
|
|
46
|
+
<view class="hint ml-1">{{ getDayName(dayRange[0]) }}{{ translate('入住') }}</view>
|
|
47
|
+
<view class="title mx-1">——</view>
|
|
48
|
+
<view class="title">{{ dayjs(dayRange[1]).format('MM月DD日') }}</view>
|
|
49
|
+
|
|
50
|
+
<view class="hint ml-1 flex-1">{{ getDayName(dayRange[1]) }}{{ translate('离店') }}</view>
|
|
51
|
+
<view class="tag">{{ translate('共') }}{{ nightCount }}{{ translate('晚') }}</view>
|
|
52
|
+
</view>
|
|
53
|
+
</lcb-calendar>
|
|
47
54
|
<wd-button type="primary" customClass="!w-full my-42rpx" size="large">
|
|
48
55
|
{{ btnText }}
|
|
49
56
|
</wd-button>
|
|
@@ -68,10 +75,15 @@
|
|
|
68
75
|
<script setup lang="ts">
|
|
69
76
|
import { computed, ref } from 'vue'
|
|
70
77
|
import { LcbHomeSearch } from './types'
|
|
71
|
-
import dayjs from 'dayjs'
|
|
72
|
-
|
|
78
|
+
import dayjs from 'dayjs/esm'
|
|
79
|
+
import useLocation from '../../hooks/useLocation'
|
|
80
|
+
import { useTranslate } from '@tplc/wot'
|
|
81
|
+
const dayRange = ref([dayjs().valueOf(), dayjs().add(1, 'day').valueOf()])
|
|
82
|
+
const { translate } = useTranslate()
|
|
83
|
+
const { getLocation, locationIng } = useLocation()
|
|
84
|
+
getLocation()
|
|
73
85
|
const nightCount = computed(() => {
|
|
74
|
-
return dayRange.value[1].diff(dayRange.value[0], 'day')
|
|
86
|
+
return dayjs(dayRange.value[1]).diff(dayRange.value[0], 'day')
|
|
75
87
|
})
|
|
76
88
|
defineOptions({
|
|
77
89
|
name: 'LcbHomeSearch',
|
|
@@ -91,6 +103,19 @@ withDefaults(defineProps<LcbHomeSearch>(), {
|
|
|
91
103
|
})
|
|
92
104
|
const tabs = ['全部', '酒店', '民宿']
|
|
93
105
|
const current = ref(0)
|
|
106
|
+
// 今天 明天 后天 周...
|
|
107
|
+
const getDayName = (time: number) => {
|
|
108
|
+
const day = dayjs(time).day()
|
|
109
|
+
if (day === dayjs().day()) {
|
|
110
|
+
return '今天'
|
|
111
|
+
} else if (day === dayjs().add(1, 'day').day()) {
|
|
112
|
+
return '明天'
|
|
113
|
+
} else if (day === dayjs().add(2, 'day').day()) {
|
|
114
|
+
return '后天'
|
|
115
|
+
} else {
|
|
116
|
+
return `周${'日一二三四五六'[day]}`
|
|
117
|
+
}
|
|
118
|
+
}
|
|
94
119
|
</script>
|
|
95
120
|
<style lang="scss" scoped>
|
|
96
121
|
.search-view {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
top: transformValueUnit(getRealSize(each.y)),
|
|
48
48
|
}"
|
|
49
49
|
>
|
|
50
|
-
<lcb-action-view v-bind="each.urlObj" />
|
|
50
|
+
<lcb-action-view v-bind="each.urlObj" customClass="link" />
|
|
51
51
|
</view>
|
|
52
52
|
</view>
|
|
53
53
|
</view>
|
|
@@ -84,14 +84,12 @@ function getRealSize(size: number = 0) {
|
|
|
84
84
|
</script>
|
|
85
85
|
<style lang="scss" scoped>
|
|
86
86
|
.link {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
right: 0;
|
|
95
|
-
}
|
|
87
|
+
position: absolute;
|
|
88
|
+
width: 100%;
|
|
89
|
+
height: 100%;
|
|
90
|
+
top: 0;
|
|
91
|
+
bottom: 0;
|
|
92
|
+
left: 0;
|
|
93
|
+
right: 0;
|
|
96
94
|
}
|
|
97
95
|
</style>
|