team.vue 8.9 KB

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