team.vue 9.9 KB

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