team.vue 10 KB

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