chooseBulk.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. @focus="isGobleSearch=true"
  9. @blur="isGobleSearch=false"
  10. @custom="getShelfList"
  11. @search="getShelfList"
  12. @clear="clearSearch"
  13. :action-style="{'color': '#fff', 'font-size': '24upx', 'background-color': '#57a3f3', 'border-radius': '6upx', 'padding': '12upx 0'}">
  14. </u-search>
  15. </view>
  16. <view class="moreShelfPart-body">
  17. <scroll-view
  18. class="nav-right"
  19. scroll-y
  20. @scrolltolower="onreachBottom">
  21. <view class="nav-right-item" v-for="(item, index) in shelfList" :key="item.id" @click="viewDetail(item)">
  22. <view class="item-info uni-col-10">
  23. <view class="item-name">
  24. <text>{{item.shelfName}}</text>
  25. </view>
  26. <view class="item-detail">
  27. <text class="item-detail-text">
  28. {{item.customerEntity&&item.customerEntity.provinceName}}{{item.customerEntity&&item.customerEntity.cityName}}{{item.customerEntity&&item.customerEntity.countyName}}{{item.customerEntity&&item.customerEntity.customerAddr}}
  29. </text>
  30. </view>
  31. </view>
  32. </view>
  33. <view v-if="shelfList&&shelfList.length==0">
  34. <u-empty v-if="status!='loading'" :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="240" :text="noDataText" mode="list" :margin-top="50"></u-empty>
  35. </view>
  36. <view style="padding: 20upx;" v-if="total>pageSize || status=='loading'">
  37. <u-loadmore :status="status" />
  38. </view>
  39. </scroll-view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import { getShelfList } from '@/api/shelf'
  45. export default {
  46. data() {
  47. return {
  48. shelfName: '',
  49. isGobleSearch: false,
  50. shelfList: [],
  51. pageNo:1,
  52. pageSize: 10,
  53. total: 0, // 列表总数
  54. noDataText: '暂无货架',
  55. status: 'loading',
  56. vinstatus: 'loading'
  57. }
  58. },
  59. onLoad(opts) {
  60. this.getShelfList()
  61. },
  62. methods: {
  63. clearSearch(){
  64. this.shelfName = ''
  65. this.pageNo = 1
  66. this.shelfList = []
  67. this.getShelfList()
  68. },
  69. // 获取数字货架列表
  70. getShelfList(){
  71. const _this = this
  72. let params = {
  73. pageNo: this.pageNo,
  74. pageSize: this.pageSize,
  75. shelfName: this.shelfName
  76. }
  77. _this.status = 'loading'
  78. getShelfList(params).then(res => {
  79. uni.hideLoading()
  80. if(res.status == 200){
  81. let list = res.data.list
  82. if (list && list.length){
  83. // 分页 拼接数据
  84. if (_this.pageNo != 1) {
  85. _this.shelfList = _this.shelfList ? _this.shelfList.concat(list) : list
  86. } else {
  87. _this.shelfList = list
  88. }
  89. this.total = res.data.count
  90. if (_this.shelfList.length == res.data.count) {
  91. _this.status = 'nomore'
  92. } else {
  93. _this.status = 'loadmore'
  94. }
  95. } else {
  96. _this.shelfList = list || []
  97. this.total = 0
  98. _this.status = 'nomore'
  99. }
  100. _this.noDataText = '暂无配件'
  101. }else{
  102. _this.status = 'loadmore'
  103. _this.shelfList = []
  104. _this.total = 0
  105. _this.noDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
  106. }
  107. })
  108. },
  109. // 加载更多
  110. onreachBottom () {
  111. if(this.shelfList.length < this.total ){
  112. if(this.isGobleSearch&&this.shelfName==''){
  113. return
  114. }
  115. this.pageNo++
  116. this.getShelfList()
  117. }else{
  118. this.status = "nomore"
  119. }
  120. },
  121. viewDetail(item){
  122. uni.navigateTo({
  123. url: "/pages/latePlay/chooseProduct?shelfSn="+item.shelfSn+'&shelfName='+item.shelfName
  124. })
  125. }
  126. }
  127. }
  128. </script>
  129. <style lang="less">
  130. .moreShelfPart{
  131. width: 100%;
  132. height: 100vh;
  133. .moreShelfPart-search{
  134. padding: 20rpx;
  135. background-color: #FFFFFF;
  136. }
  137. .moreShelfPart-body{
  138. flex-grow: 1;
  139. background-color: #fff;
  140. }
  141. .nav-right{
  142. padding: 0 30upx;
  143. height: calc(100vh - 110rpx);
  144. box-sizing: border-box;
  145. .nav-right-item{
  146. padding:20upx 10upx;
  147. border-bottom: 2rpx solid #f5f5f5;
  148. display: flex;
  149. .item-info{
  150. .item-name{
  151. font-size: 32upx;
  152. display: flex;
  153. align-items: center;
  154. }
  155. .item-detail{
  156. margin-top: 10rpx;
  157. .item-detail-text{
  158. font-size: 30upx;
  159. color: #9DA8B5;
  160. word-break: break-all;
  161. }
  162. }
  163. }
  164. }
  165. }
  166. }
  167. </style>