You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

order-list-item.vue 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <!-- 订单列表 -->
  2. <template>
  3. <!-- 搜索框 -->
  4. <view class="as-layout-horizontal as-gravity-center-start search-layout">
  5. <view class="search-box">
  6. <image :src="`${$imgUrl}service/icon-search.png`" class="icon" mode="aspectFill"></image>
  7. <input class="search" placeholder="请输入车牌号" @blur="onKeyInput" v-model="searchKeyWords" />
  8. </view>
  9. </view>
  10. <!-- 数据为空 -->
  11. <empty-view :mode="config.emptyHint.mode" :content="config.emptyHint.hint" v-if="ordersList.length === 0" />
  12. <template v-else>
  13. <!-- 列表 -->
  14. <block v-for="(item,index) in ordersList" :key="index">
  15. <!-- 新办订单 -->
  16. <order-list-item-new :item="item" />
  17. </block>
  18. <uni-load-more :status="params.status" iconType="snow" :icon-size="16" :content-text="config.contentTxt"
  19. v-if="ordersList.length > 0" />
  20. </template>
  21. </template>
  22. <script setup lang="ts">
  23. import orderListItemNew from "./order-list-item-new.vue";
  24. import useOrderListItem from "@/composables/order/useOrderListItem";
  25. import { reactive} from "vue";
  26. const state = reactive({
  27. triggered: false, //设置当前下拉刷新的状态
  28. freshing: true,
  29. _freshing: false
  30. })
  31. const props = defineProps({
  32. index: {
  33. type: Number,
  34. default() {
  35. return 0
  36. }
  37. },
  38. refresh: { //是否刷新列表
  39. type: Boolean,
  40. default: true
  41. }
  42. })
  43. const { config, params, ordersList, onKeyInput, refreshList, searchKeyWords } = useOrderListItem(props);
  44. //自定义下拉刷新被触发
  45. const onRefresh = () => {
  46. console.log("22222")
  47. refreshList(true)
  48. if (state._freshing) return;
  49. state._freshing = true;
  50. setTimeout(() => {
  51. state.triggered = false;
  52. state._freshing = false;
  53. }, 1000)
  54. }
  55. const onPulling = (e) => {
  56. console.log("11111")
  57. if (e.detail.deltaY < 0) {
  58. return
  59. }
  60. state.triggered = true
  61. }
  62. </script>
  63. <style lang="scss" scoped>
  64. .setHight {
  65. min-height: calc(100vh - 200rpx);
  66. }
  67. .search-layout {
  68. padding-top: 90rpx;
  69. .search-box {
  70. margin: 30rpx 30rpx 0rpx 30rpx;
  71. height: 80rpx;
  72. background: #FFFFFF;
  73. // border: 1px solid #DCDCDC;
  74. border-radius: 40rpx;
  75. display: flex;
  76. justify-content: center;
  77. align-items: center;
  78. box-sizing: border-box;
  79. flex: 1;
  80. }
  81. .search-box .icon {
  82. width: 48rpx;
  83. height: 48rpx;
  84. margin: 0 20rpx;
  85. }
  86. .search-box .search {
  87. flex: 1;
  88. margin-right: 20rpx;
  89. height: 100%;
  90. padding: 0 10rpx;
  91. font-size: 28rpx;
  92. color: #00b38b;
  93. }
  94. .search-btn {
  95. color: white;
  96. background-color: #00B38B;
  97. width: 140rpx;
  98. height: 75rpx;
  99. line-height: 75rpx;
  100. font-size: 32rpx;
  101. border-radius: 40rpx;
  102. text-align: center;
  103. margin-right: 30rpx;
  104. margin-top: 30rpx;
  105. }
  106. }
  107. </style>