myOrder.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <div>
  3. <BackBar title="我的订单-个贷" lefttext="返回" />
  4. <van-search v-model="listQuery.keyword" placeholder="请输入搜索关键词" @search="onSearch()" />
  5. <van-pull-refresh v-model="loading" @refresh="onRefresh()">
  6. <van-list v-model:loading="loading" :finished="finished" finished-text="还没有订单" @load="getMyOrder()">
  7. <div class="card" v-for="item in listData" :key="item.id" @click="toDetail(item)">
  8. <h3>
  9. <van-icon name="link-o" />
  10. &nbsp;{{ item.orderId }}
  11. </h3>
  12. <p class="projectName">
  13. <van-icon name="location-o" />
  14. &nbsp;{{ item.orderName }}
  15. </p>
  16. <p>
  17. <van-icon name="contact-o" />
  18. &nbsp;{{ item.clientName }}-{{ item.clientSubName}}
  19. </p>
  20. <p>
  21. <van-tag type="primary" size="medium" class="van-tag">{{ item.acreage ? item.acreage : '-' }} 平</van-tag>
  22. <van-tag type="success" size="medium" class="van-tag">{{ item.price ? item.price : '-' }} 元/平</van-tag>
  23. <van-tag color="#969799" size="medium" class="van-tag">{{ item.amount ? item.amount / 10000 : '-' }} 万元</van-tag>
  24. </p>
  25. </div>
  26. </van-list>
  27. </van-pull-refresh>
  28. <van-back-top right="10vw" bottom="10vh" />
  29. </div>
  30. </template>
  31. <script>
  32. import { myOrder } from '@/api/personal';
  33. export default {
  34. data() {
  35. return {
  36. loading: false,
  37. listData: [],
  38. finished: false,
  39. listQuery: {
  40. // 当前页数
  41. current: 1,
  42. // 查询关键字
  43. keyword: null,
  44. },
  45. };
  46. },
  47. created() {
  48. this.getMyOrder();
  49. },
  50. methods: {
  51. // 列表刷新
  52. onRefresh() {
  53. this.listQuery.current = 1;
  54. this.finished = false;
  55. this.listData = [];
  56. this.getMyOrder();
  57. },
  58. // 列表关键字搜索
  59. onSearch() {
  60. this.listQuery.current = 1;
  61. this.finished = false;
  62. this.listData = [];
  63. this.getMyOrder();
  64. },
  65. // 获取我的订单
  66. getMyOrder() {
  67. this.loading = true;
  68. myOrder(this.listQuery).then((res) => {
  69. if (res.code == 200) {
  70. if (res.data.records) {
  71. this.listData = this.listData.concat(res.data.records);
  72. }
  73. // 判断是否还有下一页
  74. if (res.data.pages > this.listQuery.current) {
  75. // 服务端返回的总页数大于当前页数, 将当前页数+1
  76. this.listQuery.current++;
  77. } else {
  78. // 反之停止加载
  79. this.finished = true;
  80. }
  81. }
  82. this.loading = false;
  83. });
  84. },
  85. toDetail(item) {
  86. const detailInfo = {
  87. orderId: item.orderId,
  88. location: item.location,
  89. acreage: item.acreage,
  90. price: item.price,
  91. amount: item.amount / 10000,
  92. clientName: item.clientName,
  93. clientSubName: item.clientSubName,
  94. agent: item.agent,
  95. contactName: item.contactName,
  96. contactTel: item.contactTel,
  97. bailorA: item.bailorA,
  98. bailorB: item.bailorB,
  99. realAmount: item.realAmount,
  100. shouldAmount: item.shouldAmount,
  101. invoiceAmount: item.invoiceAmount,
  102. created: item.created
  103. };
  104. this.$router.push({
  105. path: `/index/personal/detail`,
  106. query: {
  107. item: JSON.stringify(detailInfo),
  108. },
  109. });
  110. },
  111. },
  112. };
  113. </script>
  114. <style scoped>
  115. .card {
  116. background-color: white;
  117. border-radius: 5px;
  118. padding: 16px;
  119. margin: 10px;
  120. }
  121. .productionNo {
  122. width: 100%;
  123. font-size: 14px;
  124. }
  125. .projectName {
  126. width: 100%;
  127. }
  128. .van-tag {
  129. margin: 2px;
  130. }
  131. </style>