team.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <!-- 页面 TODO 芋艿:检查未开发 -->
  2. <template>
  3. <s-layout title="我的团队" :class="state.scrollTop ? 'team-wrap' : ''" navbar="inner">
  4. <view class="header-box" :style="[
  5. {
  6. marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
  7. paddingTop: Number(statusBarHeight + 108) + 'rpx',
  8. },
  9. ]">
  10. <!-- 推荐人 -->
  11. <view v-if="userInfo.parent_user" class="referrer-box ss-flex ss-col-center">
  12. 推荐人:
  13. <image class="referrer-avatar ss-m-r-10" :src="sheep.$url.cdn(userInfo.parent_user.avatar)"
  14. mode="aspectFill">
  15. </image>
  16. {{ userInfo.parent_user.nickname }}
  17. </view>
  18. <!-- 团队数据总览 -->
  19. <view class="team-data-box ss-flex ss-col-center ss-row-between">
  20. <view class="data-card">
  21. <view class="total-item">
  22. <view class="item-title">团队总人数(人)</view>
  23. <view class="total-num">
  24. {{ (state.getSummary.firstBrokerageUserCount+ state.getSummary.secondBrokerageUserCount)|| 0 }}
  25. </view>
  26. </view>
  27. <view class="category-item ss-flex">
  28. <view class="ss-flex-1">
  29. <view class="item-title">一级成员</view>
  30. <view class="category-num">{{ state.getSummary.firstBrokerageUserCount || 0 }}</view>
  31. </view>
  32. <view class="ss-flex-1">
  33. <view class="item-title">二级成员</view>
  34. <view class="category-num">{{ state.getSummary.secondBrokerageUserCount || 0 }}</view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="data-card">
  39. <view class="total-item">
  40. <view class="item-title">团队分销商人数(人)</view>
  41. <view class="total-num">{{ agentInfo.child_agent_count_all || 0 }}</view>
  42. </view>
  43. <view class="category-item ss-flex">
  44. <view class="ss-flex-1">
  45. <view class="item-title">一级分销商</view>
  46. <view class="category-num">{{ agentInfo.child_agent_count_1 || 0 }}</view>
  47. </view>
  48. <view class="ss-flex-1">
  49. <view class="item-title">二级分销商</view>
  50. <view class="category-num">{{ agentInfo.child_agent_count_2 || 0 }}</view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="list-box">
  57. <uni-list :border="false">
  58. <uni-list-chat v-for="item in state.pagination.data" :key="item.id" :avatar-circle="true"
  59. :title="item.nickname" :avatar="sheep.$url.cdn(item.avatar)"
  60. :note="filterUserNum(item.agent?.child_user_count_1)">
  61. <view class="chat-custom-right">
  62. <view v-if="item.avatar" class="tag-box ss-flex ss-col-center">
  63. <image class="tag-img" :src="sheep.$url.cdn(item.avatar)" mode="aspectFill">
  64. </image>
  65. <text class="tag-title">{{ item.nickname }}</text>
  66. </view>
  67. <text
  68. class="time-text">{{ sheep.$helper.timeFormat(item.brokerageTime, 'yyyy-mm-dd hh:MM:ss') }}</text>
  69. </view>
  70. </uni-list-chat>
  71. </uni-list>
  72. </view>
  73. <s-empty v-if="state.pagination.total === 0" icon="/static/data-empty.png" text="暂无团队信息">
  74. </s-empty>
  75. </s-layout>
  76. </template>
  77. <script setup>
  78. import sheep from '@/sheep';
  79. import {
  80. onLoad,
  81. onReachBottom
  82. } from '@dcloudio/uni-app';
  83. import {
  84. computed,
  85. reactive
  86. } from 'vue';
  87. import _ from 'lodash';
  88. import {
  89. onPageScroll
  90. } from '@dcloudio/uni-app';
  91. const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
  92. const agentInfo = computed(() => sheep.$store('user').agentInfo);
  93. const userInfo = computed(() => sheep.$store('user').userInfo);
  94. const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
  95. onPageScroll((e) => {
  96. if (e.scrollTop > 100) {
  97. state.scrollTop = false;
  98. } else {
  99. state.scrollTop = true;
  100. }
  101. });
  102. const state = reactive({
  103. getSummary: {},
  104. pagination: {
  105. data: [],
  106. current_page: 1,
  107. total: 1,
  108. last_page: 1,
  109. },
  110. loadStatus: '',
  111. });
  112. function filterUserNum(num) {
  113. if (_.isNil(num)) {
  114. return '';
  115. }
  116. return `下级团队${num}人`;
  117. }
  118. async function getTeamList(page = 1, list_rows = 8) {
  119. state.loadStatus = 'loading';
  120. // nickname: this.nickname,
  121. let res = await sheep.$api.commission.team({
  122. pageSize: list_rows,
  123. pageNo: page,
  124. level: '1',
  125. 'sortingField.order': 'desc',
  126. 'sortingField.field': 'userCount',
  127. nickname: ''
  128. });
  129. console.log(res, '分销团队列表');
  130. if (res.code === 0) {
  131. let orderList = _.concat(state.pagination.data, res.data.list);
  132. state.pagination = {
  133. ...res.data,
  134. data: orderList,
  135. };
  136. if (state.pagination.data.length < state.pagination.total) {
  137. state.loadStatus = 'more';
  138. } else {
  139. state.loadStatus = 'noMore';
  140. }
  141. }
  142. }
  143. onLoad(async () => {
  144. getTeamList();
  145. let res = await sheep.$api.commission.getSummary();
  146. state.getSummary = res.data;
  147. });
  148. // 加载更多
  149. function loadmore() {
  150. if (state.loadStatus !== 'noMore') {
  151. getTeamList(state.pagination.current_page + 1);
  152. }
  153. }
  154. // 上拉加载更多
  155. onReachBottom(() => {
  156. loadmore();
  157. });
  158. </script>
  159. <style lang="scss" scoped>
  160. .header-box {
  161. box-sizing: border-box;
  162. padding: 0 20rpx 20rpx 20rpx;
  163. width: 750rpx;
  164. z-index: 3;
  165. position: relative;
  166. background: v-bind(headerBg) no-repeat,
  167. linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  168. background-size: 750rpx 100%;
  169. // 团队信息总览
  170. .team-data-box {
  171. .data-card {
  172. width: 305rpx;
  173. background: #ffffff;
  174. border-radius: 20rpx;
  175. padding: 20rpx;
  176. .item-title {
  177. font-size: 22rpx;
  178. font-weight: 500;
  179. color: #999999;
  180. line-height: 30rpx;
  181. margin-bottom: 10rpx;
  182. }
  183. .total-item {
  184. margin-bottom: 30rpx;
  185. }
  186. .total-num {
  187. font-size: 38rpx;
  188. font-weight: 500;
  189. color: #333333;
  190. font-family: OPPOSANS;
  191. }
  192. .category-num {
  193. font-size: 26rpx;
  194. font-weight: 500;
  195. color: #333333;
  196. font-family: OPPOSANS;
  197. }
  198. }
  199. }
  200. }
  201. .list-box {
  202. z-index: 3;
  203. position: relative;
  204. }
  205. .chat-custom-right {
  206. .time-text {
  207. font-size: 22rpx;
  208. font-weight: 400;
  209. color: #999999;
  210. }
  211. .tag-box {
  212. background: rgba(0, 0, 0, 0.2);
  213. border-radius: 21rpx;
  214. line-height: 30rpx;
  215. padding: 5rpx 10rpx;
  216. width: 140rpx;
  217. .tag-img {
  218. width: 34rpx;
  219. height: 34rpx;
  220. margin-right: 6rpx;
  221. border-radius: 50%;
  222. }
  223. .tag-title {
  224. font-size: 18rpx;
  225. font-weight: 500;
  226. color: rgba(255, 255, 255, 1);
  227. line-height: 20rpx;
  228. }
  229. }
  230. }
  231. // 推荐人
  232. .referrer-box {
  233. font-size: 28rpx;
  234. font-weight: 500;
  235. color: #ffffff;
  236. padding: 20rpx;
  237. .referrer-avatar {
  238. width: 34rpx;
  239. height: 34rpx;
  240. border-radius: 50%;
  241. }
  242. }
  243. </style>