team.vue 9.9 KB

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