shelfList.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <view class="moreShelfPart flex flex_column">
  3. <view class="moreShelfPart-search">
  4. <u-search
  5. placeholder="请输入货架名称搜索"
  6. v-model="shelfName"
  7. :show-action="isGobleSearch"
  8. @input="change"
  9. @focus="isGobleSearch = true"
  10. @blur="isGobleSearch = false"
  11. @custom="getShelfList"
  12. @search="getShelfList"
  13. @clear="clearSearch"
  14. :action-style="{ color: '#fff', 'font-size': '24upx', 'background-color': '#57a3f3', 'border-radius': '6upx', padding: '12upx 0' }"
  15. ></u-search>
  16. </view>
  17. <view class="moreShelfPart-body">
  18. <view class="nav-right">
  19. <view class="nav-right-item" v-for="(item, index) in shelfList" :key="item.id" @click="viewDetail(item)">
  20. <view class="item-info">
  21. <view class="item-name clearFix">
  22. <text class="barBox"></text>
  23. <text class="itemName">{{ item.shelfName }}</text>
  24. </view>
  25. <view class="item-detail">
  26. <view>
  27. 产品款数:
  28. <text class="item-detail-text">{{ item.shelfPlaceBindNum || 0 }}</text>
  29. </view>
  30. <view>
  31. 库存总量:
  32. <text class="item-detail-text">{{ item.qty || 0 }}</text>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <view v-if="shelfList && shelfList.length == 0">
  38. <u-empty
  39. v-if="status != 'loading'"
  40. :src="`/static/${$config('themePath')}/def_no_data@3x.png`"
  41. icon-size="180"
  42. :text="noDataText"
  43. mode="list"
  44. :margin-top="100"
  45. ></u-empty>
  46. </view>
  47. <view style="padding: 20upx;" v-if="shelfList.length"><u-loadmore :status="status" /></view>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import { getShelfList } from '@/api/shelf';
  54. import { clzConfirm } from '@/libs/tools';
  55. export default {
  56. data() {
  57. return {
  58. shelfName: '',
  59. isGobleSearch: false,
  60. shelfList: [],
  61. noDataText: '暂无货架',
  62. status: 'loading',
  63. tempData: null,
  64. pageNo: 1,
  65. pageSize: 20
  66. };
  67. },
  68. onLoad() {
  69. this.getShelfList();
  70. },
  71. methods: {
  72. clearSearch() {
  73. this.pageNo = 1;
  74. this.shelfName = '';
  75. this.shelfList = [];
  76. this.$nextTick(() => {
  77. this.getShelfList();
  78. });
  79. },
  80. change(v) {
  81. if (v == '') {
  82. this.clearSearch();
  83. }else{
  84. this.pageNo = 1;
  85. }
  86. },
  87. // 获取数字货架列表
  88. getShelfList() {
  89. const _this = this;
  90. let params = {
  91. pageNo: _this.pageNo,
  92. pageSize: _this.pageSize,
  93. shelfName: _this.shelfName
  94. };
  95. _this.status = 'loading';
  96. getShelfList(params).then(res => {
  97. if (res.status == 200) {
  98. let list = res.data.list;
  99. if (list && list.length) {
  100. // 分页 拼接数据
  101. if (_this.pageNo > 1) {
  102. _this.shelfList = _this.shelfList.concat(res.data.list || []);
  103. } else {
  104. _this.shelfList = res.data.list;
  105. }
  106. _this.total = res.data.count;
  107. if (_this.shelfList.length == res.data.count) {
  108. //是否是最后一页
  109. _this.status = 'nomore';
  110. } else {
  111. _this.status = 'loadmore';
  112. }
  113. } else {
  114. _this.shelfList = list || [];
  115. _this.total = 0;
  116. _this.status = 'nomore';
  117. _this.noDataText = '没有查询到相关货架';
  118. }
  119. _this.noDataText = '暂无货架';
  120. } else {
  121. _this.status = 'loadmore';
  122. _this.shelfList = [];
  123. _this.total = 0;
  124. _this.noDataText = res.message ? res.message : '网络似乎出错了,请稍后再试';
  125. }
  126. });
  127. },
  128. viewDetail(item) {
  129. uni.navigateTo({
  130. url: '/pages/shuntBackManage/addBackOrder?shelfSn='+ item.shelfSn+'&shelfName='+item.shelfName
  131. });
  132. }
  133. },
  134. // 上拉加载更多
  135. onReachBottom() {
  136. if (this.shelfList.length < this.total) {
  137. // if (this.isGobleSearch && this.shelfName == '') {
  138. // return;
  139. // }
  140. this.pageNo++;
  141. this.getShelfList();
  142. } else {
  143. this.status = 'nomore';
  144. }
  145. }
  146. };
  147. </script>
  148. <style lang="less">
  149. .moreShelfPart {
  150. width: 100%;
  151. height: 100vh;
  152. background-color: #f8f8f8;
  153. .moreShelfPart-search {
  154. padding: 20rpx;
  155. }
  156. .moreShelfPart-body {
  157. flex-grow: 1;
  158. }
  159. .nav-right {
  160. padding: 0 30upx;
  161. box-sizing: border-box;
  162. overflow: auto;
  163. .nav-right-item {
  164. padding: 20upx;
  165. border: 2rpx solid #f5f5f5;
  166. border-radius: 15upx;
  167. margin-bottom: 20upx;
  168. box-shadow: 3rpx 3rpx 8rpx #eee;
  169. background-color: #ffff;
  170. &:active {
  171. background: #f8f8f8;
  172. }
  173. .item-info {
  174. .item-name {
  175. font-size: 30upx;
  176. vertical-align: middle;
  177. .barBox {
  178. display: block;
  179. height: 30rpx;
  180. width: 6rpx;
  181. background: #9da8b5;
  182. margin-right: 10rpx;
  183. border-radius: 10rpx;
  184. float: left;
  185. margin-top: 9rpx;
  186. }
  187. .itemName {
  188. vertical-align: top;
  189. }
  190. }
  191. .clearFix::after {
  192. clear: both;
  193. content: '';
  194. display: block;
  195. visibility: hidden;
  196. }
  197. .item-detail {
  198. margin-top: 15rpx;
  199. display: flex;
  200. align-items: center;
  201. color: #9da8b5;
  202. font-size: 26upx;
  203. :nth-child(1) {
  204. margin-right: 50rpx;
  205. }
  206. .item-detail-text {
  207. font-size: 26upx;
  208. color: #333;
  209. }
  210. }
  211. }
  212. .button-box {
  213. display: flex;
  214. margin-top: 20upx;
  215. button {
  216. margin: 0 10upx;
  217. }
  218. > text {
  219. font-size: 24upx;
  220. color: #00aaff;
  221. }
  222. }
  223. }
  224. }
  225. }
  226. </style>