myOrder.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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="productionNo" v-if="item.statementNo || item.reportNo">
  13. <van-icon name="coupon-o" />
  14. &nbsp;
  15. {{ item.statementNo }}
  16. <!-- 产品号都不为空才显示中间的分割空格, 以保持页面间距统一 -->
  17. <span v-if="item.statementNo && item.reportNo">&nbsp;&nbsp;</span>
  18. {{ item.reportNo }}
  19. </p>
  20. <p class="projectName">
  21. <van-icon name="location-o" />
  22. &nbsp;{{ item.reportName || item.statementName || item.name }}
  23. </p>
  24. <p>
  25. <van-tag type="primary" size="medium" class="van-tag">{{ item.currentNodeName }}</van-tag>
  26. <van-tag type="success" size="medium" class="van-tag">{{ item.clientManagerName }}</van-tag>
  27. <van-tag color="#969799" size="medium" class="van-tag">{{ item.created }}</van-tag>
  28. </p>
  29. </div>
  30. </van-list>
  31. </van-pull-refresh>
  32. <van-back-top right="10vw" bottom="10vh" />
  33. </div>
  34. </template>
  35. <script>
  36. import { mapStores } from 'pinia';
  37. import { useUserStore } from '@/stores/useUserStore';
  38. import { myOrder } from '@/api/assets';
  39. export default {
  40. data() {
  41. return {
  42. loading: false,
  43. listData: [],
  44. finished: false,
  45. listQuery: {
  46. // 当前页数
  47. current: 1,
  48. // 查询关键字
  49. keyWord: null,
  50. clientManagerId: null,
  51. },
  52. };
  53. },
  54. computed: {
  55. ...mapStores(useUserStore),
  56. },
  57. created() {
  58. this.listQuery.clientManagerId = this.userStore.userInfo.id;
  59. this.getMyOrder();
  60. },
  61. methods: {
  62. // 列表刷新
  63. onRefresh() {
  64. this.listQuery.current = 1;
  65. this.finished = false;
  66. this.listData = [];
  67. this.getMyOrder();
  68. },
  69. // 列表关键字搜索
  70. onSearch() {
  71. this.listQuery.current = 1;
  72. this.finished = false;
  73. this.listData = [];
  74. this.getMyOrder();
  75. },
  76. // 获取我的订单
  77. getMyOrder() {
  78. this.loading = true;
  79. myOrder(this.listQuery).then((res) => {
  80. if (res.code == 200) {
  81. if (res.data.records) {
  82. this.listData = this.listData.concat(res.data.records);
  83. }
  84. // 判断是否还有下一页
  85. if (res.data.pages > this.listQuery.current) {
  86. // 服务端返回的总页数大于当前页数, 将当前页数+1
  87. this.listQuery.current++;
  88. } else {
  89. // 反之停止加载
  90. this.finished = true;
  91. }
  92. }
  93. this.loading = false;
  94. });
  95. },
  96. toDetail(item) {
  97. const detailInfo = {
  98. orderId: item.orderId,
  99. name: item.name,
  100. statementNo: item.statementNo,
  101. reportNo: item.reportNo,
  102. assetsBusinessGener: item.assetsBusinessGener,
  103. customerName: item.customerName,
  104. customerSubName: item.customerSubName,
  105. bailor: item.bailor,
  106. bailorContactTel: item.bailorContactTel,
  107. currentNodeName: item.currentNodeName,
  108. handlerName: item.handlerName,
  109. principalName: item.principalName,
  110. clientManagerName: item.clientManagerName,
  111. estimatedValue: item.estimatedValue,
  112. productionShouldAmount: item.productionShouldAmount,
  113. productionRealAmount: item.productionRealAmount,
  114. invoiceRealAmount: item.invoiceRealAmount,
  115. reportDelivery: item.reportDelivery ? '已送达' : '未送达',
  116. };
  117. this.$router.push({
  118. path: `/index/assets/detail`,
  119. query: {
  120. item: JSON.stringify(detailInfo),
  121. },
  122. });
  123. },
  124. },
  125. };
  126. </script>
  127. <style scoped>
  128. .card {
  129. background-color: white;
  130. border-radius: 5px;
  131. padding: 16px;
  132. margin: 10px;
  133. }
  134. .productionNo {
  135. width: 100%;
  136. font-size: 14px;
  137. }
  138. .projectName {
  139. width: 100%;
  140. }
  141. .van-tag {
  142. margin: 2px;
  143. }
  144. </style>