index.vue 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <script setup lang="ts">
  2. import router from '@/router'
  3. const { statusBarHeight, MenuButtonHeight } = storeToRefs(useSysStore())
  4. const { data: goodsList, isLastPage, page, reload, error } = usePagination((pageNum, pageSize) =>
  5. Apis.djk.appletGoodsList({ data: { pageNum, pageSize } }), {
  6. data: resp => resp.data?.list,
  7. initialData: [],
  8. initialPage: 1,
  9. initialPageSize: 10,
  10. append: true,
  11. })
  12. const state = computed(() => {
  13. return error.value ? 'error' : !isLastPage.value ? 'loading' : 'finished'
  14. })
  15. function handleBottom() {
  16. if (!isLastPage.value) {
  17. page.value++
  18. }
  19. }
  20. </script>
  21. <template>
  22. <view>
  23. <wd-navbar
  24. title="大健康"
  25. :bordered="false" :z-index="99"
  26. safe-area-inset-top placeholder left-arrow fixed @click-left="router.back()"
  27. />
  28. <scroll-view scroll-y :style="{ height: `calc(100vh - ${(statusBarHeight + MenuButtonHeight) * 4}rpx)` }" @scrolltolower="handleBottom">
  29. <view class="px24rpx">
  30. <view v-for="item in goodsList" :key="item.shopId" class="mt20rpx rounded-16rpx bg-white p24rpx">
  31. <view class="flex" @click="router.push({ name: 'djk-shopinfo', params: { id: `${item.shopId}` } })">
  32. <image
  33. :src="item.shopLogo?.split(',')[0]"
  34. class="h144rpx w144rpx flex-shrink-0 rounded-16rpx"
  35. />
  36. <view class="ml20rpx flex-1">
  37. <view class="text-32rpx font-semibold">
  38. {{ item.shopName }}
  39. </view>
  40. <view class="mt16rpx text-24rpx text-gray">
  41. 总销量 {{ item.sales }}
  42. </view>
  43. <view class="mt16rpx text-24rpx text-gray">
  44. {{ item.shopAddress }}
  45. </view>
  46. </view>
  47. </view>
  48. <view class="ml164rpx">
  49. <view v-for="its in item.goodsList" :key="its.id" class="mt14rpx flex items-center justify-between" @click="router.push({ name: 'djk-goods', params: { id: `${its.id}`, type: '0' } })">
  50. <view class="text-28rpx text-#FF4D3A font-semibold">
  51. <text class="text-20rpx">
  52. </text> {{ its.price }}
  53. </view>
  54. <view class="text-24rpx">
  55. {{ its.goodsName }}
  56. </view>
  57. <view class="text-24rpx text-gray">
  58. 已售 {{ its.sales }}
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="h40rpx" />
  64. </view>
  65. <template v-if="goodsList.length > 10">
  66. <wd-loadmore :state="state" :loading-props="{ color: '#9ED605', size: 20 }" @reload="reload" />
  67. </template>
  68. <StatusTip v-if="!goodsList.length" tip="暂无内容" />
  69. </scroll-view>
  70. </view>
  71. </template>
  72. <style scoped>
  73. </style>