stockQuery.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <view class="sockQuery flex flex_column">
  3. <view class="search-box">
  4. <u-search placeholder="请输入货位号/产品编码/产品名称搜索" @search="pageInit()" @custom="pageInit()" v-model="queryWord"></u-search>
  5. </view>
  6. <swiper class="list-box">
  7. <swiper-item class="swiper-item" style="height: 100%;width: 100%;overflow: hidden;">
  8. <scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
  9. <view class="list-item flex align_center justify_between" v-for="item in list" :key="item.id">
  10. <view>
  11. <u-image :src="item.images||'@/static/def_imgs.png'" width='120' height="120"></u-image>
  12. </view>
  13. <view>
  14. <view class="flex align_center justify_between">
  15. <view class="vin-text">
  16. <text class="hj-no">{{item.shelfPlaceCode}}</text>
  17. <text>{{item.code}}</text>
  18. </view>
  19. <view class="time-text">
  20. 库存:<text>{{item.qty}}个</text>
  21. </view>
  22. </view>
  23. <view>{{item.productName}}</view>
  24. </view>
  25. </view>
  26. <view style="padding: 20upx;">
  27. <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
  28. <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
  29. </view>
  30. </scroll-view>
  31. </swiper-item>
  32. </swiper>
  33. </view>
  34. </template>
  35. <script>
  36. import { getShelfProductStockList } from '@/api/shelf.js'
  37. export default {
  38. data() {
  39. return {
  40. status: 'loading',
  41. noDataText: '暂无数据',
  42. pageNo: 1,
  43. pageSize: 10,
  44. total: 0,
  45. queryWord: "",
  46. list: []
  47. }
  48. },
  49. onLoad() {
  50. this.getList()
  51. },
  52. methods: {
  53. pageInit(){
  54. this.total = 0
  55. this.pageNo = 1
  56. this.list = []
  57. this.getList()
  58. },
  59. // 查询列表
  60. getList (pageNo) {
  61. let _this = this
  62. if (pageNo) {
  63. this.pageNo = pageNo
  64. }
  65. // 状态条件
  66. let params = {
  67. pageNo: this.pageNo,
  68. pageSize: this.pageSize,
  69. queryWord: this.queryWord
  70. }
  71. this.status = "loading"
  72. getShelfProductStockList(params).then(res => {
  73. if (res.code == 200 || res.status == 204 || res.status == 200) {
  74. if(_this.pageNo>1){
  75. _this.list = _this.list.concat(res.data.list || [])
  76. }else{
  77. _this.list = res.data.list || []
  78. }
  79. _this.total = res.data.count || 0
  80. } else {
  81. _this.list = []
  82. _this.total = 0
  83. _this.noDataText = res.message
  84. }
  85. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  86. })
  87. },
  88. // scroll-view到底部加载更多
  89. onreachBottom() {
  90. if(this.list.length < this.total){
  91. this.pageNo += 1
  92. this.getList()
  93. }else{
  94. this.status = "nomore"
  95. }
  96. },
  97. }
  98. }
  99. </script>
  100. <style lang="less">
  101. .sockQuery{
  102. width: 100%;
  103. height: 100vh;
  104. background: #f8f8f8;
  105. .search-box{
  106. padding: 20rpx 30rpx;
  107. }
  108. .list-box{
  109. flex-grow: 1;
  110. overflow: auto;
  111. }
  112. .list-item{
  113. margin: 20rpx 30rpx;
  114. border:2rpx solid #f8f8f8;
  115. box-shadow: 2rpx 2rpx 6rpx #eee;
  116. border-radius: 20rpx;
  117. padding: 20rpx 15rpx;
  118. background: #ffffff;
  119. > view{
  120. padding: 0 10rpx;
  121. &:last-child{
  122. flex-grow: 1;
  123. >view{
  124. padding: 10rpx 0;
  125. }
  126. }
  127. }
  128. .time-text{
  129. color: #999;
  130. text{
  131. color: #333;
  132. }
  133. }
  134. .vin-text{
  135. .hj-no{
  136. background: #f1f1f1;
  137. display: inline-block;
  138. border-radius: 10rpx;
  139. padding: 0 10rpx;
  140. margin-right: 10rpx;
  141. }
  142. }
  143. &:first-child{
  144. margin-top: 0;
  145. }
  146. &:active{
  147. opacity: 0.6;
  148. transform:scale(0.9);
  149. }
  150. }
  151. }
  152. </style>