Bläddra i källkod

feat: 创客搜索

Basil 2 år sedan
förälder
incheckning
832a5b28f0
3 ändrade filer med 21 tillägg och 7 borttagningar
  1. 1 1
      src/pages.json
  2. 1 1
      src/pages/home/index.vue
  3. 19 5
      src/pages/store/nearby/index.vue

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
src/pages.json


+ 1 - 1
src/pages/home/index.vue

@@ -162,7 +162,7 @@ page {
162 162
   background-color: #f8f8f8;
163 163
 }
164 164
 </style>
165
-<route lang="yaml"   type="home">
165
+<route lang="yaml">
166 166
 style:
167 167
   navigationStyle: custom
168 168
   navigationBarTitleText: 储蓄保

+ 19 - 5
src/pages/store/nearby/index.vue

@@ -22,6 +22,7 @@ const state = reactive<any>({
22 22
   currentMerchantCategoryId: 0,
23 23
   // merchantPageInfo: {}
24 24
 })
25
+const searchValue = ref('')
25 26
 
26 27
 const { windowHeight } = uni.getSystemInfoSync()
27 28
 state.scrollHeight = windowHeight
@@ -48,20 +49,21 @@ onLoad(() => {
48 49
 })
49 50
 
50 51
 function handleCategoryChange(category) {
51
-  console.log(category)
52
+  // console.log(category)
52 53
   state.currentMerchantCategoryId = category.merchant_category_id
53 54
   // console.log(category)
54 55
   // loadSelectMerchant()
55 56
   loadSelectMerchant(category.merchant_category_id)
56 57
 }
57
-function loadSelectMerchant(category_id) {
58
+function loadSelectMerchant(category_id: number, mer_keyword?: string) {
58 59
   if (category_id == 0) {
59 60
     state.currentMerchantCategoryId = category_id
60 61
   }
61 62
   let params: StoreParams = {
62 63
     pageNum: 1,
63 64
     pageSize: 10,
64
-    mer_keyword: '',
65
+    mer_keyword: mer_keyword ? mer_keyword : '',
66
+    // mer_keyword: mer_keyword,
65 67
     lat: '',
66 68
     lng: '',
67 69
   }
@@ -84,6 +86,7 @@ function handleShowMerchant(merchant) {
84 86
   })
85 87
 }
86 88
 
89
+
87 90
 function change() {}
88 91
 function onChange() {}
89 92
 </script>
@@ -92,6 +95,13 @@ function onChange() {}
92 95
 <!--    <nut-category-pane :categoryChild="state.merchantList" @onChange="onChange">-->
93 96
 <!--    </nut-category-pane>-->
94 97
 <!--  </nut-category>-->
98
+  <nut-searchbar v-model="searchValue" @search="loadSelectMerchant(0, searchValue)" @clear="loadSelectMerchant(0, '')">
99
+    <template v-slot:rightout>
100
+      <div @tap="loadSelectMerchant(0, searchValue)">
101
+        搜索
102
+      </div>
103
+    </template>
104
+  </nut-searchbar>
95 105
   <div class="flex">
96 106
     <!-- 左侧 一级分类 -->
97 107
     <scroll-view
@@ -103,7 +113,11 @@ function onChange() {}
103 113
           @tap="loadSelectMerchant(0)"
104 114
           :class="state.currentMerchantCategoryId == 0 ? 'bg-white font-bold' : ''"
105 115
           class="relative h-15 block text-sm flex justify-center items-center">
106
-        <div>全部</div>
116
+        <div class="flex items-center gap-1">
117
+          <div class="h-4 bg-primary w-1"></div>
118
+          <div>全部</div>
119
+        </div>
120
+
107 121
       </div>
108 122
       <div v-for="(item, index) in state.merchantCategory" :key="index"
109 123
            @tap="handleCategoryChange(item)"
@@ -156,7 +170,7 @@ function onChange() {}
156 170
     </scroll-view>
157 171
   </div>
158 172
 </template>
159
-<route lang="yaml">
173
+<route lang="yaml" type="home">
160 174
 style:
161 175
   navigationBarTitleText: 储蓄保
162 176
   enablePullDownRefresh: true