ktadmin.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view class="content padding-t-30">
  3. <!-- 空白页 -->
  4. <!-- #ifdef H5 -->
  5. <empty src="../../../static/error/emptyOrder.png"
  6. v-if="searchData.loaded === true && searchData.list.length === 0"></empty>
  7. <!-- #endif -->
  8. <!-- #ifndef H5 -->
  9. <empty src="../../static/error/emptyOrder.png"
  10. v-if="searchData.loaded === true && searchData.list.length === 0"></empty>
  11. <!-- #endif -->
  12. <view class="user-item flex" v-for="(item,index) in searchData.list">
  13. <image :src="item.avatar" mode="scaleToFill" class="item-logo"></image>
  14. <view class="item-info">
  15. <view class="info-name clamp padding-b-10">
  16. {{item.nickname}} {{item.phone}}
  17. </view>
  18. <view class="info padding-b-10">
  19. 椒江区东海大道400号
  20. </view>
  21. <view class="info padding-b-10">
  22. 空桶型号:小瓶330ML
  23. </view>
  24. <view class="info-info flex">
  25. <view>
  26. 押桶:<text>0</text>
  27. </view>
  28. <view>
  29. 押金:<text>0</text>元
  30. </view>
  31. <view>
  32. 借桶:<text>0</text>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <uni-load-more :status="searchData.loadingType"></uni-load-more>
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. certificate,
  43. } from '@/api/water.js';
  44. export default {
  45. data() {
  46. return {
  47. keyword: '', //搜索关键字
  48. searchData: {
  49. page: 1,
  50. limit: 10,
  51. list: [],
  52. loadingType: 'more',
  53. loaded: false,
  54. }
  55. };
  56. },
  57. onLoad(opt) {
  58. this.getlist()
  59. },
  60. onShow() {
  61. },
  62. // #ifndef MP
  63. //点击导航栏 buttons 时触发
  64. onNavigationBarButtonTap(e) {
  65. const index = e.index;
  66. if (index === 0) {
  67. this.reLoadSearch();
  68. }
  69. },
  70. // 点击键盘搜索事件
  71. onNavigationBarSearchInputConfirmed(e) {
  72. this.reLoadSearch();
  73. },
  74. // 搜索栏内容变化事件
  75. onNavigationBarSearchInputChanged(e) {
  76. this.keyword = e.text;
  77. },
  78. // #endif
  79. onReady(res) {
  80. var that = this;
  81. },
  82. onReachBottom() {
  83. this.getlist();
  84. },
  85. methods: {
  86. // 搜索
  87. reLoadSearch() {
  88. this.searchData = {
  89. page: 1,
  90. limit: 10,
  91. list: [],
  92. loadingType: 'more',
  93. loaded: false
  94. };
  95. this.getlist()
  96. },
  97. // 载入数据
  98. getlist() {
  99. //这里是将订单挂载到tab列表下
  100. let navItem = this.searchData;
  101. if (navItem.loadingType === 'loading') {
  102. //防止重复加载
  103. return;
  104. }
  105. if (navItem.loadingType === 'noMore') {
  106. //防止重复加载
  107. return;
  108. }
  109. // 修改当前对象状态为加载中
  110. navItem.loadingType = 'loading';
  111. certificate({
  112. page: navItem.page,
  113. limit: navItem.limit,
  114. keyword: this.keyword
  115. })
  116. .then(({
  117. data
  118. }) => {
  119. let arr = data.map(e => {
  120. return e;
  121. });
  122. navItem.list = navItem.list.concat(arr);
  123. // console.log(navItem.orderList);
  124. navItem.page++;
  125. if (navItem.limit == data.length) {
  126. //判断是否还有数据, 有改为 more, 没有改为noMore
  127. navItem.loadingType = 'more';
  128. return;
  129. } else {
  130. //判断是否还有数据, 有改为 more, 没有改为noMore
  131. navItem.loadingType = 'noMore';
  132. }
  133. uni.hideLoading();
  134. navItem.loaded = true;
  135. })
  136. .catch(e => {
  137. console.log(e);
  138. });
  139. }
  140. }
  141. };
  142. </script>
  143. <style lang="scss" scoped>
  144. .user-item {
  145. padding: 30rpx;
  146. background-color: #fff;
  147. margin: 0 30rpx;
  148. margin-bottom: 15rpx;
  149. border-radius: 30rpx;
  150. .item-logo {
  151. align-self: flex-start;
  152. width: 115rpx;
  153. height: 115rpx;
  154. border-radius: 50%;
  155. background-color: #eee;
  156. flex-shrink: 0;
  157. margin-right: 24rpx;
  158. }
  159. .item-info {
  160. flex-grow: 1;
  161. height: 100%;
  162. flex-direction: column;
  163. align-items: flex-start;
  164. justify-content: space-between;
  165. color: $font-color-base;
  166. .info-name {
  167. font-size: $font-lg;
  168. font-weight: bold;
  169. }
  170. .info {
  171. font-size: $font-base;
  172. font-weight: 500;
  173. color: $font-color-light;
  174. }
  175. .info-info {
  176. width: 100%;
  177. font-size: $font-base;
  178. font-weight: bold;
  179. text {
  180. color: $color-red;
  181. }
  182. }
  183. }
  184. }
  185. </style>