team.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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_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.phone }}</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. .status_bar {
  182. height: var(--status-bar-height);
  183. width: 100%;
  184. background: #5dbc7c;
  185. }
  186. .content-money {
  187. background: #5dbc7c;
  188. padding-bottom: 30rpx;
  189. .buttom-box {
  190. position: relative;
  191. background-color: #ffffff;
  192. text-align: center;
  193. margin: 0 30rpx;
  194. padding: 30rpx 0;
  195. border-radius: $border-radius-sm;
  196. margin-top: -80rpx;
  197. .buttom {
  198. font-size: $font-lg;
  199. flex-grow: 1;
  200. .money {
  201. font-weight: bold;
  202. font-size: 32rpx;
  203. color: #ff0000;
  204. }
  205. }
  206. .text {
  207. color: #666666;
  208. }
  209. .interval {
  210. width: 2rpx;
  211. height: 60rpx;
  212. background-color: #eeeeee;
  213. }
  214. .icon {
  215. height: 50rpx;
  216. width: 48rpx;
  217. margin: 0 auto;
  218. .icon-img {
  219. width: 100%;
  220. height: 100%;
  221. }
  222. }
  223. }
  224. }
  225. .money-box {
  226. height: 484rpx;
  227. color: #ffffff;
  228. text-align: center;
  229. font-size: 35rpx;
  230. position: relative;
  231. .header {
  232. position: absolute;
  233. left: 0;
  234. top: 0;
  235. width: 100%;
  236. height: 80rpx;
  237. font-size: 32rpx;
  238. font-weight: 700;
  239. z-index: 99;
  240. display: flex;
  241. justify-content: center;
  242. align-items: center;
  243. }
  244. .goback-box {
  245. position: absolute;
  246. left: 18rpx;
  247. top: 0;
  248. height: 80rpx;
  249. display: flex;
  250. align-items: center;
  251. }
  252. .goback {
  253. z-index: 100;
  254. width: 34rpx;
  255. height: 34rpx;
  256. }
  257. .right {
  258. position: absolute;
  259. top: 140rpx;
  260. right: 40rpx;
  261. text-align: right;
  262. line-height: 1;
  263. .right-num {
  264. font-size: 50rpx;
  265. font-family: PingFang SC;
  266. font-weight: bold;
  267. color: #ffffff;
  268. }
  269. .right-font {
  270. margin-top: 10rpx;
  271. font-size: 24rpx;
  272. font-family: PingFang SC;
  273. font-weight: 400;
  274. color: #ffffff;
  275. }
  276. .time {
  277. font-size: 26rpx;
  278. font-family: PingFang SC;
  279. font-weight: 500;
  280. color: #ffffff;
  281. line-height: 35px;
  282. }
  283. }
  284. .user {
  285. position: absolute;
  286. top: 140rpx;
  287. left: 34rpx;
  288. display: flex;
  289. justify-content: flex-start;
  290. align-items: center;
  291. z-index: 10;
  292. .avtor {
  293. width: 102rpx;
  294. height: 102rpx;
  295. border-radius: 50%;
  296. position: relative;
  297. .portrait {
  298. width: 100%;
  299. height: 100%;
  300. border-radius: 50%;
  301. }
  302. .he {
  303. position: absolute;
  304. height: 30rpx;
  305. bottom: -4rpx;
  306. left: 0;
  307. .image {
  308. width: 102rpx;
  309. height: 30rpx;
  310. }
  311. }
  312. }
  313. .name {
  314. margin-left: 30rpx;
  315. font-size: 36rpx;
  316. font-family: PingFang SC;
  317. font-weight: 500;
  318. color: #ffffff;
  319. display: flex;
  320. justify-content: start;
  321. .name-left {
  322. width: 220rpx;
  323. }
  324. .name-right {
  325. margin-left: 20rpx;
  326. width: 50rpx;
  327. height: 60rpx;
  328. position: relative;
  329. image {
  330. width: 100%;
  331. height: 100%;
  332. }
  333. .level {
  334. position: absolute;
  335. top: 35%;
  336. left: 50%;
  337. margin-left: -12rpx;
  338. font-size: 20rpx;
  339. }
  340. }
  341. }
  342. .id {
  343. margin-left: 30rpx;
  344. font-size: 30rpx;
  345. font-family: PingFang SC;
  346. font-weight: 500;
  347. color: #ffffff;
  348. }
  349. }
  350. .money_img {
  351. width: 100%;
  352. height: 120rpx;
  353. text-align: center;
  354. padding-top: 50rpx;
  355. padding-bottom: 135rpx;
  356. image {
  357. width: 120rpx;
  358. height: 120rpx;
  359. border: 4rpx solid #fd5f6f;
  360. border-radius: 50%;
  361. }
  362. }
  363. .money-frame {
  364. position: absolute;
  365. top: 0;
  366. width: 100%;
  367. padding-top: 200rpx;
  368. }
  369. .money_num {
  370. font-size: 72rpx;
  371. font-family: PingFang SC;
  372. font-weight: bold;
  373. color: #ffffff;
  374. .money_ren {
  375. font-size: 36rpx;
  376. }
  377. }
  378. }
  379. .order-item {
  380. padding: 20rpx 30rpx;
  381. line-height: 1.5;
  382. .title-box {
  383. width: 100%;
  384. .title-avatar {
  385. flex-shrink: 0;
  386. width: 100rpx;
  387. height: 100rpx;
  388. margin-right: 25rpx;
  389. border-radius: 100%;
  390. image {
  391. width: 100%;
  392. height: 100%;
  393. border-radius: 100%;
  394. }
  395. }
  396. .list_tpl {
  397. width: 85%;
  398. .title {
  399. display: flex;
  400. justify-content: flex-start;
  401. font-size: $font-lg;
  402. color: $font-color-base;
  403. overflow: hidden; //超出的文本隐藏
  404. text-overflow: ellipsis; //溢出用省略号显示
  405. white-space: nowrap;
  406. line-height: 1;
  407. text-align: center;
  408. .title-name {
  409. max-width: 40%;
  410. }
  411. .dl {
  412. margin-left: 10rpx;
  413. width: 93rpx;
  414. height: 32rpx;
  415. border-radius: 16rpx;
  416. image {
  417. width: 93rpx;
  418. height: 32rpx;
  419. border-radius: 16rpx;
  420. }
  421. }
  422. .class {
  423. display: inline-block;
  424. margin-left: 10rpx;
  425. padding: 6rpx;
  426. text-align: center;
  427. border: 1px solid #2e58ff;
  428. border-radius: 16rpx;
  429. font-size: 20rpx;
  430. font-family: PingFang SC;
  431. font-weight: 500;
  432. color: #2e58ff;
  433. }
  434. }
  435. .time {
  436. font-size: $font-base;
  437. color: $font-color-light;
  438. }
  439. }
  440. }
  441. .money {
  442. width: 50%;
  443. text-align: right;
  444. color: #db1935;
  445. font-size: $font-lg;
  446. }
  447. }
  448. .yeji {
  449. position: relative;
  450. margin: -72rpx auto 0;
  451. width: 690rpx;
  452. height: 143rpx;
  453. background: #ffffff;
  454. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  455. border-radius: 10rpx;
  456. display: flex;
  457. align-items: center;
  458. .yeji-a {
  459. width: 50%;
  460. display: flex;
  461. flex-direction: column;
  462. justify-content: center;
  463. align-items: center;
  464. .yeji-top {
  465. font-size: 28rpx;
  466. font-family: PingFang SC;
  467. font-weight: bold;
  468. color: #333333;
  469. }
  470. .yeji-buttom {
  471. font-size: 42rpx;
  472. font-family: PingFang SC;
  473. font-weight: bold;
  474. color: #333333;
  475. }
  476. }
  477. .border {
  478. width: 1rpx;
  479. height: 51rpx;
  480. background: #dddddd;
  481. }
  482. }
  483. </style>