team.vue 10 KB

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