myInventory.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <div class="bgcolor">
  3. <div class="navBarTOP" >
  4. <van-nav-bar class="navBar" title="我的库存信息" left-arrow @click-left="onClickLeft">
  5. <template #right>
  6. </template>
  7. </van-nav-bar>
  8. <van-row gutter="20" style="padding:0 6px;" >
  9. <van-col span="12" >
  10. <van-button type="info" size="small" style="background: #1989fa;border-color: #1989fa;width: 100%;border-radius: 5px;
  11. margin-top: 10px;" @click="onSelect('A')"><van-icon name="guide-o" />&nbsp;物料领取</van-button>
  12. </van-col>
  13. <van-col span="12" >
  14. <van-button type="warning" size="small" style="margin-top: 10px;background: #ff976a!important;;border-color: #ff976a!important;width: 100%;border-radius: 5px;" @click="onSelect('B')"><van-icon name="revoke" />&nbsp;物料退回</van-button>
  15. </van-col>
  16. </van-row>
  17. <br>
  18. </div>
  19. <div class="lineGrey"></div>
  20. <div class="lineGrey"></div>
  21. <div class="lineGrey"></div>
  22. <div class="lineGrey"></div>
  23. <div class="lineGrey"></div>
  24. <div class="lineGrey"></div>
  25. <div class="lineGrey"></div>
  26. <div class="lineGrey"></div>
  27. <div class="lineGrey"></div>
  28. <div class="lineGrey"></div>
  29. <div class="lineGrey"></div>
  30. <div class="container" style="width: 100%; margin: 0 auto;">
  31. <el-table :data="list" border style="width: 100%" :span-method="objectSpanMethod">
  32. <el-table-column label="物料类型" prop="materialTypeName">
  33. <template slot-scope="scope">
  34. <span class="tipTitle" @click="tipTitle(scope.row.materialTypeName)">{{ scope.row.materialTypeName }}</span>
  35. </template>
  36. </el-table-column>
  37. <el-table-column label="物料名称" prop="materialDataName">
  38. <template slot-scope="scope">
  39. <span class="tipTitle" @click="tipTitle(scope.row.materialDataName)">{{ scope.row.materialDataName }}</span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column class="t-center" prop="inventoryNum" label="库存量" />
  43. </el-table>
  44. </div>
  45. </div>
  46. </template>
  47. <script>
  48. import {getMyInventoryList} from "@/api/inventory";
  49. export default {
  50. data() {
  51. return {
  52. disabled:false,
  53. list: [],
  54. addShow:false,
  55. storeTypeList: [],
  56. loading: false,
  57. finished: false,
  58. pageSize: 12,
  59. pageNum: 1,
  60. tabVal:'1',
  61. showProvincePicker: false,
  62. showCityPicker: false,
  63. showDistrictPicker: false,
  64. provinceList: [],
  65. cityList: [],
  66. districtList: [],
  67. validFlag:"",
  68. addShow1:false,
  69. title:"我的门店",
  70. fromValue: {
  71. pageSize: 12,
  72. pageNum: 1,
  73. }
  74. }
  75. },
  76. created() {
  77. this.getMyInventoryList()
  78. },
  79. watch: {
  80. $route(to, from) {
  81. if (to.path == "/myInventory") {
  82. this.getMyInventoryList()
  83. }
  84. }
  85. },
  86. methods: {
  87. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  88. const cellValue = row[column.property]
  89. if (cellValue && ["materialTypeName"].includes(column.property)) {
  90. const prevRow = this.list[rowIndex - 1]
  91. let nextRow = this.list[rowIndex + 1]
  92. if (prevRow && prevRow[column.property] === cellValue) {
  93. return { rowspan: 0, colspan: 0 }
  94. } else {
  95. let countRowspan = 1
  96. while (nextRow && nextRow[column.property] === cellValue) {
  97. nextRow = this.list[++countRowspan + rowIndex]
  98. }
  99. if (countRowspan > 1) {
  100. return { rowspan: countRowspan, colspan: 1 }
  101. }
  102. }
  103. }
  104. },
  105. tipTitle(val) {
  106. this.$toast(val);
  107. },
  108. onSelect(action) {
  109. this.$router.push({path: "/material", query: {
  110. tabVal:action
  111. }
  112. })
  113. },
  114. getMyInventoryList() {
  115. let loading1 = this.$toast.loading({
  116. duration: 0,
  117. message: '加载中...',
  118. forbidClick: true,
  119. });
  120. var fromValue=this.fromValue
  121. fromValue.pageNum=this.pageNum
  122. fromValue.pageSize=this.pageSize
  123. fromValue.inventoryLyUserId=localStorage.getItem("userId")
  124. getMyInventoryList(fromValue).then(res => {
  125. loading1.clear()
  126. if (res.code == 200) {
  127. this.loading = false;
  128. this.list = res.rows
  129. } else {
  130. this.$toast.fail(res.msg)
  131. }
  132. })
  133. },
  134. onClickLeft() {
  135. this.$router.go(-1)
  136. },
  137. }
  138. }
  139. </script>
  140. <style lang="scss" scoped>
  141. .container {
  142. padding-bottom: 50px;
  143. }
  144. </style>