myteamQian.vue 7.4 KB

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