stockQuery.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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 class="flex" v-if="item.productTypeSn3=='543766811373752320'" style="padding-top: 5px;">
  24. <text style="width: 4.5rem;color: #999;">原厂编码:</text>
  25. <u-tag :text="item.origCode" mode="light" borderColor="#ffffff" type="warning" size="large"></u-tag>
  26. </view>
  27. <view>{{item.productName}}</view>
  28. </view>
  29. </view>
  30. <view style="padding: 20upx;">
  31. <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>
  32. <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
  33. </view>
  34. </scroll-view>
  35. </swiper-item>
  36. </swiper>
  37. </view>
  38. </template>
  39. <script>
  40. import { getShelfProductStockList } from '@/api/shelf.js'
  41. export default {
  42. data() {
  43. return {
  44. status: 'loading',
  45. noDataText: '暂无数据',
  46. pageNo: 1,
  47. pageSize: 10,
  48. total: 0,
  49. queryWord: "",
  50. list: []
  51. }
  52. },
  53. onLoad() {
  54. this.getList()
  55. },
  56. methods: {
  57. pageInit(){
  58. this.total = 0
  59. this.pageNo = 1
  60. this.list = []
  61. this.getList()
  62. },
  63. // 查询列表
  64. getList (pageNo) {
  65. let _this = this
  66. if (pageNo) {
  67. this.pageNo = pageNo
  68. }
  69. // 状态条件
  70. let params = {
  71. pageNo: this.pageNo,
  72. pageSize: this.pageSize,
  73. queryWord: this.queryWord
  74. }
  75. this.status = "loading"
  76. getShelfProductStockList(params).then(res => {
  77. if (res.code == 200 || res.status == 204 || res.status == 200) {
  78. if(_this.pageNo>1){
  79. _this.list = _this.list.concat(res.data.list || [])
  80. }else{
  81. _this.list = res.data.list || []
  82. }
  83. _this.total = res.data.count || 0
  84. } else {
  85. _this.list = []
  86. _this.total = 0
  87. _this.noDataText = res.message
  88. }
  89. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  90. })
  91. },
  92. // scroll-view到底部加载更多
  93. onreachBottom() {
  94. if(this.list.length < this.total){
  95. this.pageNo += 1
  96. this.getList()
  97. }else{
  98. this.status = "nomore"
  99. }
  100. },
  101. }
  102. }
  103. </script>
  104. <style lang="less">
  105. .sockQuery{
  106. width: 100%;
  107. height: 100vh;
  108. background: #f8f8f8;
  109. .search-box{
  110. padding: 20rpx 30rpx;
  111. }
  112. .list-box{
  113. flex-grow: 1;
  114. overflow: auto;
  115. /deep/ .u-tag{
  116. word-break: break-all;
  117. }
  118. }
  119. .list-item{
  120. margin: 20rpx 30rpx;
  121. border:2rpx solid #f8f8f8;
  122. box-shadow: 2rpx 2rpx 6rpx #eee;
  123. border-radius: 20rpx;
  124. padding: 20rpx 15rpx;
  125. background: #ffffff;
  126. > view{
  127. padding: 0 10rpx;
  128. &:last-child{
  129. flex-grow: 1;
  130. >view{
  131. padding: 10rpx 0;
  132. }
  133. }
  134. }
  135. .time-text{
  136. color: #999;
  137. text{
  138. color: #333;
  139. }
  140. }
  141. .vin-text{
  142. .hj-no{
  143. background: #2196F3;
  144. color: #ffffff;
  145. display: inline-block;
  146. border-radius: 10rpx;
  147. padding: 0 10rpx;
  148. margin-right: 10rpx;
  149. }
  150. }
  151. &:first-child{
  152. margin-top: 0;
  153. }
  154. &:active{
  155. opacity: 0.6;
  156. transform:scale(0.9);
  157. }
  158. }
  159. }
  160. </style>