team.vue 10 KB

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