InviterUser.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <member-base :show="false"><view style="position: absolute;top:0;right:0;left:0;bottom:0" class="scroll-view-wrapper div container">
  3. <view class="div common-header-wrap">
  4. <view class="status-holder"></view>
  5. <view :style="'height:'+navHeight+'px'"></view>
  6. <view class="common-header-holder"></view>
  7. <view class="common-header-fixed">
  8. <title-header />
  9. <uni-nav-bar title="推广会员" class="common-header" left-icon="back" @clickLeft="goBack()">
  10. </uni-nav-bar>
  11. </view>
  12. </view>
  13. <view class="scroll-view div" style="position:relative">
  14. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" class="div" @scrolltolower="loadMore" scroll-y="true">
  15. <view class="div" v-if="userList && userList.length">
  16. <view class="div inviter-item" v-for="(v,k) in userList" :key="v.member_id">
  17. <view class="div avatar">
  18. <image mode="aspectFit" class="img" :src="v.member_avatar" />
  19. </view>
  20. <view class='div inviter'>
  21. <view class='div users'>
  22. <strong>{{v.member_name}}</strong>
  23. <text class="span" v-for="(i_u,n) in v.inviters" :key="n">->{{i_u}}</text>
  24. </view>
  25. <view class='div time'>注册时间:{{v.member_addtime}}</view>
  26. <view class='div time'>最后登录:{{v.member_logintime}}</view>
  27. </view>
  28. </view>
  29. </view>
  30. <empty-record v-else-if="userList && !userList.length"></empty-record>
  31. </scroll-view>
  32. </view>
  33. </view></member-base>
  34. </template>
  35. <script>
  36. import {getFontSize} from '@/util/common'
  37. import TitleHeader from '../../TitleHeader'
  38. import MemberBase from '../MemberBase'
  39. import { getInviterUser } from '../../../api/memberInviter'
  40. import EmptyRecord from '../../EmptyRecord'
  41. export default {
  42. name:'MemberInviterUser',
  43. components:{
  44. TitleHeader,
  45. MemberBase,
  46. EmptyRecord
  47. },
  48. computed:{
  49. fontSize(){
  50. return getFontSize()
  51. },
  52. },
  53. data(){
  54. return {
  55. navHeight: 0,
  56. params: { 'page': 0, 'per_page': 10 },
  57. loading: false, // 是否加载更多
  58. isMore: true, // 是否有更多
  59. userList: false
  60. }
  61. },
  62. created () {
  63. this.loadMore()
  64. },
  65. mounted(){
  66. // #ifdef MP-WEIXIN
  67. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  68. // #endif
  69. },
  70. methods:{
  71. goBack(){uni.navigateBack({delta:1})},
  72. getUserList (ispush) {
  73. uni.showLoading({ title: '加载中' })
  74. let params = this.params
  75. getInviterUser(params).then(res => {
  76. uni.hideLoading()
  77. if (res) {
  78. if (ispush && this.userList) {
  79. this.userList = this.userList.concat(res.result.list)
  80. } else {
  81. this.userList = res.result.list
  82. }
  83. if (res.result.hasmore) {
  84. this.isMore = true
  85. } else {
  86. this.isMore = false
  87. }
  88. }
  89. })
  90. },
  91. loadMore () {
  92. this.loading = true
  93. this.params.page = ++this.params.page
  94. if (this.isMore) {
  95. this.loading = false
  96. this.getUserList(true)
  97. }
  98. }
  99. }
  100. }
  101. </script>
  102. <style scoped lang="scss">
  103. .scroll-view-wrapper{display: flex;flex-direction: column;}
  104. .scroll-view{flex:1}
  105. .inviter-item{display:flex;padding:.5rem;background:#fff;border-bottom:1px solid #e4e4e4;
  106. .avatar{width:4.5rem;
  107. .img{width:4rem}
  108. }
  109. .inviter{flex:1;font-size:$subFontSize;
  110. .users{font-size:$h3;margin-bottom:1rem;margin-top:.5rem}
  111. .time{color:gray;margin-top:.2rem}
  112. }
  113. }
  114. </style>