shelfList.vue 5.1 KB

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