team.vue 10 KB

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