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

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