index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <van-nav-bar
  3. title="销售合同"
  4. left-text=""
  5. left-arrow
  6. @click-left="onClickLeft"
  7. @click-right="onClickRight"
  8. >
  9. <template #right> 添加 </template>
  10. </van-nav-bar>
  11. <van-search
  12. v-model="req.keyword"
  13. placeholder="请输入搜索关键词"
  14. @search="onRefresh"
  15. />
  16. <van-pull-refresh v-model="loading" @refresh="onRefresh">
  17. <div class="list">
  18. <van-list
  19. v-model:loading="loading"
  20. :finished="finished"
  21. finished-text="没有更多了"
  22. :offset="300"
  23. @load="onLoad"
  24. style="margin-bottom: 60px"
  25. >
  26. <commonList
  27. :data="listData"
  28. @onClick="toDtl"
  29. :config="listConfig"
  30. ></commonList>
  31. </van-list>
  32. </div>
  33. </van-pull-refresh>
  34. </template>
  35. <script setup>
  36. import { ref, getCurrentInstance } from "vue";
  37. import commonList from "@/components/common-list.vue";
  38. import { useRoute } from "vue-router";
  39. const loading = ref(false);
  40. const router = useRoute();
  41. const req = ref({
  42. pageNum: 1,
  43. keyword: null,
  44. definition: "1",
  45. });
  46. const finished = ref(false);
  47. const proxy = getCurrentInstance().proxy;
  48. const listData = ref([]);
  49. const listConfig = ref([
  50. {
  51. label: "客户名称",
  52. prop: "customerName",
  53. },
  54. {
  55. label: "合同金额",
  56. prop: "contractAmount",
  57. },
  58. {
  59. label: "签订时间",
  60. prop: "createTime",
  61. },
  62. ]);
  63. const onRefresh = () => {
  64. req.value.pageNum = 1;
  65. finished.value = false;
  66. getList("refresh");
  67. };
  68. const onLoad = () => {
  69. getList();
  70. };
  71. const onClickLeft = () => proxy.$router.push("/main/working");
  72. const onClickRight = () => {
  73. proxy.$router.push({
  74. path: "jxskSalesContractAdd",
  75. query: {
  76. type: "add",
  77. },
  78. });
  79. };
  80. proxy.uploadDdRightBtn(onClickRight,'添加')
  81. const toDtl = (row) => {
  82. proxy.$router.push({
  83. path: "jxskSalesContractAdd",
  84. query: {
  85. id: row.id,
  86. },
  87. });
  88. };
  89. const getList = (type) => {
  90. loading.value = true;
  91. proxy
  92. .post("/salesContract/page", req.value)
  93. .then((res) => {
  94. listData.value =
  95. type === "refresh"
  96. ? res.data.rows
  97. : listData.value.concat(res.data.rows);
  98. if (req.value.pageNum * 10 >= res.data.total) {
  99. finished.value = true;
  100. }
  101. req.value.pageNum++;
  102. loading.value = false;
  103. })
  104. .catch((err) => {
  105. loading.value = false;
  106. });
  107. };
  108. </script>
  109. <style lang="scss" scoped>
  110. .list {
  111. min-height: 70vh;
  112. }
  113. </style>