team.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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;">共{{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">保留绩效值:{{points2point(state.ancestor.residueSocial)}}</text>
  29. </view>
  30. <view class="time" style="width: 100%;color: #999;">
  31. <text>{{state.ancestor.socialStatusLevel || "等级1" }}</text> / <text>推荐人</text>
  32. <text style="float: right;">团队:{{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;">新增绩效值:{{points2point(item.residueSocial)}}</text>
  62. </view>
  63. <view class="time" style="width: 100%;color: #999">
  64. {{item.socialStatusLevel}} / <text>{{item.depth == 1?'直推人':''}}</text>
  65. <text style="float: right;">团队:{{item.descendantsCount}}人</text>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <s-empty v-else text="暂无团队成员" 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: '点击加载更多',
  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. const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
  101. const userInfo = computed(() => sheep.$store('user').userInfo);
  102. const sys_navBar = sheep.$platform.navbar;
  103. const state = reactive({
  104. currentTab: 0,
  105. pagination: {
  106. list: 0,
  107. total: 0,
  108. pageSize: 10,
  109. pageNo: 1,
  110. },
  111. loadStatus: '',
  112. descendants: {
  113. total: 0,
  114. list: []
  115. },
  116. teamCount: 0,
  117. ancestor: {
  118. }
  119. });
  120. const dateFilterText = computed(() => {
  121. if (state.date[0] === state.date[1]) {
  122. return state.date[0];
  123. } else {
  124. return state.date.join('~');
  125. }
  126. });
  127. async function getTeam() {
  128. state.loadStatus = 'loading';
  129. let {
  130. code,
  131. data
  132. } = await TeamApi.getTeam({
  133. pageNo: state.pagination.pageNo,
  134. pageSize: state.pagination.pageSize,
  135. });
  136. if (code !== 0) {
  137. return;
  138. }
  139. // 团队人员数量
  140. state.teamCount = data.teamCount
  141. // 直推人
  142. state.ancestor = data.ancestor
  143. let descendantsList = _.concat(state.descendants.list, data.descendants.list);
  144. // 后代
  145. state.descendants.list = descendantsList
  146. // console.log(state.descendants.list)
  147. // state.pagination.list = data.list;
  148. state.descendants.total = data.descendants.total;
  149. state.pagination.total = data.descendants.total;
  150. state.loadStatus = state.descendants.list.length < state.descendants.total ? 'more' : 'noMore';
  151. }
  152. onLoad(() => {
  153. state.today = dayjs().format('YYYY-MM-DD');
  154. state.date = [state.today, state.today];
  155. getTeam();
  156. });
  157. function loadMore() {
  158. if (state.loadStatus === 'noMore') {
  159. return;
  160. }
  161. state.pagination.pageNo++;
  162. getTeam();
  163. }
  164. onReachBottom(() => {
  165. loadMore();
  166. });
  167. </script>
  168. <style lang="scss" scoped>
  169. .score-box {
  170. margin: 20rpx;
  171. border-radius: 20rpx;
  172. padding-top: 100rpx;
  173. }
  174. .avatar-box {
  175. width: 100rpx;
  176. height: 100rpx;
  177. border-radius: 50%;
  178. overflow: hidden;
  179. border: 1px solid #eaeaea;
  180. .avatar-img {
  181. width: 100%;
  182. height: 100%;
  183. }
  184. }
  185. .value-box {
  186. width: 100rpx;
  187. height: 100rpx;
  188. line-height: 100rpx;
  189. text-align: center;
  190. border-radius: 50%;
  191. border: 2px solid #f6f6f6;
  192. }
  193. .btn {
  194. width: 300rpx;
  195. background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  196. border-radius: 20rpx;
  197. font-size: 30rpx;
  198. font-weight: 500;
  199. line-height: 80rpx;
  200. color: $white;
  201. position: relative;
  202. z-index: 1;
  203. }
  204. .header-box {
  205. width: 100%;
  206. background: linear-gradient(180deg, var(--ui-BG-Main) 0%, var(--ui-BG-Main-gradient) 100%) no-repeat;
  207. background-size: 750rpx 100%;
  208. padding: 0 0 120rpx 0;
  209. box-sizing: border-box;
  210. .score-box {
  211. height: 100%;
  212. .all-num {
  213. font-size: 50rpx;
  214. font-weight: bold;
  215. color: #fff;
  216. font-family: OPPOSANS;
  217. }
  218. .all-title {
  219. font-size: 26rpx;
  220. font-weight: 500;
  221. color: #fff;
  222. }
  223. .cicon-help-o {
  224. color: #fff;
  225. font-size: 28rpx;
  226. }
  227. }
  228. }
  229. // 筛选
  230. .filter-box {
  231. height: 114rpx;
  232. background-color: $bg-page;
  233. .total-box {
  234. font-size: 24rpx;
  235. font-weight: 500;
  236. color: $dark-9;
  237. }
  238. .date-btn {
  239. background-color: $white;
  240. line-height: 54rpx;
  241. border-radius: 27rpx;
  242. padding: 0 20rpx;
  243. font-size: 24rpx;
  244. font-weight: 500;
  245. color: $dark-6;
  246. .ss-seldate-icon {
  247. font-size: 50rpx;
  248. color: $dark-9;
  249. }
  250. }
  251. }
  252. .list-box {
  253. width: 500rpx;
  254. height: 600rpx;
  255. padding: 0 20rpx;
  256. overflow-y: auto;
  257. .list-item {
  258. background: #fff;
  259. // border-bottom: 1rpx solid #dfdfdf;
  260. padding: 30rpx;
  261. .name {
  262. font-size: 30rpx;
  263. font-weight: 500;
  264. color: rgba(102, 102, 102, 1);
  265. line-height: 30rpx;
  266. display: flex;
  267. align-items: center;
  268. justify-content: space-between;
  269. // margin-bottom: 20rpx;
  270. }
  271. .time {
  272. font-size: 24rpx;
  273. font-weight: 500;
  274. color: rgba(196, 196, 196, 1);
  275. line-height: 24px;
  276. }
  277. .add {
  278. font-size: 30rpx;
  279. font-weight: 500;
  280. color: #e6b873;
  281. }
  282. .minus {
  283. font-size: 30rpx;
  284. font-weight: 500;
  285. color: $dark-3;
  286. }
  287. }
  288. }
  289. </style>