extension.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  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>
  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/user.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. page: navItem.page,
  114. limit: navItem.limit
  115. })
  116. .then(({ data }) => {
  117. this.total = data.total;
  118. this.totalLevel = data.totalLevel;
  119. this.all = this.total + this.totalLevel;
  120. if (data.list.length > 0) {
  121. this.list = data.list;
  122. navItem.orderList = navItem.orderList.concat(data.list);
  123. navItem.page++;
  124. }
  125. this.$nextTick(function() {
  126. if (navItem.limit == data.list.length) {
  127. //判断是否还有数据, 有改为 more, 没有改为noMore
  128. navItem.loadingType = 'more';
  129. return;
  130. } else {
  131. //判断是否还有数据, 有改为 more, 没有改为noMore
  132. navItem.loadingType = 'noMore';
  133. }
  134. });
  135. this.$set(navItem, 'loaded', true);
  136. })
  137. .catch(e => {
  138. console.log(e);
  139. });
  140. },
  141. //swiper 切换
  142. changeTab(e) {
  143. this.tabCurrentIndex = e.target.current;
  144. this.loadData('tabChange');
  145. },
  146. //顶部tab点击
  147. tabClick(index) {
  148. this.tabCurrentIndex = index;
  149. },
  150. // 点击返回 我的页面
  151. toBack() {
  152. uni.switchTab({
  153. url: '/pages/user/user'
  154. });
  155. }
  156. }
  157. };
  158. </script>
  159. <style lang="scss">
  160. .status_bar {
  161. height: var(--status-bar-height);
  162. width: 100%;
  163. }
  164. page {
  165. background: #f8f8f8;
  166. height: 100%;
  167. }
  168. .content-money {
  169. background: $page-color-base;
  170. position: relative;
  171. .tuiguang_bg {
  172. width: 750rpx;
  173. height: 484rpx;
  174. position: absolute;
  175. top: 0;
  176. left: 0;
  177. right: 0;
  178. }
  179. .buttom-box {
  180. position: relative;
  181. background-color: #ffffff;
  182. text-align: center;
  183. margin: 0 30rpx;
  184. padding: 30rpx 0;
  185. border-radius: $border-radius-sm;
  186. margin-top: -80rpx;
  187. .buttom {
  188. font-size: $font-lg;
  189. flex-grow: 1;
  190. .money {
  191. font-weight: bold;
  192. font-size: 32rpx;
  193. color: #ff0000;
  194. }
  195. }
  196. .text {
  197. color: #666666;
  198. }
  199. .interval {
  200. width: 2rpx;
  201. height: 60rpx;
  202. background-color: #eeeeee;
  203. }
  204. .icon {
  205. height: 50rpx;
  206. width: 48rpx;
  207. margin: 0 auto;
  208. .icon-img {
  209. width: 100%;
  210. height: 100%;
  211. }
  212. }
  213. }
  214. }
  215. .money-box {
  216. // background: $base-color;
  217. height: 484rpx;
  218. color: #ffffff;
  219. text-align: center;
  220. font-size: 35rpx;
  221. position: relative;
  222. // padding-top: 60rpx;
  223. .header {
  224. position: absolute;
  225. left: 0;
  226. top: 0;
  227. width: 100%;
  228. height: 80rpx;
  229. font-size: 32rpx;
  230. font-weight: 700;
  231. z-index: 99;
  232. display: flex;
  233. justify-content: center;
  234. align-items: center;
  235. }
  236. .goback-box {
  237. position: absolute;
  238. left: 18rpx;
  239. top: 0;
  240. height: 80rpx;
  241. display: flex;
  242. align-items: center;
  243. }
  244. .goback {
  245. z-index: 100;
  246. width: 34rpx;
  247. height: 34rpx;
  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. display: flex;
  391. justify-content: flex-start;
  392. font-size: $font-lg;
  393. color: #000000;
  394. overflow: hidden; //超出的文本隐藏
  395. text-overflow: ellipsis; //溢出用省略号显示
  396. white-space: nowrap;
  397. line-height: 1;
  398. text-align: center;
  399. .title-name {
  400. max-width: 100%;
  401. }
  402. }
  403. .time {
  404. font-size: $font-base;
  405. color: $font-color-light;
  406. }
  407. }
  408. }
  409. .money {
  410. color: #db1935;
  411. font-size: $font-lg;
  412. }
  413. }
  414. </style>