team.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="money-box">
  5. <view class="bg">
  6. <image src="../../static/img/use-i.png" mode=""></image>
  7. </view>
  8. <view>
  9. <view class="money">共<text>{{ all }}</text>人</view>
  10. </view>
  11. </view>
  12. </view>
  13. <swiper :current="tabCurrentIndex" :style="{ height: maxheight + 'px' }" class="swiper-box" duration="300"
  14. @change="changeTab">
  15. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  16. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  17. <!-- 空白页 -->
  18. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  19. <!-- 订单列表 -->
  20. <view v-for="(item, index) in tabItem.orderList" :key="item.uid" class="andr-mt-flex andr-mt-lBox">
  21. <!-- 订单列表 -->
  22. <image :src="item.avatar" class="andr-mt-avatar andr-mt-marR20"></image>
  23. <view class="andr-mt-flex andr-mt-fdC">
  24. <text class="andr-mt-lname">{{ item.nickname || 'null' }}</text>
  25. <text class="andr-mt-ltime">{{ item.time }}</text>
  26. </view>
  27. </view>
  28. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  29. </scroll-view>
  30. </swiper-item>
  31. </swiper>
  32. </view>
  33. </template>
  34. <script>
  35. import {
  36. spreadPeople
  37. } from '@/api/myteam.js';
  38. import {
  39. userinfo
  40. } from '@/api/user.js';
  41. import {
  42. mapState,
  43. mapMutations
  44. } from 'vuex';
  45. import empty from '@/components/empty';
  46. export default {
  47. components: {
  48. empty,
  49. },
  50. onReady(res) {
  51. var _this = this;
  52. uni.getSystemInfo({
  53. success: resu => {
  54. console.log(resu, '11111');
  55. const query = uni.createSelectorQuery();
  56. query.select('.swiper-box').boundingClientRect();
  57. query.exec(function(res) {
  58. console.log(res, 'ddddddddddddd');
  59. _this.maxheight = resu.windowHeight - res[0].top;
  60. console.log('打印页面的剩余高度', _this.maxheight);
  61. });
  62. },
  63. fail: res => {}
  64. });
  65. },
  66. data() {
  67. return {
  68. userInfo: {},
  69. // 头部图高度
  70. maxheight: '',
  71. tabCurrentIndex: 0,
  72. navList: [{
  73. state: 0,
  74. text: '一级推广',
  75. loadingType: 'more',
  76. num: 0, //人数
  77. orderList: [],
  78. page: 1, //当前页数
  79. limit: 10 //每次信息条数
  80. },
  81. {
  82. state: 1,
  83. text: '二级推广',
  84. num: 0, //团队人数
  85. loadingType: 'more',
  86. orderList: [],
  87. page: 1, //当前页数
  88. limit: 10 //每次信息条数
  89. }
  90. ],
  91. all: 0
  92. };
  93. },
  94. onLoad(options) {},
  95. onShow() {
  96. this.loadData();
  97. // 获取用户积分
  98. let obj = this;
  99. userinfo({})
  100. .then(({
  101. data
  102. }) => {
  103. console.log(data);
  104. obj.userInfo = data;
  105. })
  106. .catch(e => {});
  107. },
  108. methods: {
  109. // 页面跳转
  110. navto(e) {
  111. uni.navigateTo({
  112. url: e
  113. });
  114. },
  115. //返回上一页面
  116. toBack() {
  117. console.log(111);
  118. uni.navigateBack({});
  119. },
  120. //获取收入支出信息
  121. async loadData(source) {
  122. let obj = this;
  123. //这里是将订单挂载到tab列表下
  124. let index = obj.tabCurrentIndex;
  125. let navItem = obj.navList[index];
  126. let state = navItem.state;
  127. if (source === 'tabChange' && navItem.loaded === true) {
  128. //tab切换只有第一次需要加载数据
  129. return;
  130. }
  131. if (navItem.loadingType === 'loading') {
  132. //防止重复加载
  133. return;
  134. }
  135. // 修改当前对象状态为加载中
  136. navItem.loadingType = 'loading';
  137. spreadPeople({
  138. page: navItem.page,
  139. limit: navItem.limit,
  140. grade: state,
  141. keyword: '',
  142. sort: ''
  143. })
  144. .then(({
  145. data
  146. }) => {
  147. obj.navList[0].num = data.total;
  148. obj.navList[1].num = data.totalLevel;
  149. if (data.list.length > 0) {
  150. navItem.orderList = navItem.orderList.concat(data.list);
  151. console.log(navItem.orderList);
  152. navItem.page++;
  153. }
  154. obj.all = data.total * 1 + data.totalLevel * 1
  155. if (navItem.limit == data.list.length) {
  156. //判断是否还有数据, 有改为 more, 没有改为noMore
  157. navItem.loadingType = 'more';
  158. return;
  159. } else {
  160. //判断是否还有数据, 有改为 more, 没有改为noMore
  161. navItem.loadingType = 'noMore';
  162. }
  163. uni.hideLoading();
  164. obj.$set(navItem, 'loaded', true);
  165. })
  166. .catch(e => {
  167. console.log(e);
  168. });
  169. },
  170. //swiper 切换
  171. changeTab(e) {
  172. this.tabCurrentIndex = e.target.current;
  173. this.loadData('tabChange');
  174. },
  175. //顶部tab点击
  176. tabClick(index) {
  177. this.tabCurrentIndex = index;
  178. }
  179. }
  180. };
  181. </script>
  182. <style lang="scss">
  183. page {
  184. background: #ffffff;
  185. height: 100%;
  186. }
  187. .content-money {
  188. background: $page-color-base;
  189. }
  190. .money-box {
  191. // background-color: $base-color;
  192. padding-top: var(--status-bar-height);
  193. height: 468rpx;
  194. color: #01A6A8;
  195. text-align: center;
  196. justify-content: center;
  197. position: relative;
  198. .body-title {
  199. height: 80rpx;
  200. text-align: center;
  201. font-size: 35rpx;
  202. position: relative;
  203. .header {
  204. position: absolute;
  205. left: 0;
  206. top: 0;
  207. width: 100%;
  208. font-size: 36rpx;
  209. font-weight: bold;
  210. color: #fffeff;
  211. height: 80rpx;
  212. font-size: 32rpx;
  213. font-weight: 700;
  214. z-index: 9;
  215. display: flex;
  216. justify-content: center;
  217. align-items: center;
  218. }
  219. .goback-box {
  220. position: absolute;
  221. z-index: 10;
  222. left: 24rpx;
  223. top: 0;
  224. height: 80rpx;
  225. display: flex;
  226. align-items: center;
  227. }
  228. .goback {
  229. width: 30rpx;
  230. height: 36rpx;
  231. }
  232. }
  233. .bg {
  234. position: absolute;
  235. top: 0;
  236. left: 0;
  237. width: 100%;
  238. height: 100%;
  239. image {
  240. width: 100%;
  241. height: 100%;
  242. }
  243. }
  244. .money {
  245. position: relative;
  246. z-index: 10;
  247. font-size: 36rpx;
  248. height: 388rpx;
  249. line-height: 288rpx;
  250. text {
  251. font-size: 82rpx;
  252. }
  253. }
  254. }
  255. .navbar {
  256. width: 700rpx;
  257. margin: -60rpx auto 0;
  258. display: flex;
  259. height: 120rpx;
  260. padding: 0 5px;
  261. background: #fff;
  262. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  263. position: relative;
  264. z-index: 10;
  265. .nav-item {
  266. flex: 1;
  267. display: flex;
  268. flex-direction: column;
  269. justify-content: center;
  270. align-items: center;
  271. height: 100%;
  272. font-size: 15px;
  273. color: $font-color-dark;
  274. position: relative;
  275. &.current {
  276. color: $base-color;
  277. &:after {
  278. content: '';
  279. position: absolute;
  280. left: 50%;
  281. bottom: 0;
  282. transform: translateX(-50%);
  283. width: 44px;
  284. height: 0;
  285. border-bottom: 2px solid $base-color;
  286. }
  287. }
  288. }
  289. }
  290. // 列表
  291. .swiper-box {
  292. padding-top: 30rpx;
  293. .order-item {
  294. padding: 20rpx 30rpx;
  295. line-height: 1.5;
  296. .title-box {
  297. .title {
  298. font-size: $font-lg;
  299. color: $font-color-base;
  300. }
  301. .time {
  302. font-size: $font-base;
  303. color: $font-color-light;
  304. }
  305. }
  306. .money {
  307. color: #01A6A8;
  308. font-size: $font-lg;
  309. }
  310. }
  311. }
  312. .list-scroll-content {
  313. height: 100%;
  314. }
  315. .content {
  316. height: 100%;
  317. .empty-content {
  318. background-color: #ffffff;
  319. }
  320. }
  321. .andr-mt-avatar {
  322. width: 78rpx;
  323. height: 78rpx;
  324. border-radius: 50rpx;
  325. }
  326. .andr-mt-avatarBd {
  327. border: 2px solid #ffffff;
  328. }
  329. .andr-mt-cname {
  330. font-size: 28rpx;
  331. color: #ffffff;
  332. }
  333. .andr-mt-flex {
  334. display: flex;
  335. }
  336. .andr-mt-lBox {
  337. background-color: #ffffff;
  338. height: 130rpx;
  339. padding: 20rpx 20rpx;
  340. border-bottom: 1px solid #f0f0f0;
  341. }
  342. .andr-mt-marR20 {
  343. margin-right: 20rpx;
  344. }
  345. .andr-mt-fdC {
  346. flex-direction: column;
  347. }
  348. .andr-mt-lname {
  349. font-size: 30rpx;
  350. color: #3f454b;
  351. }
  352. .andr-mt-ltime {
  353. font-size: 22rpx;
  354. color: #999999;
  355. }
  356. </style>