extension.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  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.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/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. 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. {
  114. page: navItem.page,
  115. limit: navItem.limit,
  116. },
  117. )
  118. .then(({ data }) => {
  119. this.total = data.total;
  120. this.totalLevel =data.totalLevel;
  121. this.all = this.total + this.totalLevel;
  122. if (data.list.length > 0) {
  123. this.list = data.list;
  124. navItem.orderList = navItem.orderList.concat(data.list);
  125. navItem.page++;
  126. }
  127. this.$nextTick(function(){
  128. if (navItem.limit == data.list.length) {
  129. //判断是否还有数据, 有改为 more, 没有改为noMore
  130. navItem.loadingType = 'more';
  131. return;
  132. } else {
  133. //判断是否还有数据, 有改为 more, 没有改为noMore
  134. navItem.loadingType = 'noMore';
  135. }
  136. })
  137. this.$set(navItem, 'loaded', true);
  138. })
  139. .catch(e => {
  140. console.log(e);
  141. });
  142. },
  143. //swiper 切换
  144. changeTab(e) {
  145. this.tabCurrentIndex = e.target.current;
  146. this.loadData('tabChange');
  147. },
  148. //顶部tab点击
  149. tabClick(index) {
  150. this.tabCurrentIndex = index;
  151. },
  152. // 点击返回 我的页面
  153. toBack(){
  154. uni.switchTab({
  155. url:'/pages/user/user'
  156. })
  157. }
  158. }
  159. };
  160. </script>
  161. <style lang="scss">
  162. .status_bar {
  163. height: var(--status-bar-height);
  164. width: 100%;
  165. background: linear-gradient(90deg, #60bab0, #45969b);
  166. }
  167. page {
  168. background: #f8f8f8;
  169. height: 100%;
  170. }
  171. .content-money {
  172. padding-bottom: 30rpx;
  173. background: $page-color-base;
  174. .buttom-box {
  175. position: relative;
  176. background-color: #ffffff;
  177. text-align: center;
  178. margin: 0 30rpx;
  179. padding: 30rpx 0;
  180. border-radius: $border-radius-sm;
  181. margin-top: -80rpx;
  182. .buttom {
  183. font-size: $font-lg;
  184. flex-grow: 1;
  185. .money {
  186. font-weight: bold;
  187. font-size: 32rpx;
  188. color: #ff0000;
  189. }
  190. }
  191. .text {
  192. color: #666666;
  193. }
  194. .interval {
  195. width: 2rpx;
  196. height: 60rpx;
  197. background-color: #eeeeee;
  198. }
  199. .icon {
  200. height: 50rpx;
  201. width: 48rpx;
  202. margin: 0 auto;
  203. .icon-img {
  204. width: 100%;
  205. height: 100%;
  206. }
  207. }
  208. }
  209. }
  210. .money-box {
  211. // background: $base-color;
  212. height: 424rpx;
  213. color: #ffffff;
  214. text-align: center;
  215. font-size: 35rpx;
  216. position: relative;
  217. // padding-top: 60rpx;
  218. .header {
  219. position: absolute;
  220. left: 0;
  221. top: 0;
  222. width: 100%;
  223. height: 80rpx;
  224. font-size: 32rpx;
  225. font-weight: 700;
  226. z-index: 99;
  227. display: flex;
  228. justify-content: center;
  229. align-items: center;
  230. }
  231. .goback-box {
  232. position: absolute;
  233. left: 18rpx;
  234. top: 0;
  235. height: 80rpx;
  236. display: flex;
  237. align-items: center;
  238. }
  239. .goback {
  240. z-index: 100;
  241. width: 34rpx;
  242. height: 34rpx;
  243. }
  244. .tuiguang_bg {
  245. width: 750rpx;
  246. height: 424rpx;
  247. position: relative;
  248. }
  249. .right {
  250. position: absolute;
  251. top: 140rpx;
  252. right: 40rpx;
  253. text-align: right;
  254. line-height: 1;
  255. .right-num {
  256. font-size: 50rpx;
  257. font-family: PingFang SC;
  258. font-weight: bold;
  259. color: #ffffff;
  260. }
  261. .right-font {
  262. margin-top: 10rpx;
  263. font-size: 24rpx;
  264. font-family: PingFang SC;
  265. font-weight: 400;
  266. color: #ffffff;
  267. }
  268. .time {
  269. font-size: 26rpx;
  270. font-family: PingFang SC;
  271. font-weight: 500;
  272. color: #ffffff;
  273. line-height: 35px;
  274. }
  275. }
  276. .user {
  277. position: absolute;
  278. top: 140rpx;
  279. left: 34rpx;
  280. display: flex;
  281. justify-content: flex-start;
  282. align-items: center;
  283. z-index: 10;
  284. .avtor {
  285. width: 102rpx;
  286. height: 102rpx;
  287. border-radius: 50%;
  288. position: relative;
  289. .portrait {
  290. width: 100%;
  291. height: 100%;
  292. border-radius: 50%;
  293. }
  294. .he {
  295. position: absolute;
  296. height: 30rpx;
  297. bottom: -4rpx;
  298. left: 0;
  299. .image {
  300. width: 102rpx;
  301. height: 30rpx;
  302. }
  303. }
  304. }
  305. .name {
  306. margin-left: 30rpx;
  307. font-size: 36rpx;
  308. font-family: PingFang SC;
  309. font-weight: 500;
  310. color: #ffffff;
  311. display: flex;
  312. justify-content: start;
  313. .name-left {
  314. width: 220rpx;
  315. }
  316. .name-right {
  317. margin-left: 20rpx;
  318. width: 50rpx;
  319. height: 60rpx;
  320. position: relative;
  321. image {
  322. width: 100%;
  323. height: 100%;
  324. }
  325. .level {
  326. position: absolute;
  327. top: 35%;
  328. left: 50%;
  329. margin-left: -12rpx;
  330. font-size: 20rpx;
  331. }
  332. }
  333. }
  334. .id {
  335. margin-left: 30rpx;
  336. font-size: 30rpx;
  337. font-family: PingFang SC;
  338. font-weight: 500;
  339. color: #ffffff;
  340. }
  341. }
  342. .money_img {
  343. width: 100%;
  344. height: 120rpx;
  345. text-align: center;
  346. padding-top: 50rpx;
  347. padding-bottom: 135rpx;
  348. image {
  349. width: 120rpx;
  350. height: 120rpx;
  351. border: 4rpx solid #fd5f6f;
  352. border-radius: 50%;
  353. }
  354. }
  355. .money-frame {
  356. position: absolute;
  357. top: 0;
  358. width: 100%;
  359. padding-top: 200rpx;
  360. }
  361. .money_num {
  362. font-size: 72rpx;
  363. font-family: PingFang SC;
  364. font-weight: bold;
  365. color: #ffffff;
  366. .money_ren {
  367. font-size: 36rpx;
  368. }
  369. }
  370. }
  371. .order-item {
  372. padding: 20rpx 30rpx;
  373. line-height: 1.5;
  374. .title-box {
  375. width: 100%;
  376. .title-avatar {
  377. width: 100rpx;
  378. height: 100rpx;
  379. margin-right: 25rpx;
  380. border-radius: 100%;
  381. image {
  382. width: 100%;
  383. height: 100%;
  384. border-radius: 100%;
  385. }
  386. }
  387. .list_tpl {
  388. width: 85%;
  389. .title {
  390. font-size: $font-lg;
  391. color: $font-color-base;
  392. overflow: hidden; //超出的文本隐藏
  393. text-overflow: ellipsis; //溢出用省略号显示
  394. white-space: nowrap;
  395. }
  396. .time {
  397. font-size: $font-base;
  398. color: $font-color-light;
  399. }
  400. }
  401. }
  402. .money {
  403. color: #db1935;
  404. font-size: $font-lg;
  405. }
  406. }
  407. </style>