@tplc/business 0.0.26 → 0.0.28

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 +56 -0
  2. package/components/lcb-area-picker/api/index.ts +45 -0
  3. package/components/lcb-area-picker/lcb-area-picker.vue +77 -0
  4. package/components/lcb-area-picker/types.ts +3 -0
  5. package/components/lcb-banner-block/lcb-banner-block.vue +2 -2
  6. package/components/lcb-calendar/api/index.ts +17 -0
  7. package/components/lcb-calendar/lcb-calendar.vue +116 -0
  8. package/components/lcb-calendar-search/lcb-calendar-search.vue +72 -0
  9. package/components/lcb-calendar-search/types.ts +6 -0
  10. package/components/lcb-city-select/api/index.ts +34 -0
  11. package/components/lcb-city-select/components/lcb-city-letter/index.vue +171 -0
  12. package/components/lcb-city-select/components/lcb-city-list/index.vue +127 -0
  13. package/components/lcb-city-select/components/lcb-city-list/types.ts +6 -0
  14. package/components/lcb-city-select/images/hot.png +0 -0
  15. package/components/lcb-city-select/lcb-city-select.vue +145 -0
  16. package/components/lcb-city-select/types.ts +7 -0
  17. package/components/lcb-dynamic-data/lcb-dynamic-data.vue +25 -0
  18. package/components/lcb-dynamic-data/types.ts +7 -0
  19. package/components/lcb-home-search/lcb-home-search.vue +52 -18
  20. package/components/lcb-image/Image/index.vue +41 -20
  21. package/components/lcb-img-nav/lcb-img-nav.vue +70 -30
  22. package/components/lcb-img-nav/types.ts +3 -3
  23. package/components/{lcb-filter → lcb-list}/api.ts +7 -2
  24. package/components/{lcb-filter → lcb-list}/components/ComponentGroup/index.vue +31 -0
  25. package/components/lcb-list/components/FilterList/index.vue +78 -0
  26. package/components/lcb-list/components/FilterList/type.ts +9 -0
  27. package/components/{lcb-filter → lcb-list}/components/FilterSlider/index.vue +2 -1
  28. package/components/{lcb-filter → lcb-list}/components/TreeSelect/index.vue +3 -2
  29. package/components/{lcb-filter → lcb-list}/index.scss +3 -0
  30. package/components/lcb-list/lcb-list.vue +163 -0
  31. package/components/{lcb-filter → lcb-list}/types.ts +5 -1
  32. package/components/lcb-nav/lcb-nav.vue +8 -13
  33. package/components/lcb-notice/Item/index.vue +1 -1
  34. package/components/lcb-product/lcb-product.vue +47 -0
  35. package/components/lcb-product/types.ts +14 -0
  36. package/components/lcb-product-item/lcb-product-item.vue +97 -0
  37. package/components/lcb-product-item/types.ts +14 -0
  38. package/components/lcb-tags/Tag/index.vue +27 -0
  39. package/components/lcb-tags/lcb-tags.vue +49 -0
  40. package/components/lcb-tags/types.ts +30 -0
  41. package/components/lcb-title/lcb-title.vue +14 -8
  42. package/components/lcb-title/types.ts +5 -0
  43. package/components/lcb-user-order/lcb-user-order.vue +44 -23
  44. package/components/lcb-user-top/lcb-user-top.vue +77 -48
  45. package/constants.ts +1 -0
  46. package/global.d.ts +9 -1
  47. package/hooks/useLocation.api.ts +7 -0
  48. package/hooks/useLocation.ts +78 -0
  49. package/iconfonts/index.css +1 -175
  50. package/package.json +5 -2
  51. package/types/components/lcb-area-picker/api/index.d.ts +38 -0
  52. package/types/components/lcb-area-picker/lcb-area-picker.vue.d.ts +67 -0
  53. package/types/components/lcb-area-picker/types.d.ts +1 -0
  54. package/types/components/lcb-calendar/api/index.d.ts +16 -0
  55. package/types/components/lcb-calendar/lcb-calendar.vue.d.ts +137 -0
  56. package/types/components/lcb-calendar-search/lcb-calendar-search.vue.d.ts +62 -0
  57. package/types/components/lcb-calendar-search/types.d.ts +4 -0
  58. package/types/components/lcb-city-select/api/index.d.ts +32 -0
  59. package/types/components/lcb-city-select/components/lcb-city-letter/index.vue.d.ts +53 -0
  60. package/types/components/lcb-city-select/components/lcb-city-list/index.vue.d.ts +48 -0
  61. package/types/components/lcb-city-select/components/lcb-city-list/types.d.ts +5 -0
  62. package/types/components/lcb-city-select/lcb-city-select.vue.d.ts +77 -0
  63. package/types/components/lcb-city-select/types.d.ts +5 -0
  64. package/types/components/lcb-dynamic-data/lcb-dynamic-data.vue.d.ts +44 -0
  65. package/types/components/lcb-dynamic-data/types.d.ts +7 -0
  66. package/types/components/lcb-home-search/lcb-home-search.vue.d.ts +1 -1
  67. package/types/components/lcb-image/lcb-image.vue.d.ts +1 -1
  68. package/types/components/lcb-img-nav/lcb-img-nav.vue.d.ts +1 -1
  69. package/types/components/lcb-img-nav/types.d.ts +2 -2
  70. package/types/components/{lcb-filter → lcb-list}/api.d.ts +5 -0
  71. package/types/components/lcb-list/components/FilterList/index.vue.d.ts +28 -0
  72. package/types/components/lcb-list/components/FilterList/type.d.ts +9 -0
  73. package/types/components/lcb-list/lcb-list.vue.d.ts +71 -0
  74. package/types/components/{lcb-filter → lcb-list}/types.d.ts +4 -1
  75. package/types/components/lcb-product/lcb-product.vue.d.ts +42 -0
  76. package/types/components/lcb-product/types.d.ts +13 -0
  77. package/types/components/lcb-product-item/lcb-product-item.vue.d.ts +62 -0
  78. package/types/components/lcb-product-item/types.d.ts +13 -0
  79. package/types/components/lcb-tags/Tag/index.vue.d.ts +44 -0
  80. package/types/components/{lcb-filter/lcb-filter.vue.d.ts → lcb-tags/lcb-tags.vue.d.ts} +9 -7
  81. package/types/components/lcb-tags/types.d.ts +13 -0
  82. package/types/components/lcb-title/types.d.ts +5 -0
  83. package/types/constants.d.ts +1 -0
  84. package/types/hooks/useLocation.api.d.ts +9 -0
  85. package/types/hooks/useLocation.d.ts +7 -0
  86. package/types/utils/utils.d.ts +1 -0
  87. package/utils/utils.ts +12 -0
  88. package/components/lcb-filter/lcb-filter.vue +0 -129
  89. package/components/{lcb-filter → lcb-list}/components/ActionView/index.vue +0 -0
  90. package/components/{lcb-filter → lcb-list}/components/ComponentGroup/type.ts +0 -0
  91. package/components/{lcb-filter → lcb-list}/components/FilterSelect/index.vue +0 -0
  92. package/components/{lcb-filter → lcb-list}/components/FilterSelect/type.ts +0 -0
  93. package/components/{lcb-filter → lcb-list}/components/FilterSlider/types.ts +0 -0
  94. package/components/{lcb-filter → lcb-list}/components/SelectTagView/index.vue +0 -0
  95. package/components/{lcb-filter → lcb-list}/components/TagSelect/index.vue +0 -0
  96. package/components/{lcb-filter → lcb-list}/components/TagSelect/type.ts +0 -0
  97. package/components/{lcb-filter → lcb-list}/components/TreeSelect/type.ts +0 -0
  98. package/components/{lcb-filter → lcb-list}/hooks/useSelect.ts +0 -0
  99. package/types/components/{lcb-filter → lcb-list}/components/ActionView/index.vue.d.ts +1 -1
  100. /package/types/components/{lcb-filter → lcb-list}/components/ComponentGroup/index.vue.d.ts +0 -0
  101. /package/types/components/{lcb-filter → lcb-list}/components/ComponentGroup/type.d.ts +0 -0
  102. /package/types/components/{lcb-filter → lcb-list}/components/FilterSelect/index.vue.d.ts +0 -0
  103. /package/types/components/{lcb-filter → lcb-list}/components/FilterSelect/type.d.ts +0 -0
  104. /package/types/components/{lcb-filter → lcb-list}/components/FilterSlider/index.vue.d.ts +0 -0
  105. /package/types/components/{lcb-filter → lcb-list}/components/FilterSlider/types.d.ts +0 -0
  106. /package/types/components/{lcb-filter → lcb-list}/components/SelectTagView/index.vue.d.ts +0 -0
  107. /package/types/components/{lcb-filter → lcb-list}/components/TagSelect/index.vue.d.ts +0 -0
  108. /package/types/components/{lcb-filter → lcb-list}/components/TagSelect/type.d.ts +0 -0
  109. /package/types/components/{lcb-filter → lcb-list}/components/TreeSelect/index.vue.d.ts +0 -0
  110. /package/types/components/{lcb-filter → lcb-list}/components/TreeSelect/type.d.ts +0 -0
  111. /package/types/components/{lcb-filter → lcb-list}/hooks/useSelect.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,62 @@
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.28](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.13...v0.0.28) (2024-10-19)
6
+
7
+
8
+ ### ✨ Features | 新功能
9
+
10
+ * a ([98179b6](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/98179b669c589bfa475f7ca2e28bd806e2710ea5))
11
+ * cahec ([9d3fc53](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/9d3fc53421c46e9ffb4833ec5f300fdd2b4e9e7d))
12
+ * city ([ae7f3d4](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ae7f3d4a94dc7b83e4b9e74e8f692a052e0f0431))
13
+ * city select ([c11e6a2](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c11e6a2cf11bf47ebac66a083f8e8942add21105))
14
+ * data数据 ([36f3e4b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/36f3e4bcc1a70c81e588339b58c7e8a05199ed89))
15
+ * icon ([c1cd815](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c1cd81542df16f0f799f1217f0eefd33b84e18fb))
16
+ * status 变更 ([c745aa7](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c745aa77b4ce3d27f6b037cee7584e38e41db84a))
17
+ * upload version ([e5b2bec](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/e5b2bec9e00beda4873a01b5ae41211b8e26a733))
18
+ * 列表调整 ([3a4dc00](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/3a4dc00d55c74840e979545c5f2817953bfcddf8))
19
+ * 历史 ([108d5e6](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/108d5e6a00deb0c21b25cef8441ea75058c77859))
20
+ * 城市 ([0c9ea36](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/0c9ea36b11aed6c147b7a83ad933d224a53748c1))
21
+ * 处理问题 ([832cd7b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/832cd7beedd12b4d88af131e482b22ec3b9878bb))
22
+ * 完成城市选择 ([7a6b8e6](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/7a6b8e698b001bb65bfc6fcdf6d22e0660753d82))
23
+ * 支持search ([6303a47](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/6303a4771c03a051f1e188f30b6212fa9a50246b))
24
+ * 支持token ([01e0594](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/01e059414d80d3f59baf12dd1461990a7e86d641))
25
+ * 新增cell ([7d11105](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/7d1110518832ce6a32f418361b67fd24646b4805))
26
+ * 新增history ([11d1ddb](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/11d1ddbdad4340bb2c2a5b996b182621d7016d0e))
27
+ * 新增list ([4ee981e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/4ee981ed2b1e870aafedbe7c6295a0c67960b3bf))
28
+ * 更换字体 ([72b717e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/72b717eab197eb6bf8a6e9e62b3410d42362b049))
29
+ * 省市区选择器 ([d566a2a](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/d566a2ad24911f17da2ed85a547ca0ca0394705b))
30
+ * 背景颜色调整 ([96a47ff](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/96a47fff5dd1e1a043cca4e7a3c0c129ff2190e9))
31
+ * 调整icon ([a24baaa](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/a24baaa5ef466247d455303c7287e399f5695066))
32
+ * 调整字体大小 ([3a8b1be](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/3a8b1be88b051b0bc5e35885b30786984919878f))
33
+ * 过滤 ([e006ffb](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/e006ffb48240903af1ec860725e917f4906e97c4))
34
+ * 过滤列表 ([405d86c](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/405d86cb3c0fe9dbed6cd4da7c04c6843e602269))
35
+ * 选择城市 ([7eeb263](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/7eeb263982a70f7ca837144f4ae77b85d5c02e6e))
36
+
37
+
38
+ ### 🐛 Bug Fixes | Bug 修复
39
+
40
+ * 修复slider 选择快捷没有变更值 ([c800d52](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c800d524b5c6256add0620a21d3abe321a9342a6))
41
+ * 修改选择地区定位错误问题 ([77586e6](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/77586e6253174ab92f61635c4eefdabf3d1fdce3))
42
+ * 选择城市定位问题 ([0a1bc9e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/0a1bc9e01ab353eab8d531f4ab6aacdcd12b302a))
43
+
44
+ ### [0.0.27](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.12...v0.0.27) (2024-10-10)
45
+
46
+
47
+ ### ✨ Features | 新功能
48
+
49
+ * location ([bbb81cf](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/bbb81cf655d2b4d8ec7d70a7b7cf6fc46e8eb370))
50
+ * search ([ab5bbe7](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ab5bbe7eae9980295cd6b9948ff02b25ed115361))
51
+ * updateVersion ([62d5c5e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/62d5c5e485675414085fb9c153473dc1265f5760))
52
+ * 完善过滤组件 ([1b3b69e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/1b3b69ed67c8203c21b70c99816be9914e1cd025))
53
+ * 新增title更多 ([2ab8a64](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/2ab8a64a63f768717dab13c921a8ff0262580176))
54
+ * 新增城市选择 ([0c54f77](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/0c54f77c56721bb79222f5b6cd98bf3a40451900))
55
+ * 日历 ([b3a6c8f](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/b3a6c8fe24dacdb007322d49e08696a6a26f1eaa))
56
+ * 日历search ([c08044b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c08044bdc2e45923f63faa97ce1a8fc737c61c74))
57
+ * 日历默认9个月 ([28638e7](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/28638e7bb6c16cf77357b167f2bdd104442f0600))
58
+ * 更新地址 ([76998fd](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/76998fd84cacc3ec4c8abcb147a08509b1b3dbcb))
59
+ * 调整类型 ([ea64183](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ea64183b5421158c4580e2200d3abd52201dc728))
60
+
5
61
  ### [0.0.26](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.10...v0.0.26) (2024-09-27)
6
62
 
7
63
 
@@ -0,0 +1,45 @@
1
+ // /api/provinces/provinceCityArea
2
+ export interface ProvinceCityArea {
3
+ cityList: CityList[]
4
+ provinceId: string
5
+ provinceName: string
6
+ }
7
+
8
+ interface CityList {
9
+ areaList?: AreaList[]
10
+ cityId: string
11
+ cityName: string
12
+ provinceId: string
13
+ }
14
+
15
+ interface AreaList {
16
+ areaId: string
17
+ areaName: string
18
+ cityId: string
19
+ }
20
+ export interface AreaOptions {
21
+ label: string
22
+ value: string
23
+ children?: AreaOptions[]
24
+ }
25
+ export const getProvinceCityArea = async () => {
26
+ const { data } = await uni.$lcb.http.post<ProvinceCityArea[]>('/provinces/provinceCityArea')
27
+ return data.map(({ provinceId, provinceName, cityList }) => {
28
+ return {
29
+ label: provinceName,
30
+ value: provinceId,
31
+ children: cityList.map(({ cityId, cityName, areaList }) => {
32
+ return {
33
+ label: cityName,
34
+ value: cityId,
35
+ children: areaList?.map(({ areaId, areaName }) => {
36
+ return {
37
+ label: areaName,
38
+ value: areaId,
39
+ }
40
+ }),
41
+ }
42
+ }),
43
+ }
44
+ })
45
+ }
@@ -0,0 +1,77 @@
1
+ <template>
2
+ <wd-col-picker
3
+ v-model="valueModel"
4
+ :columns="area"
5
+ :column-change="columnChange"
6
+ :use-default-slot="true"
7
+ @confirm="handleConfirm"
8
+ >
9
+ <slot :text="areaText" />
10
+ </wd-col-picker>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ import { onMounted, ref, watch } from 'vue'
15
+ import { LcbAreaPickerProps } from './types'
16
+ import { AreaOptions, getProvinceCityArea } from './api'
17
+ import { ColPickerColumnChangeOption } from '@tplc/wot/types/components/wd-col-picker/types'
18
+ defineOptions({
19
+ name: 'LcbAreaPicker',
20
+ options: {
21
+ addGlobalClass: true,
22
+ virtualHost: true,
23
+ styleIsolation: 'shared',
24
+ },
25
+ })
26
+ withDefaults(defineProps<LcbAreaPickerProps>(), {})
27
+ const emits = defineEmits<{
28
+ (event: 'confirm', payload: AreaOptions[]): void
29
+ }>()
30
+ const valueModel = defineModel<string[]>({
31
+ default: [],
32
+ })
33
+ const area = ref<AreaOptions[][]>([])
34
+ const areaText = ref<string[]>()
35
+ const columnChange = ({ selectedItem, resolve, finish }: ColPickerColumnChangeOption) => {
36
+ if (selectedItem.children) {
37
+ resolve(selectedItem.children)
38
+ } else {
39
+ finish()
40
+ }
41
+ }
42
+ onMounted(async () => {
43
+ const data = await getProvinceCityArea()
44
+ area.value = [data]
45
+ })
46
+ const stopWatch = watch(
47
+ [valueModel, area],
48
+ ([value, areas]) => {
49
+ if (value.length !== 0 && areas.length !== 0) {
50
+ let list = [...areas]
51
+ areaText.value = value.reduce((acc, cur) => {
52
+ const item = list[0].find((item) => item.value === cur)
53
+ if (item) {
54
+ acc.push(item.label)
55
+ list = item.children ? [item.children] : []
56
+ }
57
+ return acc
58
+ }, [] as string[])
59
+ const cityItem = areas[0].find((item) => item.value === value[0])
60
+ const areaItem = cityItem?.children?.find((item) => item.value === value[1])
61
+ if (cityItem?.children && areaItem?.children)
62
+ area.value = [areas[0], cityItem.children, areaItem.children]
63
+ stopWatch()
64
+ }
65
+ },
66
+ {
67
+ immediate: true,
68
+ deep: true,
69
+ },
70
+ )
71
+ function handleConfirm({ selectedItems }: { selectedItems: AreaOptions[] }) {
72
+ emits('confirm', selectedItems)
73
+ areaText.value = selectedItems.map((item) => item.label)
74
+ }
75
+ </script>
76
+
77
+ <style lang="scss" scoped></style>
@@ -0,0 +1,3 @@
1
+ export interface LcbAreaPickerProps {
2
+ // Define the component's prop types here
3
+ }
@@ -9,7 +9,7 @@
9
9
  <view class="text-#999 text-22rpx mt-2">{{ hint }}</view>
10
10
  </view>
11
11
  </view>
12
- <wd-icon class-prefix="iconfont" name="a-xingzhuang97" size="24rpx" color="#666666" />
12
+ <wd-icon class-prefix="lcb" name="a-xingzhuang97" size="24rpx" color="#666666" />
13
13
  </view>
14
14
  <scroll-view scroll-x class="w-full whitespace-nowrap pb-24rpx">
15
15
  <lcb-action-view v-for="(item, index) in items" :key="index" v-bind="item.link">
@@ -39,7 +39,7 @@
39
39
  />
40
40
  <view class="p-24rpx text-30rpx text-#333 flex justify-between items-center">
41
41
  <view>{{ title }}</view>
42
- <wd-icon class-prefix="iconfont" name="a-xingzhuang103" size="30rpx" color="#666" />
42
+ <wd-icon class-prefix="lcb" name="a-xingzhuang103" size="30rpx" color="#666" />
43
43
  </view>
44
44
  </view>
45
45
  </lcb-block>
@@ -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,72 @@
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" v-model="addressCity">
7
+ <view class="font-bold max-w-13 truncate">{{ addressCity?.addr || '附近' }}</view>
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
+ import { ChildHotAddress } from '../lcb-city-select/api'
40
+ defineOptions({
41
+ name: 'LcbCalendarSearch',
42
+ options: {
43
+ addGlobalClass: true,
44
+ virtualHost: true,
45
+ styleIsolation: 'shared',
46
+ },
47
+ })
48
+ withDefaults(defineProps<LcbCalendarSearchProps>(), {
49
+ marginHorizontal: 24,
50
+ radius: 16,
51
+ placeholder: '城市|地点|品牌',
52
+ })
53
+ const addressCity = ref<ChildHotAddress>()
54
+
55
+ const dayRange = ref([dayjs().valueOf(), dayjs().add(1, 'day').valueOf()])
56
+ const { translate } = useTranslate()
57
+ const { getLocation, userLocation } = useLocation()
58
+ getLocation()
59
+ </script>
60
+
61
+ <style lang="scss" scoped>
62
+ .v-line {
63
+ width: 1rpx;
64
+ height: 40rpx;
65
+ background: #999999;
66
+ opacity: 0.5;
67
+ margin: 0 20rpx;
68
+ }
69
+ .hint {
70
+ color: #999;
71
+ }
72
+ </style>
@@ -0,0 +1,6 @@
1
+ import { LcbBlockProps } from '../lcb-block/types'
2
+
3
+ export interface LcbCalendarSearchProps extends LcbBlockProps {
4
+ // Define the component's prop types here
5
+ placeholder?: string
6
+ }
@@ -0,0 +1,34 @@
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', {})
21
+ export interface LcbAddress {
22
+ addr: string
23
+ addrFlag: boolean
24
+ categoryName: string
25
+ cityId: string
26
+ hotAddressId: string
27
+ provinceCityName: string
28
+ area: string
29
+ weightSort: string
30
+ }
31
+ export const getAddressList = (addr: string) =>
32
+ uni.$lcb.http.post<LcbAddress[]>('/hotAddress/list', {
33
+ addr,
34
+ })
@@ -0,0 +1,171 @@
1
+ <template>
2
+ <view class="h-0 flex-1 pb-3" v-if="letterList.length">
3
+ <wd-index-bar ref="indexBarRef">
4
+ <view v-for="item in indexBars" :key="item.categoryName">
5
+ <wd-index-anchor
6
+ :index="item.categoryName.slice(0, 2)"
7
+ icon="./images/anchor.png"
8
+ customClass="!bg-transparent !pt-32rpx !pb-0 font-bold !text-28rpx !pl-28rpx"
9
+ >
10
+ <view class="flex items-center">
11
+ <image
12
+ src="../../images/hot.png"
13
+ class="w-4 h-4 mr-1"
14
+ v-if="item.categoryName.includes('热门')"
15
+ />
16
+ <view class="text-3 text-#333 font-500">
17
+ {{ item.hint || item.categoryName }}
18
+ </view>
19
+ </view>
20
+ </wd-index-anchor>
21
+ <view
22
+ class="grid grid-cols-4 gap-3 pt-20rpx pl-28rpx pr-10 box-border"
23
+ :class="item.categoryName.includes('字母') ? 'grid-cols-8' : 'grid-cols-4'"
24
+ >
25
+ <view
26
+ class="address-tag"
27
+ :class="{
28
+ 'current-address': modelValue && modelValue.hotAddressId === city.hotAddressId,
29
+ }"
30
+ v-for="city in item.childHotAddress"
31
+ :key="city.addr"
32
+ @click="onAddrClick(city, item.categoryName.includes('字母'))"
33
+ :style="{
34
+ fontSize: city.addr.length > 4 ? '20rpx' : '24rpx',
35
+ }"
36
+ >
37
+ {{ city.addr }}
38
+ </view>
39
+ </view>
40
+ </view>
41
+ </wd-index-bar>
42
+ </view>
43
+ </template>
44
+
45
+ <script setup lang="ts">
46
+ import { LcbCitySelectProps } from '../../../lcb-city-select/types'
47
+ import { ChildHotAddress, getHotAddress, HotAddress } from '../../../lcb-city-select/api'
48
+ import { computed, onMounted, ref, watch } from 'vue'
49
+
50
+ defineOptions({
51
+ name: 'LcbCityLetter',
52
+ options: {
53
+ addGlobalClass: true,
54
+ virtualHost: true,
55
+ styleIsolation: 'shared',
56
+ },
57
+ })
58
+ const props = withDefaults(defineProps<LcbCitySelectProps>(), {})
59
+ const indexBarRef = ref<{ scrollToIndex: (index: string) => void }>()
60
+ const addressRef = ref<HotAddress[]>([])
61
+ const letterList = ref<string[]>([])
62
+ const historyAddress = ref<ChildHotAddress[]>([])
63
+ const modelValue = defineModel<ChildHotAddress>()
64
+ onMounted(async () => {
65
+ const { data } = await getHotAddress()
66
+ letterList.value = data
67
+ .filter((v) => !v.categoryName.includes('热门'))
68
+ .map((item) => item.categoryName)
69
+ addressRef.value = data
70
+ historyAddress.value = JSON.parse(uni.getStorageSync('historyAddress') || '[]')
71
+ })
72
+ const locationAddress = computed<HotAddress[]>(() => {
73
+ return props.location
74
+ ? ([
75
+ {
76
+ categoryName: '定位',
77
+ hint: '当前位置',
78
+ childHotAddress: [
79
+ {
80
+ addressInfo: props.location.addressInfo,
81
+ addr: props.location.cityName,
82
+ hotAddressId: props.location.cityId,
83
+ },
84
+ ],
85
+ },
86
+ ] as HotAddress[])
87
+ : []
88
+ })
89
+
90
+ const historyList = computed<HotAddress[]>(() => {
91
+ return historyAddress.value.length
92
+ ? [
93
+ {
94
+ categoryName: '历史',
95
+ hint: '历史选择',
96
+ childHotAddress: historyAddress.value,
97
+ },
98
+ ]
99
+ : []
100
+ })
101
+ watch(
102
+ () => historyAddress.value,
103
+ (val) => {
104
+ if (val.length) {
105
+ uni.setStorageSync('historyAddress', JSON.stringify(val))
106
+ }
107
+ },
108
+ )
109
+ const onAddrClick = (city: ChildHotAddress, letter = false) => {
110
+ if (letter) {
111
+ indexBarRef.value?.scrollToIndex(city.addr)
112
+ return
113
+ }
114
+ modelValue.value = city
115
+ historyAddress.value = historyAddress.value.filter(
116
+ (item) => item.hotAddressId !== city.hotAddressId,
117
+ )
118
+ if (historyAddress.value.length === 8) {
119
+ historyAddress.value = [city, ...historyAddress.value.slice(0, 7)]
120
+ } else {
121
+ historyAddress.value = [city, ...historyAddress.value]
122
+ }
123
+ }
124
+ const indexBars = computed<HotAddress[]>(() => {
125
+ const letters = letterList.value.length
126
+ ? ([
127
+ {
128
+ categoryName: '字母索引',
129
+ childHotAddress: letterList.value.map((v) => {
130
+ return {
131
+ addr: v,
132
+ hotAddressId: v,
133
+ }
134
+ }),
135
+ },
136
+ ] as HotAddress[])
137
+ : ([] as HotAddress[])
138
+ return [...locationAddress.value, ...historyList.value, ...letters, ...addressRef.value]
139
+ })
140
+ </script>
141
+ <style lang="scss" scoped>
142
+ @import '@tplc/wot/components/common/abstracts/variable';
143
+ .address-tag {
144
+ background: #f7f7f7;
145
+ height: 68rpx;
146
+ display: flex;
147
+ align-items: center;
148
+ justify-content: center;
149
+ padding: 0 16rpx;
150
+ border-radius: 10rpx;
151
+ font-size: 24rpx;
152
+ text-align: center;
153
+ overflow: hidden;
154
+ }
155
+ .current-address {
156
+ color: $-color-theme;
157
+ background: transparent;
158
+ position: relative;
159
+ &::after {
160
+ content: '';
161
+ position: absolute;
162
+ bottom: 0;
163
+ left: 0;
164
+ width: 100%;
165
+ height: 100%;
166
+ z-index: 1;
167
+ background: $-color-theme;
168
+ opacity: 0.1;
169
+ }
170
+ }
171
+ </style>