extension.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. <template>
  2. <view class="content">
  3. <view class="status_bar"><!-- 这里是状态栏 --></view>
  4. <view class="content-money">
  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. <image class="tuiguang_bg" src="../../static/img/share-bg.png"></image>
  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. <text>{{ item.nickname }}</text>
  31. </view>
  32. <view class="time">
  33. <text>{{ item.time }}</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/finance.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. state: 1,
  78. text: '间接推荐',
  79. loadingType: 'more',
  80. orderList: [],
  81. page: 1, //当前页数
  82. limit: 10 //每次信息条数
  83. }
  84. ],
  85. all:'',
  86. list:'',
  87. };
  88. },
  89. onLoad(options) {},
  90. onShow() {
  91. // this.loadData();
  92. },
  93. methods: {
  94. // 页面跳转
  95. navto(e) {
  96. uni.navigateTo({
  97. url: e
  98. });
  99. },
  100. //获取收入支出信息
  101. async loadData(source) {
  102. //这里是将订单挂载到tab列表下
  103. let index = this.tabCurrentIndex;
  104. let navItem = this.navList[index];
  105. let state = navItem.state;
  106. if (source === 'tabChange' && navItem.loaded === true) {
  107. //tab切换只有第一次需要加载数据
  108. return;
  109. }
  110. if (navItem.loadingType === 'loading') {
  111. //防止重复加载
  112. return;
  113. }
  114. if (navItem.loadingType === 'noMore') {
  115. //防止重复加载
  116. return;
  117. }
  118. // 修改当前对象状态为加载中
  119. navItem.loadingType = 'loading';
  120. spread(
  121. {
  122. page: navItem.page,
  123. limit: navItem.limit,
  124. keyword:'',
  125. grade:state
  126. },
  127. )
  128. .then(({ data }) => {
  129. this.total = data.total;
  130. this.totalLevel =data.totalLevel;
  131. this.all = this.total + this.totalLevel;
  132. if (data.list.length > 0) {
  133. this.list = data.list;
  134. navItem.orderList = navItem.orderList.concat(data.list);
  135. navItem.page++;
  136. }
  137. this.$nextTick(function(){
  138. if (navItem.limit == data.list.length) {
  139. //判断是否还有数据, 有改为 more, 没有改为noMore
  140. navItem.loadingType = 'more';
  141. return;
  142. } else {
  143. //判断是否还有数据, 有改为 more, 没有改为noMore
  144. navItem.loadingType = 'noMore';
  145. }
  146. })
  147. this.$set(navItem, 'loaded', true);
  148. })
  149. .catch(e => {
  150. console.log(e);
  151. });
  152. },
  153. //swiper 切换
  154. changeTab(e) {
  155. this.tabCurrentIndex = e.target.current;
  156. this.loadData('tabChange');
  157. },
  158. //顶部tab点击
  159. tabClick(index) {
  160. this.tabCurrentIndex = index;
  161. },
  162. // 点击返回 我的页面
  163. toBack(){
  164. uni.switchTab({
  165. url:'/pages/user/user'
  166. })
  167. }
  168. }
  169. };
  170. </script>
  171. <style lang="scss">
  172. .status_bar {
  173. height: var(--status-bar-height);
  174. width: 100%;
  175. background: linear-gradient(90deg, #60bab0, #45969b);
  176. }
  177. page {
  178. background: #f8f8f8;
  179. height: 100%;
  180. }
  181. .content-money {
  182. padding-bottom: 30rpx;
  183. background: $page-color-base;
  184. .buttom-box {
  185. position: relative;
  186. background-color: #ffffff;
  187. text-align: center;
  188. margin: 0 30rpx;
  189. padding: 30rpx 0;
  190. border-radius: $border-radius-sm;
  191. margin-top: -80rpx;
  192. .buttom {
  193. font-size: $font-lg;
  194. flex-grow: 1;
  195. .money {
  196. font-weight: bold;
  197. font-size: 32rpx;
  198. color: #ff0000;
  199. }
  200. }
  201. .text {
  202. color: #666666;
  203. }
  204. .interval {
  205. width: 2rpx;
  206. height: 60rpx;
  207. background-color: #eeeeee;
  208. }
  209. .icon {
  210. height: 50rpx;
  211. width: 48rpx;
  212. margin: 0 auto;
  213. .icon-img {
  214. width: 100%;
  215. height: 100%;
  216. }
  217. }
  218. }
  219. }
  220. .money-box {
  221. // background: $base-color;
  222. height: 424rpx;
  223. color: #ffffff;
  224. text-align: center;
  225. font-size: 35rpx;
  226. position: relative;
  227. // padding-top: 60rpx;
  228. .header {
  229. position: absolute;
  230. left: 0;
  231. top: 0;
  232. width: 100%;
  233. height: 80rpx;
  234. font-size: 32rpx;
  235. font-weight: 700;
  236. z-index: 99;
  237. display: flex;
  238. justify-content: center;
  239. align-items: center;
  240. }
  241. .goback-box {
  242. position: absolute;
  243. left: 18rpx;
  244. top: 0;
  245. height: 80rpx;
  246. display: flex;
  247. align-items: center;
  248. }
  249. .goback {
  250. z-index: 100;
  251. width: 34rpx;
  252. height: 34rpx;
  253. }
  254. .tuiguang_bg {
  255. width: 750rpx;
  256. height: 424rpx;
  257. position: relative;
  258. }
  259. .right {
  260. position: absolute;
  261. top: 140rpx;
  262. right: 40rpx;
  263. text-align: right;
  264. line-height: 1;
  265. .right-num {
  266. font-size: 50rpx;
  267. font-family: PingFang SC;
  268. font-weight: bold;
  269. color: #ffffff;
  270. }
  271. .right-font {
  272. margin-top: 10rpx;
  273. font-size: 24rpx;
  274. font-family: PingFang SC;
  275. font-weight: 400;
  276. color: #ffffff;
  277. }
  278. .time {
  279. font-size: 26rpx;
  280. font-family: PingFang SC;
  281. font-weight: 500;
  282. color: #ffffff;
  283. line-height: 35px;
  284. }
  285. }
  286. .user {
  287. position: absolute;
  288. top: 140rpx;
  289. left: 34rpx;
  290. display: flex;
  291. justify-content: flex-start;
  292. align-items: center;
  293. z-index: 10;
  294. .avtor {
  295. width: 102rpx;
  296. height: 102rpx;
  297. border-radius: 50%;
  298. position: relative;
  299. .portrait {
  300. width: 100%;
  301. height: 100%;
  302. border-radius: 50%;
  303. }
  304. .he {
  305. position: absolute;
  306. height: 30rpx;
  307. bottom: -4rpx;
  308. left: 0;
  309. .image {
  310. width: 102rpx;
  311. height: 30rpx;
  312. }
  313. }
  314. }
  315. .name {
  316. margin-left: 30rpx;
  317. font-size: 36rpx;
  318. font-family: PingFang SC;
  319. font-weight: 500;
  320. color: #ffffff;
  321. display: flex;
  322. justify-content: start;
  323. .name-left {
  324. width: 220rpx;
  325. }
  326. .name-right {
  327. margin-left: 20rpx;
  328. width: 50rpx;
  329. height: 60rpx;
  330. position: relative;
  331. image {
  332. width: 100%;
  333. height: 100%;
  334. }
  335. .level {
  336. position: absolute;
  337. top: 35%;
  338. left: 50%;
  339. margin-left: -12rpx;
  340. font-size: 20rpx;
  341. }
  342. }
  343. }
  344. .id {
  345. margin-left: 30rpx;
  346. font-size: 30rpx;
  347. font-family: PingFang SC;
  348. font-weight: 500;
  349. color: #ffffff;
  350. }
  351. }
  352. .money_img {
  353. width: 100%;
  354. height: 120rpx;
  355. text-align: center;
  356. padding-top: 50rpx;
  357. padding-bottom: 135rpx;
  358. image {
  359. width: 120rpx;
  360. height: 120rpx;
  361. border: 4rpx solid #fd5f6f;
  362. border-radius: 50%;
  363. }
  364. }
  365. .money-frame {
  366. position: absolute;
  367. top: 0;
  368. width: 100%;
  369. padding-top: 200rpx;
  370. }
  371. .money_num {
  372. font-size: 72rpx;
  373. font-family: PingFang SC;
  374. font-weight: bold;
  375. color: #ffffff;
  376. .money_ren {
  377. font-size: 36rpx;
  378. }
  379. }
  380. }
  381. .navbar {
  382. display: flex;
  383. height: 40px;
  384. padding: 0 5px;
  385. background: #fff;
  386. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  387. position: relative;
  388. z-index: 10;
  389. .nav-item {
  390. flex: 1;
  391. display: flex;
  392. justify-content: center;
  393. align-items: center;
  394. height: 100%;
  395. font-size: 15px;
  396. color: $font-color-dark;
  397. position: relative;
  398. &.current {
  399. color: #ff0000;
  400. &:after {
  401. content: '';
  402. position: absolute;
  403. left: 50%;
  404. bottom: 0;
  405. transform: translateX(-50%);
  406. width: 44px;
  407. height: 0;
  408. border-bottom: 2px solid #ff0000;
  409. }
  410. }
  411. }
  412. }
  413. .main {
  414. position: relative;
  415. z-index: 10;
  416. width: 691rpx;
  417. height: auto;
  418. background: #ffffff;
  419. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  420. border-radius: 20rpx;
  421. margin: -160rpx auto 0;
  422. padding: 40rpx 40rpx;
  423. .today {
  424. position: absolute;
  425. top: -50rpx;
  426. right: 20rpx;
  427. color: #fff;
  428. }
  429. .main-box {
  430. flex-direction: column;
  431. align-items: center;
  432. .bottom {
  433. margin-top: 20rpx;
  434. }
  435. .item {
  436. display: flex;
  437. flex-direction: column;
  438. align-items: center;
  439. .num {
  440. font-size: 38rpx;
  441. font-family: PingFang SC;
  442. font-weight: bold;
  443. color: #0f253a;
  444. }
  445. .font {
  446. font-size: 24rpx;
  447. font-family: PingFang SC;
  448. font-weight: bold;
  449. color: #6d7c88;
  450. margin-top: 18rpx;
  451. }
  452. }
  453. }
  454. }
  455. .box {
  456. width: 690rpx;
  457. background: #ffffff;
  458. box-shadow: 0px 0px 17rpx 0px rgba(0, 0, 0, 0.05);
  459. border-radius: 20rpx;
  460. margin: 20rpx auto;
  461. padding: 34rpx;
  462. .box-item:first-child {
  463. margin-top: 0;
  464. }
  465. .box-item {
  466. margin-top: 20rpx;
  467. justify-content: space-between;
  468. align-items: center;
  469. .box-left {
  470. font-size: 26rpx;
  471. font-family: PingFang SC;
  472. font-weight: 500;
  473. color: #6d7c88;
  474. }
  475. .box-right {
  476. font-size: 26rpx;
  477. font-family: PingFang SC;
  478. font-weight: bold;
  479. color: #0f253a;
  480. }
  481. }
  482. }
  483. .liebiao {
  484. width: 692rpx;
  485. background: #ffffff;
  486. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  487. border-radius: 20rpx;
  488. padding: 34rpx;
  489. margin: 24rpx auto 0;
  490. align-items: center;
  491. .left {
  492. justify-content: flex-start;
  493. align-items: center;
  494. image {
  495. width: 46rpx;
  496. height: 36rpx;
  497. }
  498. .leibiao-font {
  499. margin-left: 10rpx;
  500. font-size: 32rpx;
  501. font-family: PingFang SC;
  502. font-weight: bold;
  503. color: #333333;
  504. }
  505. }
  506. image {
  507. width: 15rpx;
  508. height: 27rpx;
  509. }
  510. }
  511. .swiper-box {
  512. background-color: red;
  513. }
  514. </style>