index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <van-nav-bar :title="$t('priceSheet.name')" left-text="" left-arrow @click-left="onClickLeft" @click-right="onClickRight">
  3. <template #right>{{ $t("common.add") }}</template>
  4. </van-nav-bar>
  5. <van-search v-model="req.keyword" :placeholder="$t('common.pleaseEnterKeywords')" @search="onRefresh" />
  6. <van-pull-refresh v-model="loading" @refresh="onRefresh">
  7. <div class="list">
  8. <van-list v-model:loading="loading" :finished="finished" :finished-text="$t('common.noMore')" @load="getList('load')" style="margin-bottom: 60px">
  9. <commonList :data="listData" @onClick="toDtl" :config="listConfig"></commonList>
  10. </van-list>
  11. </div>
  12. </van-pull-refresh>
  13. </template>
  14. <script setup>
  15. import { ref, getCurrentInstance } from "vue";
  16. import commonList from "@/components/common-list.vue";
  17. const proxy = getCurrentInstance().proxy;
  18. const onClickLeft = () => proxy.$router.push("/main/working");
  19. const onClickRight = () => {
  20. proxy.$router.push({
  21. path: "/main/processDtl",
  22. query: {
  23. flowKey: "sale_quotation_flow",
  24. },
  25. });
  26. };
  27. const req = ref({
  28. pageNum: 1,
  29. keyword: null,
  30. });
  31. const finished = ref(false);
  32. const onRefresh = () => {
  33. req.value.pageNum = 1;
  34. finished.value = false;
  35. getList("refresh");
  36. };
  37. const loading = ref(false);
  38. const listData = ref([]);
  39. const status = ref([
  40. {
  41. label: "草稿",
  42. value: 0,
  43. },
  44. {
  45. label: "审批中",
  46. value: 10,
  47. },
  48. {
  49. label: "驳回",
  50. value: 20,
  51. },
  52. {
  53. label: "审批通过",
  54. value: 30,
  55. },
  56. {
  57. label: "作废",
  58. value: 70,
  59. },
  60. {
  61. label: "终止",
  62. value: 99,
  63. },
  64. ]);
  65. const getList = (type) => {
  66. loading.value = true;
  67. proxy
  68. .post("/saleQuotation/page", req.value)
  69. .then((res) => {
  70. if (res.data.rows && res.data.rows.length > 0) {
  71. res.data.rows = res.data.rows.map((item) => {
  72. let statusText = "";
  73. if (item.status) {
  74. let list = status.value.filter((itemStatus) => itemStatus.value == item.status);
  75. if (list && list.length > 0) {
  76. statusText = list[0].label;
  77. }
  78. }
  79. return {
  80. ...item,
  81. currencyAmount: item.currency + " " + item.amount,
  82. statusText: statusText,
  83. };
  84. });
  85. }
  86. console.log(type);
  87. listData.value = type === "refresh" ? res.data.rows : listData.value.concat(res.data.rows);
  88. if (req.value.pageNum * 10 >= res.data.total) {
  89. finished.value = true;
  90. }
  91. req.value.pageNum++;
  92. loading.value = false;
  93. })
  94. .catch(() => {
  95. loading.value = false;
  96. });
  97. };
  98. const toDtl = (row) => {
  99. // proxy.$router.push({
  100. // path: "/main/processDtl",
  101. // query: {
  102. // flowKey: "sale_quotation_flow",
  103. // id: row.flowInfoId,
  104. // processType: 20,
  105. // },
  106. // });
  107. };
  108. const listConfig = ref([
  109. {
  110. label: proxy.t("priceSheet.sellCorporation"),
  111. prop: "sellCorporationName",
  112. },
  113. {
  114. label: proxy.t("priceSheet.code"),
  115. prop: "code",
  116. },
  117. {
  118. label: proxy.t("priceSheet.buyCorporation"),
  119. prop: "buyCorporationName",
  120. },
  121. {
  122. label: proxy.t("priceSheet.amount"),
  123. prop: "currencyAmount",
  124. },
  125. {
  126. label: proxy.t("priceSheet.status"),
  127. prop: "statusText",
  128. },
  129. ]);
  130. </script>
  131. <style lang="scss" scoped>
  132. .list {
  133. min-height: 70vh;
  134. }
  135. </style>