search.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <view class="list">
  3. <view class="top">
  4. <view class="search_con flexB">
  5. <view class="flexS search_inp">
  6. <text class="iconfont iconsousuo"></text>
  7. <input type="text" v-model="params.search_name" placeholder="请输入代理姓名或手机号查询" />
  8. </view>
  9. <view class="search" @click="getEnroll">搜索</view>
  10. </view>
  11. </view>
  12. <view class="scroll">
  13. <scroll-view scroll-y="true" @scrolltolower="more()">
  14. <view class="scroll_con">
  15. <view class="sign_list flexB" v-for="item in signList" :key="item.id">
  16. <view class="list_left flexS">
  17. <image :src="item.avatar"></image>
  18. <view>
  19. <text>{{ item.nickname }}</text>
  20. <view>{{ item.created_at }}</view>
  21. </view>
  22. </view>
  23. <view class="list_right">报名成功</view>
  24. </view>
  25. </view>
  26. </scroll-view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import { enrollList } from '../../api/sign.js';
  32. export default {
  33. data() {
  34. return {
  35. signList: [], //报名列表
  36. params: {
  37. page_size: 10,
  38. page_index: 1,
  39. type: 'all',
  40. order: '',
  41. search_name: ''
  42. }
  43. };
  44. },
  45. methods: {
  46. /*获取已报名的列表
  47. *@params search_name 搜索内容
  48. *@params page_size 当前显示条数
  49. *@params page_index 当前显示页数
  50. *@params type 传空值即可
  51. *@params order 传空值即可
  52. */
  53. getEnroll() {
  54. if (!this.params.search_name) {
  55. uni.showModal({
  56. content: '请输入代理姓名或手机号查询',
  57. showCancel: false
  58. });
  59. return false;
  60. }
  61. this.params.page_index = 1;
  62. let { page_size, page_index, type, order, search_name } = this.params;
  63. enrollList({
  64. page_size,
  65. page_index,
  66. type,
  67. order,
  68. search_name
  69. }).then(res => {
  70. if (res.code == 200) {
  71. if (res.data.list.length > 0) {
  72. this.signList = res.data.list;
  73. } else {
  74. wx.showToast({
  75. title: '暂无数据',
  76. icon: 'none'
  77. });
  78. }
  79. } else {
  80. uni.showModal({
  81. content: res.message || '请求失败',
  82. showCancel: false
  83. });
  84. }
  85. });
  86. },
  87. //上拉加载更多
  88. more() {
  89. this.params.page_index++;
  90. let { page_size, type, order, search_name, page_index } = this.params;
  91. enrollList({
  92. page_size,
  93. page_index,
  94. type,
  95. order,
  96. search_name
  97. }).then(res => {
  98. if (res.code == 200) {
  99. if (res.data.list.length > 0) {
  100. this.signList = this.signList.concat(res.data.list);
  101. } else {
  102. uni.showModal({
  103. content: '没有更多啦~',
  104. showCancel: false
  105. });
  106. }
  107. } else {
  108. uni.showModal({
  109. content: res.message || '请求失败',
  110. showCancel: false
  111. });
  112. }
  113. });
  114. }
  115. }
  116. };
  117. </script>
  118. <style>
  119. page {
  120. height: 100%;
  121. width: 100%;
  122. background: #fff;
  123. }
  124. </style>
  125. <style lang="scss">
  126. .list {
  127. width: 100%;
  128. min-height: 100%;
  129. position: relative;
  130. }
  131. .top {
  132. width: 100%;
  133. // position: absolute;
  134. // top: 15rpx;
  135. // left: 0;
  136. // z-index: 9999;
  137. height: 10vh;
  138. padding: 15rpx 0;
  139. box-sizing: border-box;
  140. .search_con {
  141. width: 95%;
  142. margin: 0 auto;
  143. }
  144. .search_inp {
  145. width: 600rpx;
  146. height: 88rpx;
  147. background-color: #f2f4f5;
  148. border-radius: 44rpx;
  149. .iconfont {
  150. font-size: 45rpx;
  151. color: #999;
  152. margin: 0 21rpx 0 36rpx;
  153. }
  154. }
  155. .search {
  156. font-size: 36rpx;
  157. color: #333;
  158. }
  159. }
  160. .scroll {
  161. height: 90vh;
  162. background: #fff;
  163. // margin-top: 20rpx;
  164. // padding-top:120rpx;
  165. scroll-view {
  166. height: 100%;
  167. }
  168. .scroll_con {
  169. // padding-bottom:20rpx;
  170. }
  171. .sign_list {
  172. padding: 0 30rpx;
  173. box-sizing: border-box;
  174. border-bottom: 1rpx solid #fcfcfc;
  175. background: #fff;
  176. height: 106rpx;
  177. .list_left {
  178. image {
  179. height: 88rpx;
  180. width: 88rpx;
  181. border-radius: 50%;
  182. margin-right: 22rpx;
  183. }
  184. view {
  185. text {
  186. font-size: 32rpx;
  187. color: #333;
  188. }
  189. view {
  190. color: #666;
  191. font-size: 28rpx;
  192. margin-top: 15rpx;
  193. }
  194. }
  195. }
  196. .list_right {
  197. font-size: 32rpx;
  198. color: #999;
  199. }
  200. }
  201. }
  202. </style>