耀实惠小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

250 lines
5.4 KiB

2 years ago
  1. <template>
  2. <view>
  3. <view class="top_box">
  4. <view class="chanmel_image">
  5. <image :src="userInfo.headUrl" mode=""></image>
  6. </view>
  7. <view class="title_box">
  8. <view class="left_text">
  9. <text>我的团队</text>
  10. <text>{{fansSize}}</text>
  11. </view>
  12. <view class="right_text">
  13. <text>我的推荐人</text>
  14. <text v-if="Object.keys(fans_userInfo).length >0">{{fans_userInfo.nickName}}</text>
  15. <text v-else>平台</text>
  16. </view>
  17. </view>
  18. </view>
  19. <!-- 选择框 -->
  20. <view class="select_pic_video">
  21. <u-subsection mode="subsection" :list="listOneTow" fontSize="30" height="61"
  22. :current="current" @change="sectionChange"></u-subsection>
  23. </view>
  24. <!-- 数据展示 -->
  25. <view class="item_list_box" v-if="member_list.length>0">
  26. <view class="item" v-for="(item,index) in member_list" :key="index">
  27. <u-badge :offset="['52','668']" :isDot="true" bgColor="#157DF6" showZero='0' type="success"></u-badge>
  28. <image :src="item.headUrl" mode=""></image>
  29. <view class="item_text_box">
  30. <view class="left_box">
  31. <text>{{item.nickName}}</text>
  32. <text>注册时间{{item.createTime}}</text>
  33. </view>
  34. <image v-if="item.level" :class="item.level==4?'img2':'img1'" :src="IMG_URL+'vip/'+ (item.level) +'.png'" mode="widthFix" ></image>
  35. </view>
  36. </view>
  37. </view>
  38. <!-- 数据为空 -->
  39. <u-empty v-else text="无数据" mode="list"></u-empty>
  40. </view>
  41. </template>
  42. <script>
  43. export default {
  44. data() {
  45. return {
  46. listOneTow: ['一级推广','二级推广'],
  47. current: 0,
  48. member_list: [],
  49. userInfo: {},
  50. fans_userInfo: {},
  51. fansSize: 0,
  52. pageNo: 1,
  53. pageSize: 10,
  54. IMG_URL: '',
  55. total: null,
  56. isLock: false,
  57. }
  58. },
  59. onPullDownRefresh() {
  60. this.pageNo = 1,
  61. this.pageSize = 10,
  62. this.IMG_URL = '',
  63. this.total = null,
  64. this.isLock = false;
  65. this.fans_userInfo = {}
  66. this.member_list = []
  67. this.getFansList();
  68. },
  69. onReachBottom() {
  70. this.pageNo+=1;
  71. this.isLock = true;
  72. if(total!== null && this.pageNo * this.pageSize > this.total){
  73. this.$Toast('已经没有数据了')
  74. }
  75. if(this.isLock) {
  76. this.getFansList();
  77. }
  78. },
  79. onLoad() {
  80. this.userInfo = uni.getStorageSync("__user_info");
  81. this.IMG_URL = this.$IMG_URL;
  82. console.log(this.IMG_URL)
  83. this.getFansList();
  84. },
  85. methods: {
  86. getFansList() {
  87. // 获取粉丝列表
  88. uni.showLoading();
  89. const params = {
  90. pageNo: this.pageNo,
  91. pageSize: this.pageSize,
  92. type: this.current
  93. }
  94. this.$api('getFansList',params).then(res => {
  95. let { code, result, message} = res;
  96. uni.hideLoading();
  97. this.isLock = false;
  98. if(code == 200) {
  99. console.log(result)
  100. if(this.total == null) {
  101. this.total = result.fansInfoPage.total;
  102. // 将推广人的姓名截取
  103. if(result.pidUserInfo){
  104. if(result.pidUserInfo.nickName.length > 8){
  105. result.pidUserInfo.nickName = result.pidUserInfo.nickName.substr(0,8) + '...'
  106. }
  107. }
  108. if(result.pidUserInfo!==null){
  109. this.fans_userInfo = result.pidUserInfo;
  110. }
  111. this.fansSize = result.fansSize
  112. }
  113. this.member_list = this.member_list.concat(result.fansInfoPage.records)
  114. uni.stopPullDownRefresh()
  115. }else {
  116. this.$Toast(message);
  117. uni.stopPullDownRefresh()
  118. }
  119. }).catch(err => {
  120. this.isLock = false;
  121. uni.stopPullDownRefresh()
  122. this.$Toast(err.message)
  123. })
  124. },
  125. sectionChange(index){
  126. this.current = index;
  127. console.log(index,this.current);
  128. this.member_list = [];
  129. this.pageNo = 1;
  130. this.total = null;
  131. this.getFansList();
  132. },
  133. }
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. /deep/ .u-badge{
  138. padding: 0 !important;
  139. }
  140. .top_box{
  141. .chanmel_image{
  142. margin-top: 20rpx;
  143. display: flex;
  144. justify-content: center;
  145. image{
  146. width: 120rpx;
  147. height: 120rpx;
  148. border-radius: 8rpx;
  149. }
  150. }
  151. .title_box{
  152. display: flex;
  153. justify-content: space-around;
  154. font-size: 24rpx;
  155. color: #3B3B3B;
  156. margin-top: 24rpx;
  157. .left_text{
  158. // margin-left: 120rpx;
  159. font-size: 28rpx;
  160. }
  161. .right_text{
  162. // margin-right: 140rpx;
  163. font-size: 28rpx;
  164. }
  165. .left_text,
  166. .right_text{
  167. text{
  168. &:last-child{
  169. color: #E72A37;
  170. }
  171. }
  172. }
  173. }
  174. }
  175. .select_pic_video {
  176. display: flex;
  177. justify-content: center;
  178. align-items: center;
  179. margin-top: 28rpx;
  180. margin-bottom: 38rpx;
  181. background-color: #fff;
  182. border-radius: 30rpx;
  183. /deep/ .u-subsection {
  184. border-radius: 30rpx !important;
  185. width: 556rpx !important;
  186. height: 61rpx !important;
  187. .u-item {
  188. border: none !important;
  189. }
  190. .u-item-bg {
  191. background-color: #01AEEA !important;
  192. border-radius: 30rpx !important;
  193. color: #FFF;
  194. }
  195. }
  196. }
  197. .item_list_box{
  198. margin-top: 40rpx;
  199. }
  200. .item{
  201. position: relative;
  202. width: 686rpx;
  203. margin: 0 auto;
  204. padding-bottom: 5rpx;
  205. border-bottom: 1px solid #ECECEC;
  206. display: flex;
  207. align-items: center;
  208. margin-top: 20rpx;
  209. &:last-child{
  210. border-bottom: none;
  211. }
  212. image{
  213. width: 88rpx;
  214. height: 88rpx;
  215. margin-left: 36rpx;
  216. border-radius: 8rpx;
  217. }
  218. .item_text_box{
  219. flex: 1;
  220. font-size: 20rpx;
  221. color: #929292;
  222. margin-left: 16rpx;
  223. margin-right: 18rpx;
  224. display: flex;
  225. align-items: center;
  226. justify-content: space-between;
  227. .left_box{
  228. display: flex;
  229. flex-direction: column;
  230. font-size: 30rpx;
  231. }
  232. .img1{
  233. width: 140rpx;
  234. }
  235. .img2{
  236. width: 160rpx;
  237. }
  238. }
  239. }
  240. </style>