Browse Source

搜索店铺 bug 修复

冯诚 2 years ago
parent
commit
45256742f5
1 changed files with 10 additions and 5 deletions
  1. 10 5
      src/pages/repair/steps/StepOne.vue

+ 10 - 5
src/pages/repair/steps/StepOne.vue

@@ -2,7 +2,7 @@
   <h3 class="ptc-title">Choose a store</h3>
   <div class="ptc-block">
     <div class="ptc-inner-md pr">
-      <form class="search-wrap" action="">
+      <form class="search-wrap" action="" @submit.prevent>
         <input
           v-model="code"
           type="search"
@@ -36,7 +36,7 @@
           scroll-target=".shop-list-wrap"
           @loadmore="fetchData"
         >
-          <ul class="shop-list">
+          <ul v-if="list && list.length" class="shop-list">
             <li
               v-for="(item, index) of list"
               :key="index"
@@ -60,6 +60,10 @@
               </div>
             </li>
           </ul>
+          <div v-else-if="!loading" class="ptc-empty">
+            <i class="ptc-empty-img"></i>
+            <p class="ptc-empty-txt">No results</p>
+          </div>
         </InfiniteList>
       </div>
     </div>
@@ -95,14 +99,15 @@ async function fetchData() {
     let { results } = await getShopList({
       page: pageNo,
       size: 10,
-      lat: coords?.latitude,
-      lng: coords?.longitude,
+      lat: postCode.value ? undefined : coords?.latitude,
+      lng: postCode.value ? undefined : coords?.longitude,
       post_code: postCode.value,
     })
     results = results.results || results
     list.value.push(...results.items)
     pageNo++
-    hasMore.value = list.value.length < results.pageBean.totalCount
+    hasMore.value =
+      list.value.length < results.pageBean.totalCount || !list.value.length
   } catch {}
   loading.value = false
 }