team.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. <!-- 页面 TODO 芋艿:检查未开发 -->
  2. <template>
  3. <s-layout title="我的团队" :class="state.scrollTop ? 'team-wrap' : ''" navbar="inner">
  4. <view class="promoter-list">
  5. <view class='promoterHeader bg-color' style='backgroundColor:#e93323!important;height:218rpx;color:#fff'>
  6. <view class='headerCon acea-row row-between' style='padding: 28px 29px 0 29px;'>
  7. <view>
  8. <view class='name' style="color:#fff">推广人数</view>
  9. <view><text class='num'
  10. style="color:#fff">{{(state.getSummary.firstBrokerageUserCount+ state.getSummary.secondBrokerageUserCount)|| 0 }}</text>人
  11. </view>
  12. </view>
  13. <view class='iconfont icon-tuandui'></view>
  14. </view>
  15. </view>
  16. <view style='padding: 0 30rpx;'>
  17. <view class='nav acea-row row-around l1'>
  18. <view :class="state.level == 1 ? 'item on' : 'item'" @click='setType(1)'>
  19. 一级({{state.getSummary.firstBrokerageUserCount || 0 }})</view>
  20. <view :class="state.level == 2 ? 'item on' : 'item'" @click='setType(2)'>
  21. 二级({{state.getSummary.secondBrokerageUserCount || 0 }})
  22. </view>
  23. </view>
  24. <view class='search acea-row row-between-wrapper'
  25. style="display: flex;height: 100rpx;align-items: center;">
  26. <view class='input'>
  27. <input placeholder='点击搜索会员名称' v-model="state.nickname" confirm-type='search' name="search"
  28. @confirm="submitForm" />
  29. </view>
  30. <image src="/static/images/search.png" mode="" style='width: 60rpx;height: 64rpx;' @click="submitForm"></image>
  31. </view>
  32. <view class='list'>
  33. <view class="sortNav acea-row row-middle" style="display: flex;align-items: center;">
  34. <view class="sortItem" @click='setSort("userCount","asc")' v-if="sort === 'userCountDESC'">
  35. 团队排序
  36. <image src='/static/images/sort1.png'></image>
  37. </view>
  38. <view class="sortItem" @click='setSort("userCount", "desc")'
  39. v-else-if="sort === 'userCountASC'">团队排序
  40. <image src='/static/images/sort3.png'></image>
  41. </view>
  42. <view class="sortItem" @click='setSort("userCount","desc")' v-else>团队排序
  43. <image src='/static/images/sort2.png'></image>
  44. </view>
  45. <view class="sortItem" @click='setSort("price","asc")' v-if="sort === 'priceDESC'">
  46. 金额排序
  47. <image src='/static/images/sort1.png'></image>
  48. </view>
  49. <view class="sortItem" @click='setSort("price", "desc")' v-else-if="sort === 'priceASC'">
  50. 金额排序
  51. <image src='/static/images/sort3.png'></image>
  52. </view>
  53. <view class="sortItem" @click='setSort("price","desc")' v-else>金额排序
  54. <image src='/static/images/sort2.png'></image>
  55. </view>
  56. <view class="sortItem" @click='setSort("orderCount","asc")' v-if="sort === 'orderCountDESC'">
  57. 订单排序
  58. <image src='/static/images/sort1.png'></image>
  59. </view>
  60. <view class="sortItem" @click='setSort("orderCount", "desc")'
  61. v-else-if="sort === 'orderCountASC'">订单排序
  62. <image src='/static/images/sort3.png'></image>
  63. </view>
  64. <view class="sortItem" @click='setSort("orderCount","desc")' v-else>订单排序
  65. <image src='/static/images/sort2.png'></image>
  66. </view>
  67. </view>
  68. <block v-for="(item,index) in state.pagination.data" :key="index">
  69. <view class='item acea-row row-between-wrapper' style="display: flex;">
  70. <view class="picTxt acea-row row-between-wrapper" style="display: flex;align-items: center;">
  71. <view class='pictrue'>
  72. <image :src='item.avatar'></image>
  73. </view>
  74. <view class='text'>
  75. <view class='name line1'>{{item.nickname}}</view>
  76. <view>加入时间: {{ sheep.$helper.timeFormat(item.brokerageTime, 'yyyy-mm-dd hh:MM:ss') }}</view>
  77. </view>
  78. </view>
  79. <view class="right" style='justify-content:center;flex-direction: column;display: flex;margin-left: auto;'>
  80. <view><text class='num font-color'>{{ item.brokerageUserCount || 0}}</text>人
  81. </view>
  82. <view><text class="num">{{ item.orderCount|| 0}}</text>单</view>
  83. <view><text class="num">{{ item.brokeragePrice || 0 }}</text>元</view>
  84. </view>
  85. </view>
  86. </block>
  87. <block v-if="state.pagination.data.length == 0">
  88. <view style='text-align: center;'>暂无推广人数</view>
  89. </block>
  90. </view>
  91. </view>
  92. </view>
  93. <!-- <home></home> -->
  94. <!-- <view class="header-box" :style="[
  95. {
  96. marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
  97. paddingTop: Number(statusBarHeight + 108) + 'rpx',
  98. },
  99. ]">
  100. <view v-if="userInfo.parent_user" class="referrer-box ss-flex ss-col-center">
  101. 推荐人:
  102. <image class="referrer-avatar ss-m-r-10" :src="sheep.$url.cdn(userInfo.parent_user.avatar)"
  103. mode="aspectFill">
  104. </image>
  105. {{ userInfo.parent_user.nickname }}
  106. </view>
  107. <view class="team-data-box ss-flex ss-col-center ss-row-between">
  108. <view class="data-card">
  109. <view class="total-item">
  110. <view class="item-title">团队总人数(人)</view>
  111. <view class="total-num">
  112. {{ (state.getSummary.firstBrokerageUserCount+ state.getSummary.secondBrokerageUserCount)|| 0 }}
  113. </view>
  114. </view>
  115. <view class="category-item ss-flex">
  116. <view class="ss-flex-1">
  117. <view class="item-title">一级成员</view>
  118. <view class="category-num">{{ state.getSummary.firstBrokerageUserCount || 0 }}</view>
  119. </view>
  120. <view class="ss-flex-1">
  121. <view class="item-title">二级成员</view>
  122. <view class="category-num">{{ state.getSummary.secondBrokerageUserCount || 0 }}</view>
  123. </view>
  124. </view>
  125. </view>
  126. <view class="data-card">
  127. <view class="total-item">
  128. <view class="item-title">团队分销商人数(人)</view>
  129. <view class="total-num">{{ agentInfo?.child_agent_count_all || 0 }}</view>
  130. </view>
  131. <view class="category-item ss-flex">
  132. <view class="ss-flex-1">
  133. <view class="item-title">一级分销商</view>
  134. <view class="category-num">{{ agentInfo?.child_agent_count_1 || 0 }}</view>
  135. </view>
  136. <view class="ss-flex-1">
  137. <view class="item-title">二级分销商</view>
  138. <view class="category-num">{{ agentInfo?.child_agent_count_2 || 0 }}</view>
  139. </view>
  140. </view>
  141. </view>
  142. </view>
  143. </view>
  144. <view class="list-box">
  145. <uni-list :border="false">
  146. <uni-list-chat v-for="item in state.pagination.data" :key="item.id" :avatar-circle="true"
  147. :title="item.nickname" :avatar="sheep.$url.cdn(item.avatar)"
  148. :note="filterUserNum(item.agent?.child_user_count_1)">
  149. <view class="chat-custom-right">
  150. <view v-if="item.avatar" class="tag-box ss-flex ss-col-center">
  151. <image class="tag-img" :src="sheep.$url.cdn(item.avatar)" mode="aspectFill">
  152. </image>
  153. <text class="tag-title">{{ item.nickname }}</text>
  154. </view>
  155. <text
  156. class="time-text">{{ sheep.$helper.timeFormat(item.brokerageTime, 'yyyy-mm-dd hh:MM:ss') }}</text>
  157. </view>
  158. </uni-list-chat>
  159. </uni-list>
  160. </view>
  161. <s-empty v-if="state.pagination.total === 0" icon="/static/data-empty.png" text="暂无团队信息">
  162. </s-empty> -->
  163. </s-layout>
  164. </template>
  165. <script setup>
  166. import sheep from '@/sheep';
  167. import {
  168. onLoad,
  169. onReachBottom
  170. } from '@dcloudio/uni-app';
  171. import {
  172. computed,
  173. reactive,
  174. ref
  175. } from 'vue';
  176. import _ from 'lodash';
  177. import {
  178. onPageScroll
  179. } from '@dcloudio/uni-app';
  180. const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
  181. const agentInfo = computed(() => sheep.$store('user').agentInfo);
  182. const userInfo = computed(() => sheep.$store('user').userInfo);
  183. const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
  184. onPageScroll((e) => {
  185. if (e.scrollTop > 100) {
  186. state.scrollTop = false;
  187. } else {
  188. state.scrollTop = true;
  189. }
  190. });
  191. let sort=ref();
  192. const state = reactive({
  193. getSummary: {},
  194. pagination: {
  195. data: [],
  196. current_page: 1,
  197. total: 1,
  198. last_page: 1,
  199. },
  200. loadStatus: '',
  201. // ↓新ui逻辑
  202. level: 1,
  203. nickname: ref(''),
  204. sortKey:'',
  205. isAsc:''
  206. });
  207. function filterUserNum(num) {
  208. if (_.isNil(num)) {
  209. return '';
  210. }
  211. return `下级团队${num}人`;
  212. }
  213. function submitForm() {
  214. state.pagination.data = []
  215. getTeamList();
  216. }
  217. async function getTeamList(page = 1, list_rows = 8) {
  218. state.loadStatus = 'loading';
  219. // nickname: this.nickname,
  220. let res = await sheep.$api.commission.team({
  221. pageSize: list_rows,
  222. pageNo: page,
  223. level: state.level,
  224. 'sortingField.order': 'desc',
  225. 'sortingField.field': 'userCount',
  226. nickname: state.nickname
  227. });
  228. console.log(res, '分销团队列表');
  229. if (res.code === 0) {
  230. let orderList = _.concat(state.pagination.data, res.data.list);
  231. state.pagination = {
  232. ...res.data,
  233. data: orderList,
  234. };
  235. if (state.pagination.data.length < state.pagination.total) {
  236. state.loadStatus = 'more';
  237. } else {
  238. state.loadStatus = 'noMore';
  239. }
  240. }
  241. }
  242. function setType(e) {
  243. state.pagination.data = []
  244. state.level = e + '';
  245. getTeamList( )
  246. }
  247. function setSort(sortKey, isAsc) {
  248. state.pagination.data = []
  249. sort = sortKey + isAsc.toUpperCase();
  250. state.isAsc=isAsc;
  251. state.sortKey=sortKey;
  252. getTeamList();
  253. }
  254. onLoad(async () => {
  255. getTeamList();
  256. let res = await sheep.$api.commission.getSummary();
  257. state.getSummary = res.data;
  258. });
  259. // 加载更多
  260. function loadmore() {
  261. if (state.loadStatus !== 'noMore') {
  262. getTeamList(state.pagination.current_page + 1);
  263. }
  264. }
  265. // 上拉加载更多
  266. onReachBottom(() => {
  267. loadmore();
  268. });
  269. </script>
  270. <style lang="scss" scoped>
  271. .l1 {
  272. background-color: #fff;
  273. height: 86rpx;
  274. line-height: 86rpx;
  275. font-size: 28rpx;
  276. color: #282828;
  277. border-bottom: 1rpx solid #eee;
  278. border-top-left-radius: 14rpx;
  279. border-top-right-radius: 14rpx;
  280. display: flex;
  281. justify-content: space-around;
  282. }
  283. .header-box {
  284. box-sizing: border-box;
  285. padding: 0 20rpx 20rpx 20rpx;
  286. width: 750rpx;
  287. z-index: 3;
  288. position: relative;
  289. background: v-bind(headerBg) no-repeat,
  290. linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  291. background-size: 750rpx 100%;
  292. // 团队信息总览
  293. .team-data-box {
  294. .data-card {
  295. width: 305rpx;
  296. background: #ffffff;
  297. border-radius: 20rpx;
  298. padding: 20rpx;
  299. .item-title {
  300. font-size: 22rpx;
  301. font-weight: 500;
  302. color: #999999;
  303. line-height: 30rpx;
  304. margin-bottom: 10rpx;
  305. }
  306. .total-item {
  307. margin-bottom: 30rpx;
  308. }
  309. .total-num {
  310. font-size: 38rpx;
  311. font-weight: 500;
  312. color: #333333;
  313. font-family: OPPOSANS;
  314. }
  315. .category-num {
  316. font-size: 26rpx;
  317. font-weight: 500;
  318. color: #333333;
  319. font-family: OPPOSANS;
  320. }
  321. }
  322. }
  323. }
  324. .list-box {
  325. z-index: 3;
  326. position: relative;
  327. }
  328. .chat-custom-right {
  329. .time-text {
  330. font-size: 22rpx;
  331. font-weight: 400;
  332. color: #999999;
  333. }
  334. .tag-box {
  335. background: rgba(0, 0, 0, 0.2);
  336. border-radius: 21rpx;
  337. line-height: 30rpx;
  338. padding: 5rpx 10rpx;
  339. width: 140rpx;
  340. .tag-img {
  341. width: 34rpx;
  342. height: 34rpx;
  343. margin-right: 6rpx;
  344. border-radius: 50%;
  345. }
  346. .tag-title {
  347. font-size: 18rpx;
  348. font-weight: 500;
  349. color: rgba(255, 255, 255, 1);
  350. line-height: 20rpx;
  351. }
  352. }
  353. }
  354. // 推荐人
  355. .referrer-box {
  356. font-size: 28rpx;
  357. font-weight: 500;
  358. color: #ffffff;
  359. padding: 20rpx;
  360. .referrer-avatar {
  361. width: 34rpx;
  362. height: 34rpx;
  363. border-radius: 50%;
  364. }
  365. }
  366. .promoter-list .nav {
  367. background-color: #fff;
  368. height: 86rpx;
  369. line-height: 86rpx;
  370. font-size: 28rpx;
  371. color: #282828;
  372. border-bottom: 1rpx solid #eee;
  373. border-top-left-radius: 14rpx;
  374. border-top-right-radius: 14rpx;
  375. margin-top: -30rpx;
  376. }
  377. .promoter-list .nav .item.on {
  378. border-bottom: 5rpx solid;
  379. // $theme-color
  380. color: red;
  381. // $theme-color
  382. }
  383. .promoter-list .search {
  384. width: 100%;
  385. background-color: #fff;
  386. height: 100rpx;
  387. padding: 0 24rpx;
  388. box-sizing: border-box;
  389. border-bottom-left-radius: 14rpx;
  390. border-bottom-right-radius: 14rpx;
  391. }
  392. .promoter-list .search .input {
  393. width: 592rpx;
  394. height: 60rpx;
  395. border-radius: 50rpx;
  396. background-color: #f5f5f5;
  397. text-align: center;
  398. position: relative;
  399. }
  400. .promoter-list .search .input input {
  401. height: 100%;
  402. font-size: 26rpx;
  403. width: 610rpx;
  404. text-align: center;
  405. }
  406. .promoter-list .search .input .placeholder {
  407. color: #bbb;
  408. }
  409. .promoter-list .search .input .iconfont {
  410. position: absolute;
  411. right: 28rpx;
  412. color: #999;
  413. font-size: 28rpx;
  414. top: 50%;
  415. transform: translateY(-50%);
  416. }
  417. .promoter-list .search .iconfont {
  418. font-size: 32rpx;
  419. color: #515151;
  420. height: 60rpx;
  421. line-height: 60rpx;
  422. }
  423. .promoter-list .list {
  424. margin-top: 20rpx;
  425. }
  426. .promoter-list .list .sortNav {
  427. background-color: #fff;
  428. height: 76rpx;
  429. border-bottom: 1rpx solid #eee;
  430. color: #333;
  431. font-size: 28rpx;
  432. border-top-left-radius: 14rpx;
  433. border-top-right-radius: 14rpx;
  434. }
  435. .promoter-list .list .sortNav .sortItem {
  436. text-align: center;
  437. flex: 1;
  438. }
  439. .promoter-list .list .sortNav .sortItem image {
  440. width: 24rpx;
  441. height: 24rpx;
  442. margin-left: 6rpx;
  443. vertical-align: -3rpx;
  444. }
  445. .promoter-list .list .item {
  446. background-color: #fff;
  447. border-bottom: 1rpx solid #eee;
  448. height: 152rpx;
  449. padding: 0 24rpx;
  450. font-size: 24rpx;
  451. color: #666;
  452. }
  453. .promoter-list .list .item .picTxt .pictrue {
  454. width: 106rpx;
  455. height: 106rpx;
  456. border-radius: 50%;
  457. }
  458. .promoter-list .list .item .picTxt .pictrue image {
  459. width: 100%;
  460. height: 100%;
  461. border-radius: 50%;
  462. border: 3rpx solid #fff;
  463. box-shadow: 0 0 10rpx #aaa;
  464. box-sizing: border-box;
  465. }
  466. .promoter-list .list .item .picTxt .text {
  467. // width: 304rpx;
  468. font-size: 24rpx;
  469. color: #666;
  470. margin-left: 14rpx;
  471. }
  472. .promoter-list .list .item .picTxt .text .name {
  473. font-size: 28rpx;
  474. color: #333;
  475. margin-bottom: 13rpx;
  476. }
  477. .promoter-list .list .item .right {
  478. text-align: right;
  479. font-size: 22rpx;
  480. color: #333;
  481. }
  482. .promoter-list .list .item .right .num {
  483. margin-right: 7rpx;
  484. }
  485. </style>