my-list.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <view class="common-page" style="padding: 0;">
  3. <PageScroll
  4. requestStr="/app/workOrder/getMyWorkOrder"
  5. @updateList="updateList"
  6. ref="scrollRef"
  7. :otherParams="otherParams"
  8. method="get"
  9. >
  10. <view class="list-con" v-if="dataList.length">
  11. <WorkorderItem
  12. v-for="(cell, idx) in dataList"
  13. :key="idx"
  14. :item="cell"
  15. :showDuration="false"
  16. @click="goDetail(cell)"
  17. class="mt-20"
  18. />
  19. </view>
  20. </PageScroll>
  21. </view>
  22. </template>
  23. <script setup>
  24. import { ref } from 'vue'
  25. import { onShow } from '@dcloudio/uni-app'
  26. import PageScroll from '@/components/pageScroll/index.vue'
  27. import WorkorderItem from '../components/workorder-item.vue'
  28. const dataList = ref([])
  29. const scrollRef = ref(null)
  30. const otherParams = ref({
  31. type: 1
  32. })
  33. const updateList = (data) => {
  34. const rows = data?.rows || data
  35. dataList.value = Array.isArray(rows) && rows.length ? rows : []
  36. }
  37. const refreshList = () => {
  38. scrollRef.value?.resetUpScroll()
  39. }
  40. const goDetail = (cell) => {
  41. const id = cell?.id || ''
  42. uni.navigateTo({
  43. url: `/pages/order/mall/detail?id=${id}`
  44. })
  45. }
  46. onShow(() => {
  47. refreshList()
  48. })
  49. </script>
  50. <style lang="scss" scoped>
  51. .list-con {
  52. padding: 10rpx 30rpx;
  53. gap: 30rpx;
  54. }
  55. .mt-20 { margin-top: 20rpx; }
  56. </style>