team.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <image class="tuiguang_bg" src="../../static/img/share.png"></image>
  5. <view class="money-box">
  6. <view class="goback-box" @click="toBack"><image class="goback" src="../../static/img/fanhui.png" mode=""></image></view>
  7. <view class="header">我的团队</view>
  8. <view class="money-frame">
  9. <!-- <view class="money_name">我的推广</view> -->
  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.account }}</text>
  44. </view>
  45. </view>
  46. <view class="money">
  47. <text>{{ item.numberCount == null ? '未购买' : item.numberCount + '元' }}</text>
  48. </view>
  49. </view>
  50. </view>
  51. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  52. </scroll-view>
  53. </swiper-item>
  54. </swiper>
  55. </view>
  56. </template>
  57. <script>
  58. import { spread } from '@/api/user.js';
  59. import { mapState, mapMutations } from 'vuex';
  60. export default {
  61. onReady(res) {
  62. var _this = this;
  63. uni.getSystemInfo({
  64. success: resu => {
  65. const query = uni.createSelectorQuery();
  66. query.select('.swiper-box').boundingClientRect();
  67. query.exec(function(res) {
  68. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  69. console.log('打印页面的剩余高度', _this.height);
  70. });
  71. },
  72. fail: res => {}
  73. });
  74. },
  75. data() {
  76. return {
  77. // 头部图高度
  78. maxheight: '',
  79. tabCurrentIndex: 0,
  80. navList: [
  81. {
  82. state: 0,
  83. text: '直接推荐',
  84. loadingType: 'more',
  85. orderList: [],
  86. page: 1, //当前页数
  87. limit: 10 //每次信息条数
  88. }
  89. ],
  90. all: '',
  91. list: '',
  92. };
  93. },
  94. computed: {
  95. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  96. },
  97. onLoad(options) {},
  98. onShow() {
  99. this.loadData();
  100. },
  101. methods: {
  102. // 页面跳转
  103. navto(e) {
  104. uni.navigateTo({
  105. url: e
  106. });
  107. },
  108. //获取收入支出信息
  109. async loadData(source) {
  110. //这里是将订单挂载到tab列表下
  111. let index = this.tabCurrentIndex;
  112. let navItem = this.navList[index];
  113. let state = navItem.state;
  114. if (source === 'tabChange' && navItem.loaded === true) {
  115. //tab切换只有第一次需要加载数据
  116. return;
  117. }
  118. if (navItem.loadingType === 'loading') {
  119. //防止重复加载
  120. return;
  121. }
  122. if (navItem.loadingType === 'noMore') {
  123. //防止重复加载
  124. return;
  125. }
  126. // 修改当前对象状态为加载中
  127. navItem.loadingType = 'loading';
  128. spread({
  129. page: navItem.page,
  130. limit: navItem.limit
  131. })
  132. .then(({ data }) => {
  133. console.log(data);
  134. this.total = data.total;
  135. this.totalLevel = data.totalLevel;
  136. this.all = this.total + this.totalLevel;
  137. if (data.list.length > 0) {
  138. this.list = data.list;
  139. navItem.orderList = navItem.orderList.concat(data.list);
  140. navItem.page++;
  141. }
  142. this.$nextTick(function() {
  143. if (navItem.limit == data.list.length) {
  144. //判断是否还有数据, 有改为 more, 没有改为noMore
  145. navItem.loadingType = 'more';
  146. return;
  147. } else {
  148. //判断是否还有数据, 有改为 more, 没有改为noMore
  149. navItem.loadingType = 'noMore';
  150. }
  151. });
  152. this.$set(navItem, 'loaded', true);
  153. })
  154. .catch(e => {
  155. console.log(e);
  156. });
  157. },
  158. //swiper 切换
  159. changeTab(e) {
  160. this.tabCurrentIndex = e.target.current;
  161. this.loadData('tabChange');
  162. },
  163. //顶部tab点击
  164. tabClick(index) {
  165. this.tabCurrentIndex = index;
  166. },
  167. // 点击返回 我的页面
  168. toBack() {
  169. uni.switchTab({
  170. url: '/pages/user/user'
  171. });
  172. }
  173. }
  174. };
  175. </script>
  176. <style lang="scss">
  177. page {
  178. background: #f8f8f8;
  179. height: 100%;
  180. }
  181. .content-money {
  182. background: $page-color-base;
  183. position: relative;
  184. .tuiguang_bg {
  185. width: 750rpx;
  186. height: 484rpx;
  187. position: absolute;
  188. top: 0;
  189. left: 0;
  190. right: 0;
  191. }
  192. .buttom-box {
  193. position: relative;
  194. background-color: #ffffff;
  195. text-align: center;
  196. margin: 0 30rpx;
  197. padding: 30rpx 0;
  198. border-radius: $border-radius-sm;
  199. margin-top: -80rpx;
  200. .buttom {
  201. font-size: $font-lg;
  202. flex-grow: 1;
  203. .money {
  204. font-weight: bold;
  205. font-size: 32rpx;
  206. color: #ff0000;
  207. }
  208. }
  209. .text {
  210. color: #666666;
  211. }
  212. .interval {
  213. width: 2rpx;
  214. height: 60rpx;
  215. background-color: #eeeeee;
  216. }
  217. .icon {
  218. height: 50rpx;
  219. width: 48rpx;
  220. margin: 0 auto;
  221. .icon-img {
  222. width: 100%;
  223. height: 100%;
  224. }
  225. }
  226. }
  227. }
  228. .money-box {
  229. height: 484rpx;
  230. color: #ffffff;
  231. text-align: center;
  232. font-size: 35rpx;
  233. position: relative;
  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. flex-shrink: 0;
  389. width: 100rpx;
  390. height: 100rpx;
  391. margin-right: 25rpx;
  392. border-radius: 100%;
  393. image {
  394. width: 100%;
  395. height: 100%;
  396. border-radius: 100%;
  397. }
  398. }
  399. .list_tpl {
  400. width: 85%;
  401. .title {
  402. display: flex;
  403. justify-content: flex-start;
  404. font-size: $font-lg;
  405. color: $font-color-base;
  406. overflow: hidden; //超出的文本隐藏
  407. text-overflow: ellipsis; //溢出用省略号显示
  408. white-space: nowrap;
  409. line-height: 1;
  410. text-align: center;
  411. .title-name {
  412. max-width: 40%;
  413. }
  414. .dl {
  415. margin-left: 10rpx;
  416. width: 93rpx;
  417. height: 32rpx;
  418. border-radius: 16rpx;
  419. image {
  420. width: 93rpx;
  421. height: 32rpx;
  422. border-radius: 16rpx;
  423. }
  424. }
  425. .class {
  426. display: inline-block;
  427. margin-left: 10rpx;
  428. padding: 6rpx;
  429. text-align: center;
  430. border: 1px solid #2e58ff;
  431. border-radius: 16rpx;
  432. font-size: 20rpx;
  433. font-family: PingFang SC;
  434. font-weight: 500;
  435. color: #2e58ff;
  436. }
  437. }
  438. .time {
  439. font-size: $font-base;
  440. color: $font-color-light;
  441. }
  442. }
  443. }
  444. .money {
  445. width: 50%;
  446. text-align: right;
  447. color: #db1935;
  448. font-size: $font-lg;
  449. }
  450. }
  451. .yeji {
  452. position: relative;
  453. margin: -72rpx auto 0;
  454. width: 690rpx;
  455. height: 143rpx;
  456. background: #ffffff;
  457. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  458. border-radius: 10rpx;
  459. display: flex;
  460. align-items: center;
  461. .yeji-a {
  462. width: 50%;
  463. display: flex;
  464. flex-direction: column;
  465. justify-content: center;
  466. align-items: center;
  467. .yeji-top {
  468. font-size: 28rpx;
  469. font-family: PingFang SC;
  470. font-weight: bold;
  471. color: #333333;
  472. }
  473. .yeji-buttom {
  474. font-size: 42rpx;
  475. font-family: PingFang SC;
  476. font-weight: bold;
  477. color: #333333;
  478. }
  479. }
  480. .border {
  481. width: 1rpx;
  482. height: 51rpx;
  483. background: #dddddd;
  484. }
  485. }
  486. </style>