team.vue 17 KB

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