team.vue 10 KB

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