chooseBulk.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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="150"></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. uni.setNavigationBarColor({
  66. frontColor: '#ffffff',
  67. backgroundColor: this.$config('primaryColor')
  68. })
  69. },
  70. methods: {
  71. clearSearch(){
  72. this.shelfName = ''
  73. this.search()
  74. },
  75. change(v){
  76. if(v==''){
  77. this.clearSearch()
  78. }
  79. },
  80. search(){
  81. this.pageNo = 1
  82. this.shelfList = []
  83. this.getShelfList()
  84. },
  85. // 获取数字货架列表
  86. getShelfList(){
  87. const _this = this
  88. let params = {
  89. pageNo: this.pageNo,
  90. pageSize: this.pageSize,
  91. shelfName: this.shelfName
  92. }
  93. _this.status = 'loading'
  94. getShelfList(params).then(res => {
  95. uni.hideLoading()
  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. }
  116. _this.noDataText = '暂无货架'
  117. }else{
  118. _this.status = 'loadmore'
  119. _this.shelfList = []
  120. _this.total = 0
  121. _this.noDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
  122. }
  123. })
  124. },
  125. // 加载更多
  126. onreachBottom () {
  127. if(this.shelfList.length < this.total ){
  128. if(this.isGobleSearch&&this.shelfName==''){
  129. return
  130. }
  131. this.pageNo++
  132. this.getShelfList()
  133. }else{
  134. this.status = "nomore"
  135. }
  136. },
  137. viewDetail(item){
  138. uni.navigateTo({
  139. url: "/pages/latePlay/chooseProduct?shelfSn="+item.shelfSn+'&shelfName='+item.shelfName
  140. })
  141. }
  142. }
  143. }
  144. </script>
  145. <style lang="less">
  146. .moreShelfPart{
  147. width: 100%;
  148. height: 100vh;
  149. .moreShelfPart-search{
  150. padding: 20rpx;
  151. background-color: #FFFFFF;
  152. }
  153. .moreShelfPart-body{
  154. flex-grow: 1;
  155. background-color: #fff;
  156. }
  157. .nav-right{
  158. padding: 0 30upx;
  159. height: calc(100vh - 110rpx);
  160. box-sizing: border-box;
  161. .nav-right-item{
  162. padding:20upx 10upx;
  163. border-bottom: 2rpx solid #f5f5f5;
  164. display: flex;
  165. align-items: center;
  166. &:active{
  167. background: #f8f8f8;
  168. }
  169. .arrow{
  170. text-align: right;
  171. padding-left: 20rpx;
  172. }
  173. .item-info{
  174. .item-name{
  175. font-size: 30upx;
  176. display: flex;
  177. align-items: center;
  178. }
  179. .item-detail{
  180. margin-top: 10rpx;
  181. .item-detail-text{
  182. font-size: 30upx;
  183. color: #9DA8B5;
  184. word-break: break-all;
  185. }
  186. }
  187. }
  188. }
  189. }
  190. }
  191. </style>