@tplc/business 0.0.27 → 0.0.29

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 (94) hide show
  1. package/CHANGELOG.md +48 -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/lcb-calendar.vue +3 -3
  7. package/components/lcb-calendar-search/lcb-calendar-search.vue +5 -2
  8. package/components/lcb-city-select/api/index.ts +15 -1
  9. package/components/lcb-city-select/components/lcb-city-letter/index.vue +171 -0
  10. package/components/lcb-city-select/components/lcb-city-list/index.vue +127 -0
  11. package/components/lcb-city-select/components/lcb-city-list/types.ts +6 -0
  12. package/components/lcb-city-select/images/hot.png +0 -0
  13. package/components/lcb-city-select/lcb-city-select.vue +95 -118
  14. package/components/lcb-dynamic-data/lcb-dynamic-data.vue +25 -0
  15. package/components/lcb-dynamic-data/types.ts +7 -0
  16. package/components/lcb-home-search/lcb-home-search.vue +16 -7
  17. package/components/lcb-image/lcb-image.vue +35 -23
  18. package/components/lcb-image/types.ts +1 -1
  19. package/components/lcb-img-nav/lcb-img-nav.vue +70 -30
  20. package/components/lcb-img-nav/types.ts +3 -3
  21. package/components/{lcb-filter → lcb-list}/api.ts +20 -9
  22. package/components/{lcb-filter → lcb-list}/components/ComponentGroup/index.vue +1 -1
  23. package/components/lcb-list/components/FilterList/index.vue +85 -0
  24. package/components/lcb-list/components/FilterList/type.ts +9 -0
  25. package/components/{lcb-filter → lcb-list}/components/FilterSlider/index.vue +2 -1
  26. package/components/lcb-list/components/FilterSlider/types.ts +3 -0
  27. package/components/lcb-list/components/FilterTabs/index.vue +27 -0
  28. package/components/lcb-list/components/FilterTabs/type.ts +6 -0
  29. package/components/{lcb-filter → lcb-list}/index.scss +23 -0
  30. package/components/lcb-list/lcb-list.vue +179 -0
  31. package/components/{lcb-filter → lcb-list}/types.ts +6 -1
  32. package/components/lcb-nav/lcb-nav.vue +10 -22
  33. package/components/lcb-notice/Item/index.vue +4 -4
  34. package/components/lcb-notice/lcb-notice.vue +10 -8
  35. package/components/lcb-notice/types.ts +4 -1
  36. package/components/lcb-product/lcb-product.vue +7 -7
  37. package/components/lcb-product/types.ts +3 -3
  38. package/components/lcb-product-item/lcb-product-item.vue +24 -12
  39. package/components/lcb-user-order/lcb-user-order.vue +44 -23
  40. package/components/lcb-user-top/lcb-user-top.vue +77 -48
  41. package/global.d.ts +3 -1
  42. package/hooks/usePageScroll.ts +10 -0
  43. package/iconfonts/index.css +1 -175
  44. package/package.json +5 -2
  45. package/types/components/lcb-area-picker/api/index.d.ts +38 -0
  46. package/types/components/lcb-area-picker/lcb-area-picker.vue.d.ts +67 -0
  47. package/types/components/lcb-area-picker/types.d.ts +1 -0
  48. package/types/components/lcb-calendar-search/lcb-calendar-search.vue.d.ts +1 -1
  49. package/types/components/lcb-city-select/api/index.d.ts +14 -1
  50. package/types/components/lcb-city-select/components/lcb-city-letter/index.vue.d.ts +53 -0
  51. package/types/components/{lcb-filter/lcb-filter.vue.d.ts → lcb-city-select/components/lcb-city-list/index.vue.d.ts} +9 -18
  52. package/types/components/lcb-city-select/components/lcb-city-list/types.d.ts +5 -0
  53. package/types/components/lcb-city-select/lcb-city-select.vue.d.ts +13 -4
  54. package/types/components/lcb-dynamic-data/lcb-dynamic-data.vue.d.ts +44 -0
  55. package/types/components/lcb-dynamic-data/types.d.ts +7 -0
  56. package/types/components/lcb-home-search/lcb-home-search.vue.d.ts +1 -1
  57. package/types/components/lcb-image/lcb-image.vue.d.ts +1 -1
  58. package/types/components/lcb-img-nav/types.d.ts +2 -2
  59. package/types/components/{lcb-filter → lcb-list}/api.d.ts +18 -7
  60. package/types/components/lcb-list/components/FilterList/index.vue.d.ts +28 -0
  61. package/types/components/lcb-list/components/FilterList/type.d.ts +9 -0
  62. package/types/components/lcb-list/components/FilterSlider/types.d.ts +2 -0
  63. package/types/components/lcb-list/components/FilterTabs/index.vue.d.ts +36 -0
  64. package/types/components/lcb-list/components/FilterTabs/type.d.ts +5 -0
  65. package/types/components/lcb-list/lcb-list.vue.d.ts +74 -0
  66. package/types/components/{lcb-filter → lcb-list}/types.d.ts +5 -1
  67. package/types/components/lcb-notice/lcb-notice.vue.d.ts +3 -0
  68. package/types/components/lcb-notice/types.d.ts +3 -0
  69. package/types/hooks/usePageScroll.d.ts +2 -0
  70. package/components/lcb-filter/components/FilterSlider/types.ts +0 -3
  71. package/components/lcb-filter/lcb-filter.vue +0 -147
  72. package/types/components/lcb-filter/components/FilterSlider/types.d.ts +0 -2
  73. /package/components/{lcb-filter → lcb-list}/components/ActionView/index.vue +0 -0
  74. /package/components/{lcb-filter → lcb-list}/components/ComponentGroup/type.ts +0 -0
  75. /package/components/{lcb-filter → lcb-list}/components/FilterSelect/index.vue +0 -0
  76. /package/components/{lcb-filter → lcb-list}/components/FilterSelect/type.ts +0 -0
  77. /package/components/{lcb-filter → lcb-list}/components/SelectTagView/index.vue +0 -0
  78. /package/components/{lcb-filter → lcb-list}/components/TagSelect/index.vue +0 -0
  79. /package/components/{lcb-filter → lcb-list}/components/TagSelect/type.ts +0 -0
  80. /package/components/{lcb-filter → lcb-list}/components/TreeSelect/index.vue +0 -0
  81. /package/components/{lcb-filter → lcb-list}/components/TreeSelect/type.ts +0 -0
  82. /package/components/{lcb-filter → lcb-list}/hooks/useSelect.ts +0 -0
  83. /package/types/components/{lcb-filter → lcb-list}/components/ActionView/index.vue.d.ts +0 -0
  84. /package/types/components/{lcb-filter → lcb-list}/components/ComponentGroup/index.vue.d.ts +0 -0
  85. /package/types/components/{lcb-filter → lcb-list}/components/ComponentGroup/type.d.ts +0 -0
  86. /package/types/components/{lcb-filter → lcb-list}/components/FilterSelect/index.vue.d.ts +0 -0
  87. /package/types/components/{lcb-filter → lcb-list}/components/FilterSelect/type.d.ts +0 -0
  88. /package/types/components/{lcb-filter → lcb-list}/components/FilterSlider/index.vue.d.ts +0 -0
  89. /package/types/components/{lcb-filter → lcb-list}/components/SelectTagView/index.vue.d.ts +0 -0
  90. /package/types/components/{lcb-filter → lcb-list}/components/TagSelect/index.vue.d.ts +0 -0
  91. /package/types/components/{lcb-filter → lcb-list}/components/TagSelect/type.d.ts +0 -0
  92. /package/types/components/{lcb-filter → lcb-list}/components/TreeSelect/index.vue.d.ts +0 -0
  93. /package/types/components/{lcb-filter → lcb-list}/components/TreeSelect/type.d.ts +0 -0
  94. /package/types/components/{lcb-filter → lcb-list}/hooks/useSelect.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,54 @@
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.29](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.14...v0.0.29) (2024-10-19)
6
+
7
+
8
+ ### ✨ Features | 新功能
9
+
10
+ * notice 修改 ([274090d](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/274090dbf6697e1e8059e83005ea0df1dbc679a5))
11
+ * 完成列表首页 ([d00b2e0](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/d00b2e0d3e8c397fe8723675ee311bd93a463908))
12
+ * 新增tabs todo 自定义颜色 ([4a71d82](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/4a71d82f3c300695e0004426f31a46f0d86cebe4))
13
+
14
+ ### [0.0.28](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.13...v0.0.28) (2024-10-19)
15
+
16
+
17
+ ### ✨ Features | 新功能
18
+
19
+ * a ([98179b6](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/98179b669c589bfa475f7ca2e28bd806e2710ea5))
20
+ * cahec ([9d3fc53](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/9d3fc53421c46e9ffb4833ec5f300fdd2b4e9e7d))
21
+ * city ([ae7f3d4](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ae7f3d4a94dc7b83e4b9e74e8f692a052e0f0431))
22
+ * city select ([c11e6a2](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c11e6a2cf11bf47ebac66a083f8e8942add21105))
23
+ * data数据 ([36f3e4b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/36f3e4bcc1a70c81e588339b58c7e8a05199ed89))
24
+ * icon ([c1cd815](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c1cd81542df16f0f799f1217f0eefd33b84e18fb))
25
+ * status 变更 ([c745aa7](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c745aa77b4ce3d27f6b037cee7584e38e41db84a))
26
+ * upload version ([e5b2bec](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/e5b2bec9e00beda4873a01b5ae41211b8e26a733))
27
+ * 列表调整 ([3a4dc00](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/3a4dc00d55c74840e979545c5f2817953bfcddf8))
28
+ * 历史 ([108d5e6](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/108d5e6a00deb0c21b25cef8441ea75058c77859))
29
+ * 城市 ([0c9ea36](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/0c9ea36b11aed6c147b7a83ad933d224a53748c1))
30
+ * 处理问题 ([832cd7b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/832cd7beedd12b4d88af131e482b22ec3b9878bb))
31
+ * 完成城市选择 ([7a6b8e6](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/7a6b8e698b001bb65bfc6fcdf6d22e0660753d82))
32
+ * 支持search ([6303a47](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/6303a4771c03a051f1e188f30b6212fa9a50246b))
33
+ * 支持token ([01e0594](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/01e059414d80d3f59baf12dd1461990a7e86d641))
34
+ * 新增cell ([7d11105](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/7d1110518832ce6a32f418361b67fd24646b4805))
35
+ * 新增history ([11d1ddb](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/11d1ddbdad4340bb2c2a5b996b182621d7016d0e))
36
+ * 新增list ([4ee981e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/4ee981ed2b1e870aafedbe7c6295a0c67960b3bf))
37
+ * 更换字体 ([72b717e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/72b717eab197eb6bf8a6e9e62b3410d42362b049))
38
+ * 省市区选择器 ([d566a2a](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/d566a2ad24911f17da2ed85a547ca0ca0394705b))
39
+ * 背景颜色调整 ([96a47ff](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/96a47fff5dd1e1a043cca4e7a3c0c129ff2190e9))
40
+ * 调整icon ([a24baaa](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/a24baaa5ef466247d455303c7287e399f5695066))
41
+ * 调整字体大小 ([3a8b1be](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/3a8b1be88b051b0bc5e35885b30786984919878f))
42
+ * 过滤 ([e006ffb](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/e006ffb48240903af1ec860725e917f4906e97c4))
43
+ * 过滤列表 ([405d86c](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/405d86cb3c0fe9dbed6cd4da7c04c6843e602269))
44
+ * 选择城市 ([7eeb263](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/7eeb263982a70f7ca837144f4ae77b85d5c02e6e))
45
+
46
+
47
+ ### 🐛 Bug Fixes | Bug 修复
48
+
49
+ * 修复slider 选择快捷没有变更值 ([c800d52](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c800d524b5c6256add0620a21d3abe321a9342a6))
50
+ * 修改选择地区定位错误问题 ([77586e6](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/77586e6253174ab92f61635c4eefdabf3d1fdce3))
51
+ * 选择城市定位问题 ([0a1bc9e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/0a1bc9e01ab353eab8d531f4ab6aacdcd12b302a))
52
+
5
53
  ### [0.0.27](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.12...v0.0.27) (2024-10-10)
6
54
 
7
55
 
@@ -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>
@@ -82,13 +82,13 @@ const formatter = (day: any) => {
82
82
  const nowDa = now.getDate()
83
83
 
84
84
  const info = holidayInfo.value[dayjs(day.date).format('YYYY-MM-DD')]
85
- if (info.topText) {
85
+ if (info?.topText) {
86
86
  day.topInfo = info.topText
87
87
  }
88
- if (info.bottomText) {
88
+ if (info?.bottomText) {
89
89
  day.bottomInfo = info.bottomText
90
90
  }
91
- if (info.centerText) {
91
+ if (info?.centerText) {
92
92
  day.text = info.centerText
93
93
  }
94
94
  if (year === nowYear && month === nowMonth && da === nowDa) {
@@ -3,8 +3,8 @@
3
3
  <view
4
4
  class="flex flex-1 text-#333 rounded-16rpx bg-#F5F5F7 h-78rpx flex items-center px-3 text-[28rpx]"
5
5
  >
6
- <lcb-city-select :location="userLocation">
7
- <text class="font-bold">{{ userLocation?.cityName || '附近' }}</text>
6
+ <lcb-city-select :location="userLocation" v-model="addressCity">
7
+ <view class="font-bold max-w-13 truncate">{{ addressCity?.addr || '附近' }}</view>
8
8
  </lcb-city-select>
9
9
  <view class="v-line"></view>
10
10
  <lcb-calendar v-model="dayRange">
@@ -36,6 +36,7 @@ import dayjs from 'dayjs/esm'
36
36
  import useLocation from '../../hooks/useLocation'
37
37
  import { ref } from 'vue'
38
38
  import { LcbCalendarSearchProps } from './types'
39
+ import { ChildHotAddress } from '../lcb-city-select/api'
39
40
  defineOptions({
40
41
  name: 'LcbCalendarSearch',
41
42
  options: {
@@ -49,6 +50,8 @@ withDefaults(defineProps<LcbCalendarSearchProps>(), {
49
50
  radius: 16,
50
51
  placeholder: '城市|地点|品牌',
51
52
  })
53
+ const addressCity = ref<ChildHotAddress>()
54
+
52
55
  const dayRange = ref([dayjs().valueOf(), dayjs().add(1, 'day').valueOf()])
53
56
  const { translate } = useTranslate()
54
57
  const { getLocation, userLocation } = useLocation()
@@ -1,6 +1,6 @@
1
1
  export interface HotAddress {
2
2
  categoryName: string
3
- hint: string
3
+ hint?: string
4
4
  childHotAddress: ChildHotAddress[]
5
5
  }
6
6
 
@@ -18,3 +18,17 @@ export interface ChildHotAddress {
18
18
  addressInfo?: string
19
19
  }
20
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>
@@ -0,0 +1,127 @@
1
+ <template>
2
+ <view class="p-3 box-border flex-1 overflow-y-auto h-0">
3
+ <view v-for="item in list" :key="item.hotAddressId" @click="onItemClick(item)">
4
+ <view class="flex">
5
+ <view class="tag">{{ item.categoryName }}</view>
6
+ <view class="content">
7
+ <rich-text :nodes="getText(item.addr)" />
8
+ <view>{{ item.provinceCityName || item.area }}</view>
9
+ </view>
10
+ </view>
11
+ </view>
12
+ <view v-if="!list.length">
13
+ <view v-if="historyList.length">
14
+ <view class="flex justify-between items-center">
15
+ <view class="text-28rpx text-#333 font-500x">历史搜索</view>
16
+ <wd-icon name="delete" size="30rpx" color="#999" @click="onClear" />
17
+ </view>
18
+ <view class="flex gap-2 flex-wrap">
19
+ <view
20
+ v-for="item in historyList"
21
+ :key="item.hotAddressId"
22
+ @click="emits('click', item)"
23
+ class="history-tag"
24
+ >
25
+ {{ item.addr }},
26
+ {{ item.area || item.provinceCityName }}
27
+ </view>
28
+ </view>
29
+ </view>
30
+ <wd-status-tip
31
+ v-else-if="keyword"
32
+ image="search"
33
+ tip="当前搜索无结果"
34
+ custom-class="!mt-20"
35
+ />
36
+ </view>
37
+ </view>
38
+ </template>
39
+
40
+ <script setup lang="ts">
41
+ import { LcbAddress } from '../../../lcb-city-select/api'
42
+ import { LcbCityListProps } from './types'
43
+ import { ref } from 'vue'
44
+
45
+ defineOptions({
46
+ name: 'LcbCityList',
47
+ options: {
48
+ addGlobalClass: true,
49
+ virtualHost: true,
50
+ styleIsolation: 'shared',
51
+ },
52
+ })
53
+ const emits = defineEmits(['click'])
54
+ const historyList = ref<LcbAddress[]>(uni.getStorageSync('lcb_city_select_history') || [])
55
+ const props = withDefaults(defineProps<LcbCityListProps>(), {})
56
+ const getText = (text: string) => {
57
+ const str = text.replace(props.keyword, `<div class="text-light">${props.keyword}</div>`)
58
+ return `<div class="flex">${str}</div>`
59
+ }
60
+ const onItemClick = (item: LcbAddress) => {
61
+ if (historyList.value.some((historyItem) => historyItem.hotAddressId === item.hotAddressId)) {
62
+ historyList.value = historyList.value.filter(
63
+ (historyItem) => historyItem.hotAddressId !== item.hotAddressId,
64
+ )
65
+ }
66
+ historyList.value.unshift(item)
67
+ uni.setStorageSync('lcb_city_select_history', historyList.value)
68
+ emits('click', item)
69
+ }
70
+ const onClear = () => {
71
+ historyList.value = []
72
+ uni.removeStorageSync('lcb_city_select_history')
73
+ }
74
+ </script>
75
+ <style lang="scss" scoped>
76
+ @import '@tplc/wot/components/common/abstracts/variable';
77
+ .tag {
78
+ width: 80rpx;
79
+ height: 34rpx;
80
+ line-height: 34rpx;
81
+ text-align: center;
82
+ color: #fff;
83
+ font-size: 20rpx;
84
+ border-radius: 4rpx;
85
+ background-color: $-color-theme;
86
+ }
87
+ .content {
88
+ flex: 1;
89
+ display: flex;
90
+ margin-left: 16rpx;
91
+ flex-direction: column;
92
+ justify-content: center;
93
+ border-bottom: 1px solid #eee;
94
+ padding-bottom: 20rpx;
95
+ font-size: 24rpx;
96
+ color: #999;
97
+ > rich-text {
98
+ &:first-child {
99
+ font-size: 30rpx;
100
+ line-height: 34rpx;
101
+ font-weight: bold;
102
+ color: #333;
103
+ margin-bottom: 12rpx;
104
+ }
105
+ }
106
+ .text-light {
107
+ color: $-color-theme;
108
+ }
109
+ }
110
+ .history-tag {
111
+ background: #f7f7f7;
112
+ height: 50rpx;
113
+ display: flex;
114
+ align-items: center;
115
+ justify-content: center;
116
+ padding: 0 24rpx;
117
+ border-radius: 2rpx;
118
+ font-size: 24rpx;
119
+ text-align: center;
120
+ overflow: hidden;
121
+ margin-top: 12rpx;
122
+ white-space: nowrap;
123
+ overflow: hidden;
124
+ text-overflow: ellipsis;
125
+ color: #333;
126
+ }
127
+ </style>
@@ -0,0 +1,6 @@
1
+ import { LcbAddress } from '../../../lcb-city-select/api'
2
+
3
+ export interface LcbCityListProps {
4
+ list: LcbAddress[]
5
+ keyword: string
6
+ }