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.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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, watch } 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. console.log("props.index", props)
  44. const { config, params, ordersList, onKeyInput, refreshList, searchKeyWords } = useOrderListItem(props);
  45. //自定义下拉刷新被触发
  46. const onRefresh = () => {
  47. console.log("22222")
  48. refreshList(true)
  49. if (state._freshing) return;
  50. state._freshing = true;
  51. setTimeout(() => {
  52. state.triggered = false;
  53. state._freshing = false;
  54. }, 1000)
  55. }
  56. const onPulling = (e) => {
  57. console.log("11111")
  58. if (e.detail.deltaY < 0) {
  59. return
  60. }
  61. state.triggered = true
  62. }
  63. </script>
  64. <style lang="scss" scoped>
  65. .setHight {
  66. min-height: calc(100vh - 200rpx);
  67. }
  68. .search-layout {
  69. padding-top: 90rpx;
  70. .search-box {
  71. margin: 30rpx 30rpx 0rpx 30rpx;
  72. height: 80rpx;
  73. background: #FFFFFF;
  74. // border: 1px solid #DCDCDC;
  75. border-radius: 40rpx;
  76. display: flex;
  77. justify-content: center;
  78. align-items: center;
  79. box-sizing: border-box;
  80. flex: 1;
  81. }
  82. .search-box .icon {
  83. width: 48rpx;
  84. height: 48rpx;
  85. margin: 0 20rpx;
  86. }
  87. .search-box .search {
  88. flex: 1;
  89. margin-right: 20rpx;
  90. height: 100%;
  91. padding: 0 10rpx;
  92. font-size: 28rpx;
  93. color: #00b38b;
  94. }
  95. .search-btn {
  96. color: white;
  97. background-color: #00B38B;
  98. width: 140rpx;
  99. height: 75rpx;
  100. line-height: 75rpx;
  101. font-size: 32rpx;
  102. border-radius: 40rpx;
  103. text-align: center;
  104. margin-right: 30rpx;
  105. margin-top: 30rpx;
  106. }
  107. }
  108. </style>