belong.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <view>
  3. <view class="topt">
  4. <view class="search_con">
  5. <view class="search_inp">
  6. <view class="flex">
  7. <image src="../../static/fangwei/search.png" mode="widthFix"
  8. style="width: 40rpx;margin-right: 10rpx;"></image>
  9. <input type="text" v-model="params.search_name" placeholder="输入昵称或手机号" style="width: 370rpx;" />
  10. </view>
  11. <view class="search" @click="getEnroll">查询</view>
  12. </view>
  13. </view>
  14. </view>
  15. <view style="padding: 130rpx 0;">
  16. <view :class="active == index? 'botRed' : 'bot'" v-for="(item,index) in teamList" :key="index"
  17. @click="active = index">
  18. <view class="botLeft">
  19. <view class="img">
  20. <image :src="item.avatar" mode="widthFix" style="width: 68rpx;"></image>
  21. </view>
  22. <view class="right">
  23. <view class="right_top">
  24. <text>{{ getName(item.nickname) }}</text>
  25. {{ item.phone }}
  26. </view>
  27. </view>
  28. </view>
  29. <view :class="active == index? 'botRightRed' : 'botRight'">
  30. <view v-if="active == index" style="color: #FB231F;">
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="fixedBot" @click="goDetail">
  36. <view class="fixedBot_btn">
  37. 确定
  38. </view>
  39. </view>
  40. <u-toast ref="uToast" />
  41. </view>
  42. </template>
  43. <script>
  44. import {
  45. getLower
  46. } from '../../apis/fangwei.js';
  47. export default {
  48. data() {
  49. return {
  50. active: -1,
  51. params: {
  52. page: 1,
  53. search_name: ''
  54. },
  55. totalPage: 0,
  56. teamList: []
  57. }
  58. },
  59. onLoad() {
  60. this.getLowerAll()
  61. },
  62. onReachBottom: function() {
  63. this.more();
  64. },
  65. methods: {
  66. getName(name) {
  67. if (name) {
  68. return name.length > 9 ? name.slice(0, 9) + '...' : name;
  69. }
  70. return '';
  71. },
  72. getLowerAll() {
  73. getLower(this.params).then(res => {
  74. if (res.code == 200) {
  75. if (res.data.list.length == 0) {
  76. uni.showToast({
  77. title: '暂无符合条件人选',
  78. icon: 'none'
  79. })
  80. return false;
  81. }
  82. this.totalPage = Math.ceil(Number(res.data.total) / 20);
  83. this.teamList = res.data.list;
  84. } else {
  85. uni.showToast({
  86. title: res.message || '获取列表失败',
  87. icon: 'none'
  88. })
  89. }
  90. });
  91. },
  92. //加载获取更多
  93. more() {
  94. this.params.page++;
  95. if (this.params.page > this.totalPage) {
  96. this.$refs.uToast.show({
  97. title: '没有更多啦~',
  98. type: 'error',
  99. icon: false
  100. })
  101. return false;
  102. }
  103. getLower(this.params).then(res => {
  104. if (res.code == 200) {
  105. if (res.data.list.length > 0) {
  106. this.teamList = this.teamList.concat(res.data.list)
  107. }
  108. } else {
  109. uni.showToast({
  110. title: res.message || '获取列表失败',
  111. icon: 'none'
  112. })
  113. }
  114. });
  115. },
  116. getEnroll() {
  117. this.params.page = 1
  118. this.getLowerAll()
  119. },
  120. goDetail() {
  121. if (this.active == -1) {
  122. uni.showToast({
  123. title: '请选择所属者',
  124. icon: 'none'
  125. })
  126. return false
  127. }
  128. console.log(this.active, 111)
  129. const id = this.teamList[this.active].id
  130. uni.navigateTo({
  131. url: './detail?id=' + id
  132. })
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="scss" scoped>
  138. .topt {
  139. width: 100%;
  140. padding: 30rpx 24rpx 24rpx 24rpx;
  141. box-sizing: border-box;
  142. background-color: #fff;
  143. position: fixed;
  144. left: 0;
  145. top: 0;
  146. z-index: 10000;
  147. .search_con {
  148. width: 700rpx;
  149. display: flex;
  150. justify-content: space-between;
  151. align-items: center;
  152. }
  153. .search_inp {
  154. height: 80rpx;
  155. width: 100%;
  156. padding: 0 10rpx 0 30rpx;
  157. border-radius: 44rpx;
  158. background: #F9F9FB;
  159. display: flex;
  160. justify-content: space-between;
  161. align-items: center;
  162. .flex {
  163. display: flex;
  164. }
  165. }
  166. .search {
  167. width: 132rpx;
  168. height: 64rpx;
  169. line-height: 64rpx;
  170. font-size: 24rpx;
  171. color: #FFFFFF;
  172. text-align: center;
  173. background: linear-gradient(92deg, #FF232C 0%, #FF571B 100%);
  174. border-radius: 32rpx;
  175. }
  176. }
  177. .bot {
  178. margin: 24rpx 24rpx 0 24rpx;
  179. height: 140rpx;
  180. background-color: #fff;
  181. padding: 0 24rpx;
  182. display: flex;
  183. justify-content: space-between;
  184. align-items: center;
  185. border-radius: 16rpx;
  186. .botLeft {
  187. display: flex;
  188. align-items: center;
  189. .img {
  190. width: 68rpx;
  191. height: 68rpx;
  192. border: 2rpx solid #FFFFFF;
  193. border-radius: 50%;
  194. overflow: hidden;
  195. }
  196. .right {
  197. margin-left: 20rpx;
  198. &_top {
  199. font-size: 28rpx;
  200. color: #999999;
  201. text {
  202. font-size: 30rpx;
  203. font-weight: bold;
  204. color: #333;
  205. margin-right: 20rpx;
  206. }
  207. }
  208. &_red {
  209. background: #FB7500;
  210. }
  211. &_yellow {
  212. background-color: #D9AE00;
  213. }
  214. &_level {
  215. width: 116rpx;
  216. height: 42rpx;
  217. margin-top: 10rpx;
  218. text-align: center;
  219. line-height: 42rpx;
  220. border-radius: 4rpx;
  221. color: #fff;
  222. font-size: 24rpx;
  223. }
  224. }
  225. }
  226. .botRight {
  227. width: 48rpx;
  228. height: 48rpx;
  229. border-radius: 50%;
  230. border: 2rpx solid #999999;
  231. }
  232. }
  233. .botRed {
  234. margin: 24rpx 24rpx 0 24rpx;
  235. height: 140rpx;
  236. background: linear-gradient(180deg, #F30000 0%, #FE4815 100%);
  237. padding: 0 24rpx;
  238. display: flex;
  239. justify-content: space-between;
  240. align-items: center;
  241. border-radius: 16rpx;
  242. .botLeft {
  243. display: flex;
  244. align-items: center;
  245. .img {
  246. width: 68rpx;
  247. height: 68rpx;
  248. border: 2rpx solid #FFFFFF;
  249. border-radius: 50%;
  250. overflow: hidden;
  251. }
  252. .right {
  253. margin-left: 20rpx;
  254. color: #fff;
  255. &_top {
  256. font-size: 28rpx;
  257. color: #fff;
  258. text {
  259. font-size: 30rpx;
  260. font-weight: bold;
  261. color: #FFF;
  262. margin-right: 20rpx;
  263. }
  264. }
  265. &_level {
  266. width: 116rpx;
  267. height: 42rpx;
  268. margin-top: 10rpx;
  269. text-align: center;
  270. line-height: 42rpx;
  271. background: #fff;
  272. border-radius: 4rpx;
  273. color: #FB231F;
  274. font-size: 24rpx;
  275. }
  276. }
  277. }
  278. .botRightRed {
  279. width: 48rpx;
  280. height: 48rpx;
  281. border-radius: 50%;
  282. background-color: #FFFFFF;
  283. text-align: center;
  284. line-height: 48rpx;
  285. font-weight: bold;
  286. }
  287. }
  288. .fixedBot {
  289. background-color: #fff;
  290. width: 750rpx;
  291. height: 102rpx;
  292. position: fixed;
  293. left: 0;
  294. bottom: 0;
  295. display: flex;
  296. justify-content: center;
  297. align-items: center;
  298. &_btn {
  299. width: 702rpx;
  300. height: 88rpx;
  301. background: linear-gradient(90deg, #F30000 0%, #FE4815 100%);
  302. border-radius: 44rpx;
  303. text-align: center;
  304. line-height: 88rpx;
  305. font-size: 32rpx;
  306. font-weight: bold;
  307. color: #fff;
  308. }
  309. }
  310. </style>