team.vue 8.8 KB

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