index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <van-nav-bar title="待入库" left-text="" left-arrow @click-left="onClickLeft">
  3. <!-- <template #right> 添加 </template> -->
  4. </van-nav-bar>
  5. <van-search
  6. v-model="req.keyword"
  7. placeholder="请输入关键词"
  8. @search="onRefresh"
  9. />
  10. <van-pull-refresh v-model="loading" @refresh="onRefresh">
  11. <div class="list">
  12. <van-list
  13. v-model:loading="loading"
  14. :finished="finished"
  15. finished-text="没有更多了"
  16. @load="onLoad"
  17. style="margin-bottom: 60px"
  18. >
  19. <commonList
  20. :data="listData"
  21. @onClick="toDtl"
  22. :config="listConfig"
  23. ></commonList>
  24. <div></div>
  25. </van-list>
  26. </div>
  27. </van-pull-refresh>
  28. </template>
  29. <script setup>
  30. import { ref, getCurrentInstance, onMounted } from "vue";
  31. import commonList from "@/components/common-list.vue";
  32. import { useRoute } from "vue-router";
  33. const loading = ref(false);
  34. const router = useRoute();
  35. const req = ref({
  36. pageNum: 1,
  37. type: "1",
  38. keyword: null,
  39. });
  40. const finished = ref(false);
  41. const proxy = getCurrentInstance().proxy;
  42. const listData = ref([]);
  43. const listConfig = ref([
  44. {
  45. label: "数据来源",
  46. prop: "businessTypeName",
  47. },
  48. {
  49. label: "物品名称",
  50. prop: "productName",
  51. },
  52. {
  53. label: "待办数量",
  54. prop: "quantity",
  55. },
  56. ]);
  57. const onRefresh = () => {
  58. req.value.pageNum = 1;
  59. finished.value = false;
  60. getList("refresh");
  61. };
  62. const onLoad = () => {
  63. getList();
  64. };
  65. const onClickLeft = () => proxy.$router.push("/main/working");
  66. const onClickRight = () => {
  67. proxy.$router.push("/main/manualInboundAdd");
  68. };
  69. const toDtl = (row) => {
  70. proxy.$router.push({
  71. path: "waitInboundAdd",
  72. query: {
  73. ...row,
  74. },
  75. });
  76. };
  77. const businessType = ref([
  78. {
  79. label: "线边回仓",
  80. value: 1,
  81. },
  82. {
  83. label: "完工入库",
  84. value: 2,
  85. },
  86. {
  87. label: "采购到货",
  88. value: 3,
  89. },
  90. {
  91. label: "退货出库",
  92. value: 4,
  93. },
  94. {
  95. label: "京东订单",
  96. value: 5,
  97. },
  98. {
  99. label: "销售订单出库",
  100. value: 6,
  101. },
  102. ]);
  103. const getList = (type) => {
  104. loading.value = true;
  105. proxy
  106. .post("/stockWaitDetails/page", req.value)
  107. .then((res) => {
  108. console.log(req.value);
  109. listData.value =
  110. type === "refresh"
  111. ? res.data.rows
  112. : listData.value.concat(res.data.rows);
  113. listData.value.forEach((x) => {
  114. const current = businessType.value.find(
  115. (v) => v.value == x.businessType
  116. );
  117. if (current) {
  118. x.businessTypeName = current.label;
  119. }
  120. });
  121. if (req.value.pageNum * 10 >= res.data.total) {
  122. finished.value = true;
  123. }
  124. req.value.pageNum++;
  125. loading.value = false;
  126. })
  127. .catch((err) => {
  128. loading.value = false;
  129. });
  130. };
  131. getList();
  132. </script>
  133. <style lang="scss" scoped>
  134. .list {
  135. min-height: 70vh;
  136. }
  137. </style>