index.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <view class="container">
  3. <u-navbar title="接单中心" :autoBack="true" :placeholder="true" v-hideNav></u-navbar>
  4. <scroll-view class="scroll_wrap" scroll-y @scrolltolower="scrolltolower">
  5. <order-card v-for="order in ordersList" :key="order.id" :order="order" @handleCardClick="handleCardClick"></order-card>
  6. <view class="hasMore">
  7. {{ ordersList.length >= page.total ? '没有更多了~' : '向下滑动加载更多~' }}
  8. </view>
  9. </scroll-view>
  10. </view>
  11. </template>
  12. <script>
  13. import orderCard from "./compounts/orderCard.vue";
  14. export default {
  15. components: {
  16. orderCard
  17. },
  18. data() {
  19. return {
  20. ordersList: [],
  21. page: {
  22. pageSize: 10,
  23. pageNum: 1,
  24. total: 0
  25. }
  26. };
  27. },
  28. methods: {
  29. async getOrderList() {
  30. const { rows,total } = await uni.$u.api.selectClueOrderFormList({
  31. pageSize: this.page.pageSize,
  32. pageNum: this.page.pageNum,
  33. }
  34. );
  35. console.log('接单列表', rows);
  36. this.ordersList.push(...rows);
  37. this.page.total=total;
  38. },
  39. scrolltolower() {
  40. if(this.ordersList.length>=this.page.total){
  41. return uni.$u.toast('没有更多了');
  42. }
  43. this.page.pageNum++;
  44. this.getOrderList();
  45. },
  46. reset() {
  47. this.ordersList = [];
  48. this.page.pageNum = 1;
  49. },
  50. handleCardClick(order) {
  51. console.log('点击了订单', order);
  52. //跳转
  53. // uni.navigateTo({
  54. // url: `/pages/orderDetail/index?orderId=${order.id}&item=${order.item}&type=${this.type}&clueId=${order.clueId}`,
  55. // })
  56. //跳转新的页面
  57. uni.navigateTo({
  58. url: `/pages/orderDetailNew/index?orderId=${order.id}&item=${order.item}&type=${this.type}&clueId=${order.clueId}`,
  59. })
  60. },
  61. },
  62. onLoad() {
  63. this.getOrderList();
  64. }
  65. }
  66. </script>
  67. <style scoped>
  68. .scroll_wrap {
  69. height: calc( 100vh - 44px );
  70. }
  71. .hasMore {
  72. text-align: center;
  73. padding: 20rpx 0;
  74. font-size: 24rpx;
  75. color: #999;
  76. }
  77. </style>