index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view class="user_directPartner">
  3. <view class="integral-details" :style="colorStyle">
  4. <!-- <view class='header'>
  5. <view class='currentScore'>{{$t(`当前红色积分`)}}</view>
  6. <view class="scoreNum">{{userInfo.integral}}</view>
  7. <view class='line'></view>
  8. </view> -->
  9. <view class="wrapper">
  10. <view class="list" :hidden="current != 0">
  11. <view
  12. class="item acea-row row-between-wrapper"
  13. v-for="(item, index) in integralList"
  14. :key="index"
  15. >
  16. <view class="left">
  17. <view class="state">
  18. <view class="order">{{ index + 1 }}</view>
  19. <img :src="item.avatar" alt="" />
  20. <view class="s-r">
  21. <text>
  22. {{ item.userName }}
  23. </text>
  24. <text>
  25. {{ item.account }}
  26. </text>
  27. </view>
  28. </view>
  29. <!-- <view class="text-info">推荐人 : &nbsp; {{ item.recommendName }}</view> -->
  30. <view class="text-info">推荐时间 : &nbsp; {{ item.createTime }}</view>
  31. </view>
  32. <view class="right">
  33. <view class="num font-color"> </view>
  34. <!-- <view class="text-info">贡献人 :&nbsp; {{ item.parentName }}</view>
  35. <view class="text-info">贡献时间 :&nbsp; {{ item.contributeTime }}</view> -->
  36. </view>
  37. </view>
  38. <view
  39. class="loadingicon acea-row row-center-wrapper"
  40. v-if="integralList.length > 0"
  41. >
  42. <text
  43. class="loading iconfont icon-jiazai"
  44. :hidden="loading == false"
  45. ></text
  46. >{{ loadTitle }}
  47. </view>
  48. <view v-if="integralList.length == 0">
  49. <emptyPage :title="$t(`暂无收益记录哦~`)"></emptyPage>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import {
  58. linkedUserList
  59. } from '@/api/home.js';
  60. import dayjs from '@/plugin/dayjs/dayjs.min.js';
  61. import {
  62. toLogin
  63. } from '@/libs/login.js';
  64. import {
  65. mapGetters
  66. } from "vuex";
  67. // #ifdef MP
  68. import authorize from '@/components/Authorize';
  69. // #endif
  70. import emptyPage from '@/components/emptyPage.vue';
  71. import colors from '@/mixins/color'
  72. export default {
  73. components: {
  74. // #ifdef MP
  75. authorize,
  76. // #endif
  77. emptyPage
  78. },
  79. filters: {
  80. dateFormat: function (value) {
  81. return dayjs(value * 1000).format('YYYY-MM-DD');
  82. }
  83. },
  84. mixins: [colors],
  85. data () {
  86. return {
  87. current: 0,
  88. page: 1,
  89. limit: 10,
  90. integralList: [],
  91. userInfo: {},
  92. loadend: false,
  93. loading: false,
  94. loadTitle: this.$t(`加载更多`),
  95. isAuto: false, //没有授权的不会自动授权
  96. isShowAuth: false, //是否隐藏授权
  97. isTime: 0
  98. };
  99. },
  100. computed: mapGetters(['isLogin']),
  101. watch: {
  102. isLogin: {
  103. handler: function (newV, oldV) {
  104. if (newV) {
  105. // this.getUserInfo();
  106. this.linkedUserList();
  107. }
  108. },
  109. deep: true
  110. }
  111. },
  112. onLoad () {
  113. if (this.isLogin) {
  114. // this.getUserInfo();
  115. this.getIntegralList();
  116. } else {
  117. toLogin();
  118. }
  119. },
  120. /**
  121. * 页面上拉触底事件的处理函数
  122. */
  123. onReachBottom: function () {
  124. this.getIntegralList();
  125. },
  126. methods: {
  127. /**
  128. * 授权回调
  129. */
  130. onLoadFun: function () {
  131. this.getUserInfo();
  132. this.getIntegralList();
  133. },
  134. // 授权关闭
  135. authColse: function (e) {
  136. this.isShowAuth = e
  137. },
  138. /**
  139. * 获取积分明细
  140. */
  141. getIntegralList: function () {
  142. let that = this;
  143. if (that.loading) return;
  144. if (that.loadend) return;
  145. that.loading = true;
  146. that.loadTitle = '';
  147. linkedUserList({
  148. userId: this.$store.state.app.uid,
  149. current: that.page,
  150. size: that.limit
  151. }).then(function (res) {
  152. let list = res.data,
  153. loadend = list.length < that.limit;
  154. that.integralList = that.$util.SplitArray(list, that.integralList);
  155. that.$set(that, 'integralList', that.integralList);
  156. that.page = that.page + 1;
  157. that.loading = false;
  158. that.loadend = loadend;
  159. that.loadTitle = loadend ? that.$t(`我也是有底线的`) : that.$t(`加载更多`);
  160. }, function (res) {
  161. this.loading = false;
  162. that.loadTitle = that.$t(`加载更多`);
  163. });
  164. },
  165. nav: function (current) {
  166. this.current = current;
  167. }
  168. }
  169. }
  170. </script>
  171. <style lang="scss">
  172. .user_directPartner {
  173. .text-info{
  174. color: #999999;
  175. margin-top: 5rpx;
  176. }
  177. .list {
  178. .item {
  179. line-height: 50rpx;
  180. padding: 30rpx;
  181. background: white;
  182. .left {
  183. .state {
  184. height: 100rpx;
  185. .order {
  186. margin: auto 0;
  187. text-align: center;
  188. width: 50rpx;
  189. height: 50rpx;
  190. line-height: 50rpx;
  191. background: rgb(200, 153, 75);
  192. color: white;
  193. border-radius: 50%;
  194. }
  195. display: flex;
  196. image {
  197. margin-left: 30rpx;
  198. margin-right: 30rpx;
  199. width: 100rpx;
  200. height: 100rpx;
  201. border-radius: 50%;
  202. overflow: hidden;
  203. }
  204. .s-r {
  205. font-size: 34rpx;
  206. display: flex;
  207. flex-direction: column;
  208. }
  209. }
  210. }
  211. .right{
  212. .num{
  213. height: 100rpx;
  214. }
  215. }
  216. }
  217. }
  218. }
  219. </style>