stockQuery.vue 4.1 KB

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