extension.vue 10 KB

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