index.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <template>
  2. <app-view class="home-purchase">
  3. <template #header>
  4. <app-navbar class="home-purchase__header" title="采购" :show-back-button="false">
  5. <template #footer>
  6. <Search shape="round" placeholder="商品搜索" disabled />
  7. </template>
  8. </app-navbar>
  9. </template>
  10. <app-pull-refresh class="home-purchase__container" v-model:error="error" v-model:pageIndex="pageIndex"
  11. :page-count="pageCount" :updateList="dataList" @refresh="onRefresh">
  12. <template #default="{ item }">
  13. <Cell @click="$router.push({ name: 'goods-details', query: { wrstandardid: item.wrstandardid } })">
  14. <template #title>
  15. <img :src="getImageUrl(item.thumurls)" />
  16. <span>{{ item.wrstandardname }}</span>
  17. </template>
  18. </Cell>
  19. </template>
  20. </app-pull-refresh>
  21. </app-view>
  22. </template>
  23. <script lang="ts" setup>
  24. import { shallowRef } from 'vue'
  25. import { Cell, Search } from 'vant'
  26. import { getImageUrl } from '@/filters'
  27. import { useWrstandardList } from '@/business/goods'
  28. import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
  29. const { dataList, pageIndex, pageCount, getWrstandardList } = useWrstandardList()
  30. const error = shallowRef(false)
  31. const onRefresh = (callback: () => void) => {
  32. getWrstandardList().catch(() => {
  33. error.value = true
  34. }).finally(() => callback())
  35. }
  36. </script>
  37. <style lang="less">
  38. @import './index.less';
  39. </style>