team.vue 11 KB

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