route-exception.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. onUnmounted
  28. } from 'vue';
  29. import { onLoad, onShow } from '@dcloudio/uni-app';
  30. import ExceptionItem from './components/ExceptionItem.vue';
  31. import PageScroll from '@/components/pageScroll/index.vue';
  32. // 标签页配置
  33. const tabList = ['待处理订单', '历史异常签收'];
  34. const curNow = ref(0);
  35. // 列表数据
  36. const exceptionList = ref([]);
  37. let urlList = ['/app/orderexception/pagelist', '/app/orderexception/getPageLoglist'];
  38. //历史 /app/orderexception/getPageLoglist
  39. const requestStr = ref(urlList[0]);
  40. // 定义方法,注意在 setup 中不需要 this,直接访问响应式引用
  41. function sectionChange(index) {
  42. curNow.value = index;
  43. requestStr.value = urlList[index];
  44. handleSearch();
  45. }
  46. // 搜索相关
  47. const pageScrollRef = ref(null);
  48. const otherParams = ref({ search: '' });
  49. const updateList = (list) => {
  50. exceptionList.value = list;
  51. }
  52. // 搜索处理
  53. const handleSearch = () => {
  54. pageScrollRef.value?.resetUpScroll();
  55. };
  56. // 扫码处理
  57. const handleScan = () => {
  58. uni.scanCode({
  59. success: (res) => {
  60. otherParams.value.search = res.result;
  61. handleSearch();
  62. }
  63. });
  64. };
  65. // #ifdef APP-PLUS
  66. const { unregister } = uni.$u.useEventListener((e) => {
  67. otherParams.value.search = e.barcode
  68. handleSearch()
  69. });
  70. // #endif
  71. onUnmounted(() => {
  72. // #ifdef APP-PLUS
  73. unregister();
  74. // #endif
  75. });
  76. </script>
  77. <style lang="scss" scoped>
  78. .container {
  79. display: flex;
  80. flex-direction: column;
  81. height: 100vh;
  82. box-sizing: border-box;
  83. padding-bottom: 140rpx;
  84. :deep(.tabs-list) {
  85. padding: 0 20rpx;
  86. height: 80rpx;
  87. margin-top: 20rpx;
  88. .u-subsection__item {
  89. height: 80rpx
  90. }
  91. }
  92. /* #ifdef H5 */
  93. :deep(.u-sticky){
  94. top: 0 !important;
  95. }
  96. /* #endif */
  97. }
  98. .list-container {
  99. flex: 1;
  100. padding: 24rpx;
  101. box-sizing: border-box;
  102. }
  103. .search-bar {
  104. padding: 12px;
  105. box-sizing: border-box;
  106. background-color: #fff;
  107. border-top: 2rpx solid #eee;
  108. :deep(.u-search) {
  109. background-color: #f5f5f5;
  110. font-size: 32rpx;
  111. }
  112. }
  113. </style>