pending.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="common-page" style="padding: 0;">
  3. <view class="filter-bar">
  4. <view class="picker-trigger" @tap="pickerShow = true">
  5. <text class="picker-label">{{ selectedTaskType?.text || '任务类型' }}</text>
  6. <u-icon name="arrow-down" size="16" color="#666"></u-icon>
  7. </view>
  8. <u-button class="ml-10" type="primary" size="small" @click="onQuery">查询</u-button>
  9. <u-button class="ml-10" size="small" @click="onReset">重置</u-button>
  10. </view>
  11. <u-picker
  12. :show="pickerShow"
  13. :columns="[taskTypeOptions]"
  14. title="选择任务类型"
  15. @confirm="onPickConfirm"
  16. @cancel="pickerShow = false"
  17. @close="pickerShow = false"
  18. ></u-picker>
  19. <PageScroll
  20. requestStr="/app/workorder/pending"
  21. @updateList="updateList"
  22. ref="scrollRef"
  23. :otherParams="otherParams"
  24. method="get"
  25. :diffHeight="150"
  26. >
  27. <view class="list-con" v-if="dataList.length">
  28. <WorkorderItem
  29. v-for="(cell, idx) in dataList"
  30. :key="idx"
  31. :item="cell"
  32. :showDuration="true"
  33. @click="goDetail(cell)"
  34. class="mt-20"
  35. />
  36. </view>
  37. </PageScroll>
  38. </view>
  39. </template>
  40. <script setup>
  41. import { ref } from 'vue'
  42. import { onShow } from '@dcloudio/uni-app'
  43. import PageScroll from '@/components/pageScroll/index.vue'
  44. import WorkorderItem from '../components/workorder-item.vue'
  45. const dataList = ref([])
  46. const scrollRef = ref(null)
  47. const pickerShow = ref(false)
  48. const selectedTaskType = ref(null)
  49. const taskTypeOptions = [
  50. { text: '全部', value: '' },
  51. { text: '书单不符', value: 'MISMATCH' },
  52. { text: '破损', value: 'BROKEN' },
  53. { text: '缺件', value: 'LACK' },
  54. { text: '其他', value: 'OTHER' },
  55. ]
  56. const otherParams = ref({
  57. type: 'recycle',
  58. status: 'pending',
  59. taskType: ''
  60. })
  61. const updateList = (data, page) => {
  62. const mock = [
  63. { waybillCode: 'YT54454654564', taskTypeName: '书单不符', createTime: '2026-05-11 15:00:00', waitingTime: 15 * 3600 + 5 * 60 + 26 },
  64. { waybillCode: 'YT54454654564', taskTypeName: '书单不符', createTime: '2026-05-11 15:00:00', waitingTime: 15 * 3600 + 5 * 60 + 26 },
  65. { waybillCode: 'YT54454654564', taskTypeName: '书单不符', createTime: '2026-05-11 15:00:00', waitingTime: 15 * 3600 + 5 * 60 + 26 },
  66. { waybillCode: 'YT54454654564', taskTypeName: '书单不符', createTime: '2026-05-11 15:00:00', waitingTime: 15 * 3600 + 5 * 60 + 26 },
  67. { waybillCode: 'YT54454654564', taskTypeName: '书单不符', createTime: '2026-05-11 15:00:00', waitingTime: 15 * 3600 + 5 * 60 + 26 },
  68. ]
  69. dataList.value = Array.isArray(data) && data.length ? data : mock
  70. }
  71. const refreshList = () => {
  72. scrollRef.value?.resetUpScroll()
  73. }
  74. const onPickConfirm = (e) => {
  75. const val = e?.value?.[0]
  76. selectedTaskType.value = val
  77. otherParams.value.taskType = val?.value || ''
  78. pickerShow.value = false
  79. }
  80. const onQuery = () => {
  81. refreshList()
  82. }
  83. const onReset = () => {
  84. selectedTaskType.value = null
  85. otherParams.value.taskType = ''
  86. refreshList()
  87. }
  88. const goDetail = (cell) => {
  89. const code = cell?.waybillCode || ''
  90. uni.navigateTo({
  91. url: `/pages/order/recycle/detail?waybillCode=${code}`
  92. })
  93. }
  94. onShow(() => {
  95. refreshList()
  96. })
  97. </script>
  98. <style lang="scss" scoped>
  99. .filter-bar {
  100. display: flex;
  101. align-items: center;
  102. padding: 20rpx;
  103. background-color: #ffffff;
  104. gap: 16rpx;
  105. }
  106. .picker-trigger {
  107. flex: 1;
  108. display: flex;
  109. align-items: center;
  110. justify-content: space-between;
  111. padding: 10rpx 20rpx;
  112. border: 1rpx solid #e6e8eb;
  113. border-radius: 8rpx;
  114. min-width: 200px;
  115. }
  116. .picker-label {
  117. font-size: 28rpx;
  118. color: #333;
  119. }
  120. .list-con {
  121. padding: 10rpx 30rpx;
  122. gap: 30rpx;
  123. }
  124. .ml-10 {
  125. margin-left: 10rpx;
  126. }
  127. </style>