extension.vue 9.8 KB

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