team.vue 10 KB

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