extension.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  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. console.log(data)
  122. this.total = data.total;
  123. this.totalLevel = data.totalLevel;
  124. this.all = this.total + this.totalLevel;
  125. if (data.list.length > 0) {
  126. this.list = data.list;
  127. navItem.orderList = navItem.orderList.concat(data.list);
  128. navItem.page++;
  129. }
  130. this.$nextTick(function() {
  131. if (navItem.limit == data.list.length) {
  132. //判断是否还有数据, 有改为 more, 没有改为noMore
  133. navItem.loadingType = 'more';
  134. return;
  135. } else {
  136. //判断是否还有数据, 有改为 more, 没有改为noMore
  137. navItem.loadingType = 'noMore';
  138. }
  139. });
  140. this.$set(navItem, 'loaded', true);
  141. })
  142. .catch(e => {
  143. console.log(e);
  144. });
  145. },
  146. //swiper 切换
  147. changeTab(e) {
  148. this.tabCurrentIndex = e.target.current;
  149. this.loadData('tabChange');
  150. },
  151. //顶部tab点击
  152. tabClick(index) {
  153. this.tabCurrentIndex = index;
  154. },
  155. // 点击返回 我的页面
  156. toBack() {
  157. uni.switchTab({
  158. url: '/pages/user/user'
  159. });
  160. }
  161. }
  162. };
  163. </script>
  164. <style lang="scss">
  165. .status_bar {
  166. height: var(--status-bar-height);
  167. width: 100%;
  168. }
  169. page {
  170. background: #f8f8f8;
  171. height: 100%;
  172. }
  173. .content-money {
  174. background: $page-color-base;
  175. position: relative;
  176. .tuiguang_bg {
  177. width: 750rpx;
  178. height: 484rpx;
  179. position: absolute;
  180. top: 0;
  181. left: 0;
  182. right: 0;
  183. }
  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: 484rpx;
  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. .right {
  255. position: absolute;
  256. top: 140rpx;
  257. right: 40rpx;
  258. text-align: right;
  259. line-height: 1;
  260. .right-num {
  261. font-size: 50rpx;
  262. font-family: PingFang SC;
  263. font-weight: bold;
  264. color: #ffffff;
  265. }
  266. .right-font {
  267. margin-top: 10rpx;
  268. font-size: 24rpx;
  269. font-family: PingFang SC;
  270. font-weight: 400;
  271. color: #ffffff;
  272. }
  273. .time {
  274. font-size: 26rpx;
  275. font-family: PingFang SC;
  276. font-weight: 500;
  277. color: #ffffff;
  278. line-height: 35px;
  279. }
  280. }
  281. .user {
  282. position: absolute;
  283. top: 140rpx;
  284. left: 34rpx;
  285. display: flex;
  286. justify-content: flex-start;
  287. align-items: center;
  288. z-index: 10;
  289. .avtor {
  290. width: 102rpx;
  291. height: 102rpx;
  292. border-radius: 50%;
  293. position: relative;
  294. .portrait {
  295. width: 100%;
  296. height: 100%;
  297. border-radius: 50%;
  298. }
  299. .he {
  300. position: absolute;
  301. height: 30rpx;
  302. bottom: -4rpx;
  303. left: 0;
  304. .image {
  305. width: 102rpx;
  306. height: 30rpx;
  307. }
  308. }
  309. }
  310. .name {
  311. margin-left: 30rpx;
  312. font-size: 36rpx;
  313. font-family: PingFang SC;
  314. font-weight: 500;
  315. color: #ffffff;
  316. display: flex;
  317. justify-content: start;
  318. .name-left {
  319. width: 220rpx;
  320. }
  321. .name-right {
  322. margin-left: 20rpx;
  323. width: 50rpx;
  324. height: 60rpx;
  325. position: relative;
  326. image {
  327. width: 100%;
  328. height: 100%;
  329. }
  330. .level {
  331. position: absolute;
  332. top: 35%;
  333. left: 50%;
  334. margin-left: -12rpx;
  335. font-size: 20rpx;
  336. }
  337. }
  338. }
  339. .id {
  340. margin-left: 30rpx;
  341. font-size: 30rpx;
  342. font-family: PingFang SC;
  343. font-weight: 500;
  344. color: #ffffff;
  345. }
  346. }
  347. .money_img {
  348. width: 100%;
  349. height: 120rpx;
  350. text-align: center;
  351. padding-top: 50rpx;
  352. padding-bottom: 135rpx;
  353. image {
  354. width: 120rpx;
  355. height: 120rpx;
  356. border: 4rpx solid #fd5f6f;
  357. border-radius: 50%;
  358. }
  359. }
  360. .money-frame {
  361. position: absolute;
  362. top: 0;
  363. width: 100%;
  364. padding-top: 200rpx;
  365. }
  366. .money_num {
  367. font-size: 72rpx;
  368. font-family: PingFang SC;
  369. font-weight: bold;
  370. color: #ffffff;
  371. .money_ren {
  372. font-size: 36rpx;
  373. }
  374. }
  375. }
  376. .order-item {
  377. padding: 20rpx 30rpx;
  378. line-height: 1.5;
  379. .title-box {
  380. width: 100%;
  381. .title-avatar {
  382. width: 100rpx;
  383. height: 100rpx;
  384. margin-right: 25rpx;
  385. border-radius: 100%;
  386. image {
  387. width: 100%;
  388. height: 100%;
  389. border-radius: 100%;
  390. }
  391. }
  392. .list_tpl {
  393. width: 85%;
  394. .title {
  395. display: flex;
  396. justify-content: flex-start;
  397. font-size: $font-lg;
  398. color: $font-color-base;
  399. overflow: hidden; //超出的文本隐藏
  400. text-overflow: ellipsis; //溢出用省略号显示
  401. white-space: nowrap;
  402. line-height: 1;
  403. text-align: center;
  404. .title-name {
  405. max-width: 40%;
  406. }
  407. .dl {
  408. margin-left: 10rpx;
  409. width: 93rpx;
  410. height: 32rpx;
  411. border-radius: 16rpx;
  412. image {
  413. width: 93rpx;
  414. height: 32rpx;
  415. border-radius: 16rpx;
  416. }
  417. }
  418. .class {
  419. display: inline-block;
  420. margin-left: 10rpx;
  421. padding: 6rpx;
  422. text-align: center;
  423. border: 1px solid #2e58ff;
  424. border-radius: 16rpx;
  425. font-size: 20rpx;
  426. font-family: PingFang SC;
  427. font-weight: 500;
  428. color: #2e58ff;
  429. }
  430. }
  431. .time {
  432. font-size: $font-base;
  433. color: $font-color-light;
  434. }
  435. }
  436. }
  437. .money {
  438. color: #db1935;
  439. font-size: $font-lg;
  440. }
  441. }
  442. </style>