team.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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="main-box flex">
  17. <view class="money-box">
  18. <view class="money">{{ userInfo.ref_number|| '0' }}</view>
  19. <view>我的推广人数</view>
  20. </view>
  21. <view class="money-box">
  22. <view class="money">{{ userInfo.ref_numbers || '0' }}</view>
  23. <view>团队分享人数</view>
  24. </view>
  25. </view>
  26. <!-- <view class="money-box" style="padding-top: 20rpx;" v-if="order*1 > 0">
  27. <view>直推:{{zt_order}}单</view>
  28. <view>间推:{{jt_order}}单</view>
  29. </view> -->
  30. </view>
  31. <!-- <view class="flex buttom-box">
  32. <view class="buttom" @click="tabClick(0)">
  33. <view class="money">{{all || 0}}</view>
  34. <text class="text" :class="{ current: tabCurrentIndex === 0 }">分享</text>
  35. </view>
  36. <view class="buttom" @click="tabClick(1)">
  37. <view class="money">{{totalLevel || 0}}</view>
  38. <text class="text" :class="{ current: tabCurrentIndex === 1 }">二级推广</text>
  39. </view>
  40. </view> -->
  41. <swiper :current="tabCurrentIndex" :style="{ height: maxheight }" class="swiper-box" duration="300"
  42. disable-touch>
  43. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  44. <scroll-view class="list-scroll-content" :style="{ height: maxheight }" scroll-y
  45. @scrolltolower="loadData">
  46. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  47. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item flex">
  48. <view class="title-box flex_item">
  49. <view class="title-avatar">
  50. <image :src="item.avatar"></image>
  51. </view>
  52. <view class="list_tpl">
  53. <view class="title">
  54. <view class="title-name clamp2">{{ item.nickname }} </view>
  55. </view>
  56. <view class="time">
  57. <text>{{item.user_level.name}}</text>
  58. </view>
  59. <view class="time">
  60. <text>{{ item.time }}</text>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  66. </scroll-view>
  67. </swiper-item>
  68. </swiper>
  69. </view>
  70. </template>
  71. <script>
  72. import {
  73. myspread
  74. } from '@/api/user.js';
  75. import empty from '@/components/empty';
  76. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  77. import {
  78. mapState,
  79. mapMutations
  80. } from 'vuex';
  81. export default {
  82. components: {
  83. empty,
  84. uniLoadMore
  85. },
  86. onReady(res) {
  87. var _this = this;
  88. uni.getSystemInfo({
  89. success: resu => {
  90. const query = uni.createSelectorQuery();
  91. query.select('.swiper-box').boundingClientRect();
  92. query.exec(function(res) {
  93. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  94. console.log('打印页面的剩余高度', _this.height);
  95. });
  96. },
  97. fail: res => {}
  98. });
  99. },
  100. data() {
  101. return {
  102. // 头部图高度
  103. maxheight: '',
  104. tabCurrentIndex: 0,
  105. navList: [{
  106. state: 0,
  107. text: '直接推荐',
  108. loadingType: 'more',
  109. orderList: [],
  110. page: 1, //当前页数
  111. limit: 10 //每次信息条数
  112. },
  113. {
  114. state: 1,
  115. text: '间接推荐',
  116. loadingType: 'more',
  117. orderList: [],
  118. page: 1, //当前页数
  119. limit: 10 //每次信息条数
  120. }
  121. ],
  122. all: '',
  123. list: '',
  124. totalLevel: '',
  125. order: '',
  126. zt_order: '',
  127. jt_order: ''
  128. };
  129. },
  130. computed: {
  131. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
  132. ...mapState(['baseURL'])
  133. },
  134. onLoad(options) {},
  135. onShow() {
  136. this.loadData();
  137. },
  138. methods: {
  139. // 页面跳转
  140. navto(e) {
  141. uni.navigateTo({
  142. url: e
  143. });
  144. },
  145. //获取收入支出信息
  146. async loadData(source) {
  147. //这里是将订单挂载到tab列表下
  148. let index = this.tabCurrentIndex;
  149. let navItem = this.navList[index];
  150. let state = navItem.state;
  151. if (source === 'tabChange' && navItem.loaded === true) {
  152. //tab切换只有第一次需要加载数据
  153. return;
  154. }
  155. if (navItem.loadingType === 'loading') {
  156. //防止重复加载
  157. return;
  158. }
  159. if (navItem.loadingType === 'noMore') {
  160. //防止重复加载
  161. return;
  162. }
  163. // 修改当前对象状态为加载中
  164. navItem.loadingType = 'loading';
  165. myspread({
  166. page: navItem.page,
  167. limit: navItem.limit,
  168. grade: state
  169. })
  170. .then(({
  171. data
  172. }) => {
  173. console.log(data);
  174. this.order = data.order
  175. this.zt_order = data.zt_order
  176. this.jt_order = data.jt_order
  177. this.all = data.total;
  178. this.totalLevel = data.totalLevel
  179. if (data.list.length > 0) {
  180. this.list = data.list;
  181. navItem.orderList = navItem.orderList.concat(data.list);
  182. navItem.page++;
  183. }
  184. this.$nextTick(function() {
  185. if (navItem.limit == data.list.length) {
  186. //判断是否还有数据, 有改为 more, 没有改为noMore
  187. navItem.loadingType = 'more';
  188. return;
  189. } else {
  190. //判断是否还有数据, 有改为 more, 没有改为noMore
  191. navItem.loadingType = 'noMore';
  192. }
  193. });
  194. this.$set(navItem, 'loaded', true);
  195. })
  196. .catch(e => {
  197. console.log(e);
  198. });
  199. },
  200. //swiper 切换
  201. changeTab(e) {
  202. this.tabCurrentIndex = e.target.current;
  203. this.loadData('tabChange');
  204. },
  205. //顶部tab点击
  206. tabClick(index) {
  207. this.tabCurrentIndex = index;
  208. },
  209. // 点击返回 我的页面
  210. toBack() {
  211. uni.switchTab({
  212. url: '/pages/user/user'
  213. });
  214. }
  215. }
  216. };
  217. </script>
  218. <style lang="scss">
  219. page {
  220. background: #f8f8f8;
  221. height: 100%;
  222. }
  223. .status_bar {
  224. height: var(--status-bar-height);
  225. width: 100%;
  226. background: #5dbc7c;
  227. }
  228. .content-money {
  229. position: relative;
  230. height: 480rpx;
  231. .content-bg {
  232. position: absolute;
  233. top: 0;
  234. left: 0;
  235. right: 0;
  236. width: 750rpx;
  237. height: 480rpx;
  238. image {
  239. width: 100%;
  240. height: 100%;
  241. }
  242. }
  243. .body-title {
  244. height: 80rpx;
  245. text-align: center;
  246. font-size: 35rpx;
  247. position: relative;
  248. .header {
  249. position: absolute;
  250. left: 0;
  251. top: 0;
  252. width: 100%;
  253. font-size: 36rpx;
  254. font-family: PingFang SC;
  255. font-weight: bold;
  256. color: #fffeff;
  257. height: 80rpx;
  258. font-size: 36rpx;
  259. font-weight: 700;
  260. z-index: 9;
  261. display: flex;
  262. justify-content: center;
  263. align-items: center;
  264. }
  265. .goback-box {
  266. position: absolute;
  267. left: 18rpx;
  268. top: 0;
  269. height: 80rpx;
  270. display: flex;
  271. align-items: center;
  272. }
  273. .goback {
  274. z-index: 100;
  275. width: 34rpx;
  276. height: 34rpx;
  277. }
  278. }
  279. }
  280. .money-box {
  281. width: 50%;
  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>