|
@@ -17,44 +17,72 @@
|
|
|
</div>
|
|
|
<div class="shop-wrap">
|
|
|
<div class="tip">Nearby shops</div>
|
|
|
- <ul class="shop-list">
|
|
|
- <li class="shop-item border-bottom" @click="state.step++">
|
|
|
- <div class="shop-name">
|
|
|
- <span>PTC Browns Plains Kiosk</span>
|
|
|
- <span>3.5KM</span>
|
|
|
- </div>
|
|
|
- <div class="shop-address">
|
|
|
- Browns Plains Grand Plaza Shopping Centre, Shop K007 27-49 Browns
|
|
|
- Plains Road, Browns Plains, QLD, 4118 (07) 3059 1014
|
|
|
- </div>
|
|
|
- <div class="shop-mark">
|
|
|
- <i class="icon"></i>Available for appointment today
|
|
|
- </div>
|
|
|
- </li>
|
|
|
- <li class="shop-item">
|
|
|
- <div class="shop-name">
|
|
|
- <span>PTC Browns Plains Kiosk</span>
|
|
|
- <span>3.5KM</span>
|
|
|
- </div>
|
|
|
- <div class="shop-address">
|
|
|
- Browns Plains Grand Plaza Shopping Centre, Shop K007 27-49 Browns
|
|
|
- Plains Road, Browns Plains, QLD, 4118 (07) 3059 1014
|
|
|
- </div>
|
|
|
- <div class="shop-mark danger">
|
|
|
- <i class="icon"></i>Available for appointment today
|
|
|
- </div>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
+ <InfiniteList
|
|
|
+ class="shop-list-wrap"
|
|
|
+ :loading="loading"
|
|
|
+ :has-more="hasMore"
|
|
|
+ scroll-target=".shop-list-wrap"
|
|
|
+ @loadmore="fetchData"
|
|
|
+ >
|
|
|
+ <ul class="shop-list">
|
|
|
+ <li
|
|
|
+ v-for="(item, index) of list"
|
|
|
+ :key="index"
|
|
|
+ class="shop-item border-bottom"
|
|
|
+ @click="state.step++"
|
|
|
+ >
|
|
|
+ <div class="shop-name">
|
|
|
+ <span>{{ item.name }}</span>
|
|
|
+ <span>3.5KM</span>
|
|
|
+ </div>
|
|
|
+ <div class="shop-address">
|
|
|
+ {{ item.shop_detail }},{{ item.address }}
|
|
|
+ </div>
|
|
|
+ <div class="shop-mark" :class="{ danger: !item.can_appointment }">
|
|
|
+ <i class="icon"></i
|
|
|
+ >{{
|
|
|
+ item.can_appointment
|
|
|
+ ? item.can_appointment_day
|
|
|
+ : 'No appointments available for the next 7 days'
|
|
|
+ }}
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </InfiniteList>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { ref } from 'vue'
|
|
|
+import { ref, reactive } from 'vue'
|
|
|
import { state } from './store'
|
|
|
+import { getShopList } from '@/service/repair'
|
|
|
+import getLocation from '@/utils/getLocation'
|
|
|
+import InfiniteList from '@/components/infinite-list/index.vue'
|
|
|
|
|
|
const showSuggestions = ref(false)
|
|
|
+const loading = ref(false)
|
|
|
+const hasMore = ref(true)
|
|
|
+const list = ref<any[]>()
|
|
|
+let pageNo = 1
|
|
|
+let coords: any = null
|
|
|
+
|
|
|
+async function fetchData() {
|
|
|
+ loading.value = true
|
|
|
+ try {
|
|
|
+ if (!list.value) {
|
|
|
+ list.value = []
|
|
|
+ const res = await getLocation({ timeout: 2000 })
|
|
|
+ coords = res?.coords
|
|
|
+ }
|
|
|
+ const { results, pageBean } = await getShopList({})
|
|
|
+ list.value.push(...results)
|
|
|
+ pageNo++
|
|
|
+ hasMore.value = list.value.length === pageBean.totalCount
|
|
|
+ } catch {}
|
|
|
+ loading.value = false
|
|
|
+}
|
|
|
|
|
|
function autocomplete(e: any) {
|
|
|
showSuggestions.value = e.target.value.length > 0
|