chooseBulk.vue 4.6 KB

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