team.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <!-- 我的佣金 -->
  2. <template>
  3. <s-layout class="wallet-wrap" :bgStyle="{'backgroundColor':'#ffffff'}" title="" navbar="normal">
  4. <view class="model-box ss-flex-col">
  5. <view class="all-title ss-p-x-45 ss-p-t-30">
  6. <text style="float: right;">{{ t('team.total_people',{count:state.teamCount}) }}</text>
  7. </view>
  8. <view class="list-box" style="width: 100%;padding: 0;height: calc(100vh - 7.5rem) ;">
  9. <!-- 推荐人 -->
  10. <view>
  11. <view class="list-item ss-flex ss-col-center ss-row-between "
  12. style="padding-top: 30rpx; padding-bottom: 0;">
  13. <view class="ss-flex ss-col-center"
  14. style="width: 100%;border-bottom: 1px solid #ededed;padding-bottom: 30rpx">
  15. <view>
  16. &nbsp;&nbsp;
  17. </view>
  18. <!-- 头像 -->
  19. <view class="avatar-box ss-m-x-20">
  20. <image class="avatar-img" :src="state.ancestor.avatar" mode="aspectFill"></image>
  21. </view>
  22. <view class="ss-flex ss-m-t-10"
  23. style="flex-direction: column;align-items: flex-start;width: calc(100% - 5.5rem);">
  24. <view class="name" style="width: 100%;">
  25. <text
  26. style="width:50%;display: inline-block;">{{ state.ancestor.username ||'昵称:'+state.ancestor.descNickName }}</text>
  27. <text class="time"
  28. style="float: right;color: #666666">{{ t('team.retain_performance') }}:{{points2point(state.ancestor.residueSocial)}}</text>
  29. </view>
  30. <view class="time" style="width: 100%;color: #999;">
  31. <text>{{state.ancestor.socialStatusLevel || "等级1" }}</text> / <text>{{t('team.referrer')}}</text>
  32. <text style="float: right;"> {{ t('team.team_count',{count:state.ancestor.descendantsCount}) }}</text>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <!-- 直推人和后代 -->
  39. <view>
  40. <scroll-view style="width: 100%;" scroll-y="true" @touchmove.stop>
  41. <view v-if="state.descendants.total > 0">
  42. <view class="list-item ss-flex ss-col-center ss-row-between "
  43. v-for="(item,index) in state.descendants.list" :key="item.id"
  44. style="padding-top: 30rpx ;padding-bottom: 0;">
  45. <view class="ss-flex ss-col-center"
  46. style="width: 100%;border-bottom: 1px solid #ededed;padding-bottom: 30rpx">
  47. <view>
  48. {{item.sort}}
  49. </view>
  50. <!-- 头像 -->
  51. <view class="avatar-box ss-m-x-20">
  52. <image class="avatar-img" :src="
  53. item.avatar || sheep.$url.static('/static/images/default_avatar.png')" mode="aspectFill"></image>
  54. </view>
  55. <view class="ss-flex ss-m-t-10"
  56. style="flex-direction: column;align-items: flex-start;width: calc(100% - 5.5rem);">
  57. <view class="name" style="width: 100%;">
  58. <text style="width:50%;display: inline-block;">
  59. {{ item.username || '昵称:'+ item.descNickName}}</text>
  60. <text class="time"
  61. style="float: right;color: #666666;">{{t('team.new_performance_value')}}:{{points2point(item.residueSocial)}}</text>
  62. </view>
  63. <view class="time" style="width: 100%;color: #999">
  64. {{item.socialStatusLevel}} / <text>{{item.depth == 1? t('team.direct_referral') :''}}</text>
  65. <text style="float: right;"> {{ t('team.team_count',{count:item.descendantsCount}) }}</text>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <s-empty v-else :text="t('team.no_team_members')" icon="/static/data-empty.png" />
  72. </scroll-view>
  73. </view>
  74. </view>
  75. </view>
  76. <uni-load-more v-if="state.descendants.total > 0" :status="state.loadStatus" :content-text="{
  77. contentdown: t('common.click_to_load_more'),
  78. }" @tap="loadMore" />
  79. </s-layout>
  80. </template>
  81. <script setup>
  82. import sheep from '@/sheep';
  83. import {
  84. onLoad,
  85. onReachBottom
  86. } from '@dcloudio/uni-app';
  87. import {
  88. computed,
  89. reactive
  90. } from 'vue';
  91. import _ from 'lodash';
  92. import dayjs from 'dayjs';
  93. import TeamApi from '@/sheep/api/distri/team';
  94. import {
  95. resetPagination
  96. } from '@/sheep/util';
  97. import {
  98. points2point
  99. } from '@/sheep/hooks/useGoods';
  100. import { t } from '@/locale'
  101. const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
  102. const userInfo = computed(() => sheep.$store('user').userInfo);
  103. const sys_navBar = sheep.$platform.navbar;
  104. const state = reactive({
  105. currentTab: 0,
  106. pagination: {
  107. list: 0,
  108. total: 0,
  109. pageSize: 10,
  110. pageNo: 1,
  111. },
  112. loadStatus: '',
  113. descendants: {
  114. total: 0,
  115. list: []
  116. },
  117. teamCount: 0,
  118. ancestor: {
  119. }
  120. });
  121. const dateFilterText = computed(() => {
  122. if (state.date[0] === state.date[1]) {
  123. return state.date[0];
  124. } else {
  125. return state.date.join('~');
  126. }
  127. });
  128. async function getTeam() {
  129. state.loadStatus = 'loading';
  130. let {
  131. code,
  132. data
  133. } = await TeamApi.getTeam({
  134. pageNo: state.pagination.pageNo,
  135. pageSize: state.pagination.pageSize,
  136. });
  137. if (code !== 0) {
  138. return;
  139. }
  140. // 团队人员数量
  141. state.teamCount = data.teamCount
  142. // 直推人
  143. state.ancestor = data.ancestor
  144. let descendantsList = _.concat(state.descendants.list, data.descendants.list);
  145. // 后代
  146. state.descendants.list = descendantsList
  147. // console.log(state.descendants.list)
  148. // state.pagination.list = data.list;
  149. state.descendants.total = data.descendants.total;
  150. state.pagination.total = data.descendants.total;
  151. state.loadStatus = state.descendants.list.length < state.descendants.total ? 'more' : 'noMore';
  152. }
  153. onLoad(() => {
  154. state.today = dayjs().format('YYYY-MM-DD');
  155. state.date = [state.today, state.today];
  156. getTeam();
  157. });
  158. function loadMore() {
  159. if (state.loadStatus === 'noMore') {
  160. return;
  161. }
  162. state.pagination.pageNo++;
  163. getTeam();
  164. }
  165. onReachBottom(() => {
  166. loadMore();
  167. });
  168. </script>
  169. <style lang="scss" scoped>
  170. .score-box {
  171. margin: 20rpx;
  172. border-radius: 20rpx;
  173. padding-top: 100rpx;
  174. }
  175. .avatar-box {
  176. width: 100rpx;
  177. height: 100rpx;
  178. border-radius: 50%;
  179. overflow: hidden;
  180. border: 1px solid #eaeaea;
  181. .avatar-img {
  182. width: 100%;
  183. height: 100%;
  184. }
  185. }
  186. .value-box {
  187. width: 100rpx;
  188. height: 100rpx;
  189. line-height: 100rpx;
  190. text-align: center;
  191. border-radius: 50%;
  192. border: 2px solid #f6f6f6;
  193. }
  194. .btn {
  195. width: 300rpx;
  196. background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  197. border-radius: 20rpx;
  198. font-size: 30rpx;
  199. font-weight: 500;
  200. line-height: 80rpx;
  201. color: $white;
  202. position: relative;
  203. z-index: 1;
  204. }
  205. .header-box {
  206. width: 100%;
  207. background: linear-gradient(180deg, var(--ui-BG-Main) 0%, var(--ui-BG-Main-gradient) 100%) no-repeat;
  208. background-size: 750rpx 100%;
  209. padding: 0 0 120rpx 0;
  210. box-sizing: border-box;
  211. .score-box {
  212. height: 100%;
  213. .all-num {
  214. font-size: 50rpx;
  215. font-weight: bold;
  216. color: #fff;
  217. font-family: OPPOSANS;
  218. }
  219. .all-title {
  220. font-size: 26rpx;
  221. font-weight: 500;
  222. color: #fff;
  223. }
  224. .cicon-help-o {
  225. color: #fff;
  226. font-size: 28rpx;
  227. }
  228. }
  229. }
  230. // 筛选
  231. .filter-box {
  232. height: 114rpx;
  233. background-color: $bg-page;
  234. .total-box {
  235. font-size: 24rpx;
  236. font-weight: 500;
  237. color: $dark-9;
  238. }
  239. .date-btn {
  240. background-color: $white;
  241. line-height: 54rpx;
  242. border-radius: 27rpx;
  243. padding: 0 20rpx;
  244. font-size: 24rpx;
  245. font-weight: 500;
  246. color: $dark-6;
  247. .ss-seldate-icon {
  248. font-size: 50rpx;
  249. color: $dark-9;
  250. }
  251. }
  252. }
  253. .list-box {
  254. width: 500rpx;
  255. height: 600rpx;
  256. padding: 0 20rpx;
  257. overflow-y: auto;
  258. .list-item {
  259. background: #fff;
  260. // border-bottom: 1rpx solid #dfdfdf;
  261. padding: 30rpx;
  262. .name {
  263. font-size: 30rpx;
  264. font-weight: 500;
  265. color: rgba(102, 102, 102, 1);
  266. line-height: 30rpx;
  267. display: flex;
  268. align-items: center;
  269. justify-content: space-between;
  270. // margin-bottom: 20rpx;
  271. }
  272. .time {
  273. font-size: 24rpx;
  274. font-weight: 500;
  275. color: rgba(196, 196, 196, 1);
  276. line-height: 24px;
  277. }
  278. .add {
  279. font-size: 30rpx;
  280. font-weight: 500;
  281. color: #e6b873;
  282. }
  283. .minus {
  284. font-size: 30rpx;
  285. font-weight: 500;
  286. color: $dark-3;
  287. }
  288. }
  289. }
  290. </style>