WarehouseRegion.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view>
  3. <view class="search-view">
  4. <u-search
  5. disabled
  6. v-model="areaName"
  7. :clearabled="true"
  8. @custom="selclear"
  9. @click="openSel"
  10. :show-action="true"
  11. action-text="重置"
  12. placeholder="点击选择所属库区"
  13. ></u-search>
  14. </view>
  15. <view class="list-ul">
  16. <view class="list-li" v-for="(item, index) in region_list" :key="index" @click="changeData(item)">
  17. <view class="name">{{ item.name }}</view>
  18. <view class="other-info">
  19. <text class="label">库位编码</text>
  20. {{ item.code }}
  21. </view>
  22. <view class="other-info">
  23. <text class="label">所属库区</text>
  24. {{ item.areaName }}
  25. </view>
  26. </view>
  27. <u-loadmore :status="load_status" />
  28. </view>
  29. <u-select v-model="select_show" @confirm="selconfirm" label-name="name" value-name="id" :list="position_list"></u-select>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. select_show: false,
  37. load_status: 'nomore',
  38. areaId: '',
  39. areaName: '',
  40. page: 1,
  41. pageSize: 10,
  42. total: 0,
  43. region_list: [],
  44. position_list: []
  45. };
  46. },
  47. async onLoad() {
  48. await this.getAllStorageLocation();
  49. await this.getListReservoir();
  50. },
  51. onPullDownRefresh() {
  52. this.page = 1;
  53. this.getAllStorageLocation();
  54. },
  55. // 上拉加载
  56. onReachBottom() {
  57. if (this.total / this.pageSize > this.page) {
  58. this.page += 1;
  59. this.getAllStorageLocation();
  60. }
  61. },
  62. methods: {
  63. changeData(item) {
  64. // 选择返回上一页
  65. this._prePage().warehouseLocation = item;
  66. uni.navigateBack();
  67. },
  68. selclear() {
  69. this.areaName = '';
  70. this.areaId = '';
  71. this.page = 1;
  72. this.getAllStorageLocation();
  73. },
  74. openSel() {
  75. this.select_show = true;
  76. },
  77. selconfirm(arr) {
  78. this.areaName = arr[0].label;
  79. this.areaId = arr[0].value;
  80. this.page = 1;
  81. this.getAllStorageLocation();
  82. },
  83. // 库位
  84. async getAllStorageLocation() {
  85. this.loading_status = 'loading';
  86. await this.$u.api
  87. .getAllStorageLocation({
  88. areaId: this.areaId,
  89. enableStatus: 5,
  90. page: this.page,
  91. pageSize: this.pageSize
  92. })
  93. .then(res => {
  94. if (this.page === 1) {
  95. this.region_list = res.data;
  96. } else {
  97. this.region_list = this.region_list.concat(res.data);
  98. }
  99. this.total = res.pageTotal;
  100. this.load_status = this.$utils.loadStatus(this.page, this.pageSize, this.total);
  101. });
  102. },
  103. // 库区
  104. async getListReservoir() {
  105. await this.$u.api.getListReservoir().then(res => {
  106. this.position_list = res.data;
  107. });
  108. }
  109. }
  110. };
  111. </script>
  112. <style lang="scss" scoped>
  113. .search-view {
  114. position: fixed;
  115. top: 0;
  116. left: 0;
  117. width: 100%;
  118. padding: 20rpx;
  119. background-color: #ffffff;
  120. }
  121. .list-ul {
  122. padding-top: 100rpx;
  123. .list-li {
  124. width: 710rpx;
  125. margin: 20rpx auto;
  126. border-radius: 10rpx;
  127. background-color: #ffffff;
  128. padding: 24rpx;
  129. .name {
  130. padding-bottom: 10rpx;
  131. font-weight: bold;
  132. }
  133. .other-info {
  134. padding-top: 10rpx;
  135. font-size: 24rpx;
  136. .label {
  137. color: #879bba;
  138. margin-right: 20rpx;
  139. }
  140. }
  141. }
  142. }
  143. </style>