team.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="status_bar"><!-- 这里是状态栏 --></view>
  5. <image class="tuiguang_bg" src="../../static/img/share.png"></image>
  6. <view class="money-box">
  7. <view class="goback-box" @click="toBack"><image class="goback" src="../../static/img/fanhui.png" mode=""></image></view>
  8. <view class="header">我的团队</view>
  9. <view class="money-frame">
  10. <!-- <view class="money_name">我的推广</view> -->
  11. <view class="money_num">
  12. <text class="money_ren">共</text>
  13. {{ all || '0' }}
  14. <text class="money_ren">人</text>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <swiper :current="tabCurrentIndex" :style="{ height: maxheight }" class="swiper-box" duration="300" @change="changeTab">
  20. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  21. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  22. <!-- 空白页 -->
  23. <!-- <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty> -->
  24. <!-- 订单列表 -->
  25. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item flex">
  26. <view class="title-box flex_item">
  27. <view class="title-avatar"><image :src="item.avatar"></image></view>
  28. <view class="list_tpl">
  29. <view class="title">
  30. <view class="title-name clamp">{{ item.nickname }}</view>
  31. </view>
  32. <view class="time">
  33. <text>{{ item.account }}</text>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <!-- <uni-load-more :status="tabItem.loadingType"></uni-load-more> -->
  39. </scroll-view>
  40. </swiper-item>
  41. </swiper>
  42. </view>
  43. </template>
  44. <script>
  45. import { spread } from '@/api/user.js';
  46. import { mapState, mapMutations } from 'vuex';
  47. export default {
  48. onReady(res) {
  49. var _this = this;
  50. uni.getSystemInfo({
  51. success: resu => {
  52. const query = uni.createSelectorQuery();
  53. query.select('.swiper-box').boundingClientRect();
  54. query.exec(function(res) {
  55. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  56. console.log('打印页面的剩余高度', _this.height);
  57. });
  58. },
  59. fail: res => {}
  60. });
  61. },
  62. data() {
  63. return {
  64. // 头部图高度
  65. maxheight: '',
  66. tabCurrentIndex: 0,
  67. navList: [
  68. {
  69. state: 0,
  70. text: '直接推荐',
  71. loadingType: 'more',
  72. orderList: [],
  73. page: 1, //当前页数
  74. limit: 10 //每次信息条数
  75. }
  76. ],
  77. all: '',
  78. list: ''
  79. };
  80. },
  81. onLoad(options) {},
  82. onShow() {
  83. this.loadData();
  84. },
  85. methods: {
  86. // 页面跳转
  87. navto(e) {
  88. uni.navigateTo({
  89. url: e
  90. });
  91. },
  92. //获取收入支出信息
  93. async loadData(source) {
  94. //这里是将订单挂载到tab列表下
  95. let index = this.tabCurrentIndex;
  96. let navItem = this.navList[index];
  97. let state = navItem.state;
  98. if (source === 'tabChange' && navItem.loaded === true) {
  99. //tab切换只有第一次需要加载数据
  100. return;
  101. }
  102. if (navItem.loadingType === 'loading') {
  103. //防止重复加载
  104. return;
  105. }
  106. if (navItem.loadingType === 'noMore') {
  107. //防止重复加载
  108. return;
  109. }
  110. // 修改当前对象状态为加载中
  111. navItem.loadingType = 'loading';
  112. spread({
  113. page: navItem.page,
  114. limit: navItem.limit
  115. })
  116. .then(({ data }) => {
  117. console.log(data)
  118. this.total = data.total;
  119. this.totalLevel = data.totalLevel;
  120. this.all = this.total + this.totalLevel;
  121. if (data.list.length > 0) {
  122. this.list = data.list;
  123. navItem.orderList = navItem.orderList.concat(data.list);
  124. navItem.page++;
  125. }
  126. this.$nextTick(function() {
  127. if (navItem.limit == data.list.length) {
  128. //判断是否还有数据, 有改为 more, 没有改为noMore
  129. navItem.loadingType = 'more';
  130. return;
  131. } else {
  132. //判断是否还有数据, 有改为 more, 没有改为noMore
  133. navItem.loadingType = 'noMore';
  134. }
  135. });
  136. this.$set(navItem, 'loaded', true);
  137. })
  138. .catch(e => {
  139. console.log(e);
  140. });
  141. },
  142. //swiper 切换
  143. changeTab(e) {
  144. this.tabCurrentIndex = e.target.current;
  145. this.loadData('tabChange');
  146. },
  147. //顶部tab点击
  148. tabClick(index) {
  149. this.tabCurrentIndex = index;
  150. },
  151. // 点击返回 我的页面
  152. toBack() {
  153. uni.switchTab({
  154. url: '/pages/user/user'
  155. });
  156. }
  157. }
  158. };
  159. </script>
  160. <style lang="scss">
  161. .status_bar {
  162. height: var(--status-bar-height);
  163. width: 100%;
  164. }
  165. page {
  166. background: #f8f8f8;
  167. height: 100%;
  168. }
  169. .content-money {
  170. background: $page-color-base;
  171. position: relative;
  172. .tuiguang_bg {
  173. width: 750rpx;
  174. height: 484rpx;
  175. position: absolute;
  176. top: 0;
  177. left: 0;
  178. right: 0;
  179. }
  180. .buttom-box {
  181. position: relative;
  182. background-color: #ffffff;
  183. text-align: center;
  184. margin: 0 30rpx;
  185. padding: 30rpx 0;
  186. border-radius: $border-radius-sm;
  187. margin-top: -80rpx;
  188. .buttom {
  189. font-size: $font-lg;
  190. flex-grow: 1;
  191. .money {
  192. font-weight: bold;
  193. font-size: 32rpx;
  194. color: #ff0000;
  195. }
  196. }
  197. .text {
  198. color: #666666;
  199. }
  200. .interval {
  201. width: 2rpx;
  202. height: 60rpx;
  203. background-color: #eeeeee;
  204. }
  205. .icon {
  206. height: 50rpx;
  207. width: 48rpx;
  208. margin: 0 auto;
  209. .icon-img {
  210. width: 100%;
  211. height: 100%;
  212. }
  213. }
  214. }
  215. }
  216. .money-box {
  217. // background: $base-color;
  218. height: 484rpx;
  219. color: #ffffff;
  220. text-align: center;
  221. font-size: 35rpx;
  222. position: relative;
  223. // padding-top: 60rpx;
  224. .header {
  225. position: absolute;
  226. left: 0;
  227. top: 0;
  228. width: 100%;
  229. height: 80rpx;
  230. font-size: 32rpx;
  231. font-weight: 700;
  232. z-index: 99;
  233. display: flex;
  234. justify-content: center;
  235. align-items: center;
  236. }
  237. .goback-box {
  238. position: absolute;
  239. left: 18rpx;
  240. top: 0;
  241. height: 80rpx;
  242. display: flex;
  243. align-items: center;
  244. }
  245. .goback {
  246. z-index: 100;
  247. width: 34rpx;
  248. height: 34rpx;
  249. }
  250. .right {
  251. position: absolute;
  252. top: 140rpx;
  253. right: 40rpx;
  254. text-align: right;
  255. line-height: 1;
  256. .right-num {
  257. font-size: 50rpx;
  258. font-family: PingFang SC;
  259. font-weight: bold;
  260. color: #ffffff;
  261. }
  262. .right-font {
  263. margin-top: 10rpx;
  264. font-size: 24rpx;
  265. font-family: PingFang SC;
  266. font-weight: 400;
  267. color: #ffffff;
  268. }
  269. .time {
  270. font-size: 26rpx;
  271. font-family: PingFang SC;
  272. font-weight: 500;
  273. color: #ffffff;
  274. line-height: 35px;
  275. }
  276. }
  277. .user {
  278. position: absolute;
  279. top: 140rpx;
  280. left: 34rpx;
  281. display: flex;
  282. justify-content: flex-start;
  283. align-items: center;
  284. z-index: 10;
  285. .avtor {
  286. width: 102rpx;
  287. height: 102rpx;
  288. border-radius: 50%;
  289. position: relative;
  290. .portrait {
  291. width: 100%;
  292. height: 100%;
  293. border-radius: 50%;
  294. }
  295. .he {
  296. position: absolute;
  297. height: 30rpx;
  298. bottom: -4rpx;
  299. left: 0;
  300. .image {
  301. width: 102rpx;
  302. height: 30rpx;
  303. }
  304. }
  305. }
  306. .name {
  307. margin-left: 30rpx;
  308. font-size: 36rpx;
  309. font-family: PingFang SC;
  310. font-weight: 500;
  311. color: #ffffff;
  312. display: flex;
  313. justify-content: start;
  314. .name-left {
  315. width: 220rpx;
  316. }
  317. .name-right {
  318. margin-left: 20rpx;
  319. width: 50rpx;
  320. height: 60rpx;
  321. position: relative;
  322. image {
  323. width: 100%;
  324. height: 100%;
  325. }
  326. .level {
  327. position: absolute;
  328. top: 35%;
  329. left: 50%;
  330. margin-left: -12rpx;
  331. font-size: 20rpx;
  332. }
  333. }
  334. }
  335. .id {
  336. margin-left: 30rpx;
  337. font-size: 30rpx;
  338. font-family: PingFang SC;
  339. font-weight: 500;
  340. color: #ffffff;
  341. }
  342. }
  343. .money_img {
  344. width: 100%;
  345. height: 120rpx;
  346. text-align: center;
  347. padding-top: 50rpx;
  348. padding-bottom: 135rpx;
  349. image {
  350. width: 120rpx;
  351. height: 120rpx;
  352. border: 4rpx solid #fd5f6f;
  353. border-radius: 50%;
  354. }
  355. }
  356. .money-frame {
  357. position: absolute;
  358. top: 0;
  359. width: 100%;
  360. padding-top: 200rpx;
  361. }
  362. .money_num {
  363. font-size: 72rpx;
  364. font-family: PingFang SC;
  365. font-weight: bold;
  366. color: #ffffff;
  367. .money_ren {
  368. font-size: 36rpx;
  369. }
  370. }
  371. }
  372. .order-item {
  373. padding: 20rpx 30rpx;
  374. line-height: 1.5;
  375. .title-box {
  376. width: 100%;
  377. .title-avatar {
  378. width: 100rpx;
  379. height: 100rpx;
  380. margin-right: 25rpx;
  381. border-radius: 100%;
  382. image {
  383. width: 100%;
  384. height: 100%;
  385. border-radius: 100%;
  386. }
  387. }
  388. .list_tpl {
  389. width: 85%;
  390. .title {
  391. display: flex;
  392. justify-content: flex-start;
  393. font-size: $font-lg;
  394. color: $font-color-base;
  395. overflow: hidden; //超出的文本隐藏
  396. text-overflow: ellipsis; //溢出用省略号显示
  397. white-space: nowrap;
  398. line-height: 1;
  399. text-align: center;
  400. .title-name {
  401. max-width: 40%;
  402. }
  403. .dl {
  404. margin-left: 10rpx;
  405. width: 93rpx;
  406. height: 32rpx;
  407. border-radius: 16rpx;
  408. image {
  409. width: 93rpx;
  410. height: 32rpx;
  411. border-radius: 16rpx;
  412. }
  413. }
  414. .class {
  415. display: inline-block;
  416. margin-left: 10rpx;
  417. padding: 6rpx;
  418. text-align: center;
  419. border: 1px solid #2e58ff;
  420. border-radius: 16rpx;
  421. font-size: 20rpx;
  422. font-family: PingFang SC;
  423. font-weight: 500;
  424. color: #2e58ff;
  425. }
  426. }
  427. .time {
  428. font-size: $font-base;
  429. color: $font-color-light;
  430. }
  431. }
  432. }
  433. .money {
  434. color: #db1935;
  435. font-size: $font-lg;
  436. }
  437. }
  438. </style>