search.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view class="search-content">
  3. <view class="search-box">
  4. <view class="search-input-box">
  5. <svg t="1733904658291" class="search-icon" viewBox="0 0 1024 1024" version="1.1"
  6. xmlns="http://www.w3.org/2000/svg" p-id="5981" xmlns:xlink="http://www.w3.org/1999/xlink">
  7. <path
  8. d="M174.545 465.455c0-18.619 16.291-34.91 34.91-34.91s34.909 16.291 34.909 34.91c0 121.018 100.072 221.09 221.09 221.09 18.619 0 34.91 16.291 34.91 34.91s-16.291 34.909-34.91 34.909c-160.581 0-290.909-130.328-290.909-290.91z m290.91 360.727c200.145 0 360.727-160.582 360.727-360.727S665.6 104.727 465.455 104.727 104.727 265.31 104.727 465.455 265.31 826.182 465.455 826.182z m323.49-76.8L961.164 921.6c13.963 13.964 13.963 34.91 0 48.873-13.964 13.963-34.91 13.963-48.873 0L737.745 795.927c-74.472 60.51-169.89 97.746-272.29 97.746C228.073 896 34.909 702.836 34.909 465.455S228.073 34.909 465.455 34.909 896 228.073 896 465.455c0 109.381-39.564 209.454-107.055 283.927z"
  9. p-id="5982">
  10. </path>
  11. </svg>
  12. <input confirm-type="search" ref="searchInputRef" class="search-input" :auto-blur="true" type="text"
  13. placeholder="请输入关键字" v-model="searchKey" @blur="onSearchBlur()"
  14. @confirm="onSearchFocus()" />
  15. </view>
  16. <view class="search-select">
  17. <view class="select-item" @click.stop="$refs.cityRef.open()">
  18. <text class="item-text one-row">{{params.codeLabel || '办理区域'}}</text>
  19. <u-icon name="arrow-down-fill" color="#101010" size="16"></u-icon>
  20. </view>
  21. <view class="select-item" @click.stop="$refs.mapTypeRef.open()">
  22. <text class="item-text one-row">{{ params.typeName || '位置类型'}}</text>
  23. <u-icon name="arrow-down-fill" color="#101010" size="16"></u-icon>
  24. </view>
  25. </view>
  26. </view>
  27. <!-- 选择地址 -->
  28. <city ref="cityRef" :code.sync="params.code" @cityName="e => params.codeLabel = e" />
  29. <!-- 选择位置类型 -->
  30. <mapType ref="mapTypeRef" :mapTypeId.sync="params.mapTypeId" @typeName="e => params.typeName = e" />
  31. </view>
  32. </template>
  33. <script>
  34. import { getMapList_Api } from "@/api/map.js"
  35. export default {
  36. data() {
  37. return {
  38. searchKey: undefined,
  39. params: {
  40. code: undefined,
  41. codeLabel: undefined,
  42. mapTypeId: undefined,
  43. typeName: undefined,
  44. }
  45. }
  46. },
  47. methods: {
  48. init() {
  49. },
  50. onSearchBlur(){},
  51. onSearchFocus() {
  52. let pms = {};
  53. if(this.params.code ){
  54. pms.provinceCode = this.params.code[0] || undefined
  55. pms.cityCode = this.params.code[1] || undefined
  56. pms.areaCode = this.params.code[2] || undefined
  57. }
  58. pms.mapTypeId = this.params.mapTypeId;
  59. pms.searchKey = this.searchKey;
  60. this.$emit("handleSearch" , pms)
  61. },
  62. getVal(){
  63. return {
  64. }
  65. },
  66. getMapList() {
  67. }
  68. },
  69. watch: {
  70. params: {
  71. handler(newV, oldV) {
  72. this.onSearchFocus()
  73. },
  74. deep: true
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. $radius_ : 20rpx;
  81. $heig_: 80rpx;
  82. .search-box {
  83. // padding: 20rpx 20rpx 0;
  84. position: fixed;
  85. left: 20rpx;
  86. top: 20rpx;
  87. right: 20rpx;
  88. z-index: 999;
  89. background-color: #fff;
  90. border-radius: $radius_ ;
  91. overflow: hidden;
  92. .search-input-box {
  93. width: 100%;
  94. height: $heig_;
  95. display: flex;
  96. align-items: center;
  97. padding: 0 10px;
  98. color: #020202;
  99. .search-icon {
  100. width: 45rpx;
  101. height: 45rpx;
  102. path {
  103. fill: #020202;
  104. }
  105. }
  106. .search-input {
  107. padding-left: 10px;
  108. }
  109. }
  110. .search-select {
  111. border-top: 1rpx solid #E8E8E8;
  112. width: 100%;
  113. height: $heig_;
  114. display: flex;
  115. justify-content: space-between;
  116. align-items: center;
  117. .select-item {
  118. width: 50%;
  119. display: flex;
  120. justify-content: center;
  121. align-items: center;
  122. font-size: 30rpx;
  123. padding: 0 10rpx;
  124. .item-text {
  125. display: inline-block;
  126. padding-right: 6rpx;
  127. overflow: hidden;
  128. }
  129. }
  130. }
  131. }
  132. </style>