stockQuery.vue 4.0 KB

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