route-exception.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="container">
  3. <!-- 列表区域 -->
  4. <page-scroll ref="pageScrollRef" height="100vh" :requestStr="requestStr" @updateList="updateList"
  5. :otherParams="otherParams">
  6. <u-sticky :offset-top="0">
  7. <!-- 顶部标签页 -->
  8. <u-subsection fontSize="16" :list="tabList" :current="curNow" @change="sectionChange" mode="subsection"
  9. class="tabs-list"></u-subsection>
  10. </u-sticky>
  11. <view class="list-container">
  12. <exception-item v-for="item in exceptionList" :key="item.orderNo" :order="item" @refresh="handleSearch" />
  13. </view>
  14. </page-scroll>
  15. <!-- 底部搜索框 -->
  16. <view class="search-bar fixed-bottom">
  17. <u-search v-model="otherParams.search" placeholder="请输入物流单号/订单编号" :show-action="false"
  18. :inputStyle="{ fontSize: '32rpx' }" @search="handleSearch" height="80rpx" shape="round">
  19. </u-search>
  20. <u-icon name="scan" size="28" color="#19be6b" @click="handleScan" />
  21. </view>
  22. </view>
  23. </template>
  24. <script setup>
  25. import {
  26. ref,
  27. } from 'vue';
  28. import { onLoad, onShow, onUnload } from '@dcloudio/uni-app';
  29. import ExceptionItem from './components/ExceptionItem.vue';
  30. import PageScroll from '@/components/pageScroll/index.vue';
  31. // 标签页配置
  32. const tabList = ['待处理订单', '历史异常签收'];
  33. const curNow = ref(0);
  34. // 列表数据
  35. const exceptionList = ref([]);
  36. let urlList = ['/app/orderexception/pagelist', '/app/orderexception/getPageLoglist'];
  37. //历史 /app/orderexception/getPageLoglist
  38. const requestStr = ref(urlList[0]);
  39. // 定义方法,注意在 setup 中不需要 this,直接访问响应式引用
  40. function sectionChange(index) {
  41. curNow.value = index;
  42. requestStr.value = urlList[index];
  43. handleSearch();
  44. }
  45. // 搜索相关
  46. const pageScrollRef = ref(null);
  47. const otherParams = ref({ search: '' });
  48. const updateList = (list) => {
  49. exceptionList.value = list;
  50. }
  51. // 搜索处理
  52. const handleSearch = () => {
  53. pageScrollRef.value?.resetUpScroll();
  54. };
  55. // 扫码处理
  56. const handleScan = () => {
  57. uni.scanCode({
  58. success: (res) => {
  59. otherParams.value.search = res.result;
  60. handleSearch();
  61. }
  62. });
  63. };
  64. onLoad(() => {
  65. // #ifdef APP-PLUS
  66. uni.$u.useGlobalEvent((e) => {
  67. otherParams.value.search = e.barcode
  68. handleSearch()
  69. })
  70. // #endif
  71. })
  72. onShow(() => {
  73. uni.$u.updateActivePageOnShow()
  74. })
  75. onUnload(() => {
  76. uni.$u.cleanupOnPageUnload();
  77. });
  78. </script>
  79. <style lang="scss" scoped>
  80. .container {
  81. display: flex;
  82. flex-direction: column;
  83. height: 100vh;
  84. box-sizing: border-box;
  85. padding-bottom: 140rpx;
  86. :deep(.tabs-list) {
  87. padding: 0 20rpx;
  88. height: 80rpx;
  89. margin-top: 20rpx;
  90. .u-subsection__item {
  91. height: 80rpx
  92. }
  93. }
  94. /* #ifdef H5 */
  95. :deep(.u-sticky){
  96. top: 0 !important;
  97. }
  98. /* #endif */
  99. }
  100. .list-container {
  101. flex: 1;
  102. padding: 24rpx;
  103. box-sizing: border-box;
  104. }
  105. .search-bar {
  106. padding: 12px;
  107. box-sizing: border-box;
  108. background-color: #fff;
  109. border-top: 2rpx solid #eee;
  110. :deep(.u-search) {
  111. background-color: #f5f5f5;
  112. font-size: 32rpx;
  113. }
  114. }
  115. </style>