team.vue 13 KB

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