team.vue 11 KB

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