index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <script setup lang="ts">
  2. import router from '@/router'
  3. definePage({
  4. name: 'home',
  5. layout: 'tabbar',
  6. type: 'home',
  7. style: {
  8. navigationBarTitleText: '加油',
  9. navigationStyle: 'custom',
  10. },
  11. })
  12. const tabList = ref([
  13. { label: '距离优先', value: 0 },
  14. { label: '价格从低到高', value: 1 },
  15. ])
  16. const currentTab = ref(0)
  17. const { data, send, isLastPage, page } = usePagination((pageNum, pageSize) =>
  18. Apis.general.post_smqjh_pms_app_api_v1_product_oil_page(
  19. { data: { pageNum, pageSize, lat: useUserStore().lat, lon: useUserStore().lng, sort: currentTab.value } },
  20. ), {
  21. initialPage: 1,
  22. initialPageSize: 10,
  23. immediate: false,
  24. data: res => res.data?.list,
  25. append: true,
  26. })
  27. const staticUrl = import.meta.env.VITE_STATIC_BASE_URL
  28. function handleView(_item: any) {
  29. router.push({
  30. name: 'refuelDetaile',
  31. params: { id: _item.storeId },
  32. })
  33. }
  34. onMounted(async () => {
  35. await useUserStore().getLocationH5()
  36. send()
  37. })
  38. onReachBottom(() => {
  39. if (!isLastPage.value) {
  40. page.value++
  41. }
  42. })
  43. watch(() => currentTab.value, () => {
  44. send()
  45. })
  46. </script>
  47. <template>
  48. <view>
  49. <!-- <view class="w132rpx">
  50. 轮播图展位
  51. </view> -->
  52. <view class="box-border px24rpx py20px">
  53. <!-- <wd-sticky :offset-top="-44"> -->
  54. <view class="sticky top-0 z999 box-border w-full flex items-center bg-#f9f9f9 pb20rpx pt20rpx">
  55. <view v-for="item in tabList" :key="item.value" class="mr28rpx rounded-24rpx px16rpx py8rpx text-24rpx" :class="[currentTab === item.value ? 'bg-[var(--them-color)] text-white ' : 'bg-white']" @click="currentTab = item.value">
  56. {{ item.label }}
  57. </view>
  58. </view>
  59. <!-- </wd-sticky> -->
  60. <view v-for="item in data" :key="item.storeId" class="relative mb20rpx box-border rounded-16rpx bg-white p24rpx" @click="handleView(item)">
  61. <view class="mt80rpx flex items-center justify-between">
  62. <view class="text-36rpx font-semibold">
  63. {{ item.storeName }}
  64. </view>
  65. <view class="flex items-center text-24rpx">
  66. <image :src="`${staticUrl}/smqjh-jy-dh.png`" class="mr3 h18.34rpx w18.34rpx" /> {{ item.distanceShow }}km
  67. </view>
  68. </view>
  69. <view class="mt20rpx text-#aaa">
  70. {{ item.address }}
  71. </view>
  72. <view class="mt20rpx flex items-center justify-between">
  73. <view v-if="!item.allowanceClientScheme" class="flex items-center rounded-8rpx bg-#E6E6E6 px12rpx py8rpx">
  74. <view class="text-22rpx text-#AAAAAA">
  75. 不支持优惠券
  76. </view>
  77. </view>
  78. <view class="flex items-end">
  79. <view class="text-28rpx">
  80. {{ item.itemName }}
  81. </view>
  82. <view class="mx8rpx ml12rpx flex items-end text-#ff4d3a">
  83. 特惠价 <view class="font-semibold">
  84. <text class="text-20rpx">
  85. </text> <text class="text-36rpx">
  86. {{ item.vipPrice }}L
  87. </text>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. <!-- <image :src="`${staticUrl}/smqjh-jy-cz.png`" class="absolute left-0 top-0 h80rpx w234rpx" /> -->
  93. </view>
  94. </view>
  95. <image
  96. :src="`${staticUrl}/smqjh-jy-dkj.png`"
  97. class="fixed bottom-524rpx right-24rpx h114rpx w124rpx"
  98. @click="router.push({ name: 'activityList' })"
  99. />
  100. </view>
  101. </template>