chooseBulk.vue 4.5 KB

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