team.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  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">{{ userInfo.spread_count|| '0' }}</view>
  18. <view>我的推广人数</view>
  19. </view>
  20. <!-- <view class="money-box flex" style="padding: 20rpx 40rpx;" @click="navto('/pages/user/pushList')">
  21. <view>下级消费记录</view>
  22. </view> -->
  23. </view>
  24. <view class="info-box flex">
  25. <view class="info-item">
  26. <view class="info-font">直推业绩</view>
  27. <view class="info-num">{{recommend.numberCount || '0'}}</view>
  28. </view>
  29. <view class="shu"></view>
  30. <view class="info-item">
  31. <view class="info-font">团队业绩</view>
  32. <view class="info-num">{{group.numberCount || '0'}}</view>
  33. </view>
  34. </view>
  35. <!-- <view class="time-in">
  36. <picker mode="date" @change="bindStartDateChange">
  37. <input type="text" v-model="start_time" class="showtime" placeholder="请输入开始时间" disabled>
  38. </picker>
  39. <picker mode="date" @change="bindEndDateChange">
  40. <input type="text" v-model="end_time" class="showtime" placeholder="请输入结束时间" disabled>
  41. </picker>
  42. <view class="search" @click="loadData('reload')">
  43. 搜索
  44. </view>
  45. </view> -->
  46. <!-- <view class="flex buttom-box">
  47. <view class="buttom" @click="tabClick(0)">
  48. <view class="money">{{all || 0}}</view>
  49. <text class="text" :class="{ current: tabCurrentIndex === 0 }">一级推广</text>
  50. </view>
  51. <view class="buttom" @click="tabClick(1)">
  52. <view class="money">{{totalLevel || 0}}</view>
  53. <text class="text" :class="{ current: tabCurrentIndex === 1 }">二级推广</text>
  54. </view>
  55. </view> -->
  56. <swiper :current="tabCurrentIndex" :style="{ height: maxheight }" class="swiper-box" duration="300"
  57. @change="changeTab" disable-touch>
  58. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  59. <scroll-view class="list-scroll-content" :style="{ height: maxheight }" scroll-y>
  60. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  61. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item flex">
  62. <view class="title-box flex_item">
  63. <view class="title-avatar">
  64. <image :src="item.avatar"></image>
  65. </view>
  66. <view class="list_tpl">
  67. <view class="title">
  68. <view class="title-name clamp">{{ item.nickname }}</view>
  69. </view>
  70. <view class="time">
  71. <text>{{item.phone}}</text>
  72. </view>
  73. <view class="time">
  74. <text>订单数:{{item.orderCount || '0'}} 消费金额:{{item.numberCount || '0'}}</text>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  80. </scroll-view>
  81. </swiper-item>
  82. </swiper>
  83. </view>
  84. </template>
  85. <script>
  86. import {
  87. myspread,
  88. myteam,
  89. getPushList
  90. } from '@/api/user.js';
  91. import empty from '@/components/empty';
  92. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  93. import {
  94. mapState,
  95. mapMutations
  96. } from 'vuex';
  97. export default {
  98. components: {
  99. empty,
  100. uniLoadMore
  101. },
  102. onReady(res) {
  103. var _this = this;
  104. uni.getSystemInfo({
  105. success: resu => {
  106. const query = uni.createSelectorQuery();
  107. query.select('.swiper-box').boundingClientRect();
  108. query.exec(function(res) {
  109. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  110. console.log('打印页面的剩余高度', _this.height);
  111. });
  112. },
  113. fail: res => {}
  114. });
  115. },
  116. data() {
  117. return {
  118. recommend: {},
  119. group: {},
  120. // 头部图高度
  121. maxheight: '',
  122. tabCurrentIndex: 0,
  123. navList: [{
  124. state: 0,
  125. text: '直接推荐',
  126. loadingType: 'more',
  127. orderList: [],
  128. page: 1, //当前页数
  129. limit: 10 ,//每次信息条数
  130. loaded: false
  131. },
  132. {
  133. state: 1,
  134. text: '间接推荐',
  135. loadingType: 'more',
  136. orderList: [],
  137. page: 1, //当前页数
  138. limit: 10 ,//每次信息条数
  139. loaded: false
  140. }
  141. ],
  142. all: '',
  143. list: '',
  144. totalLevel: '',
  145. order: '',
  146. zt_order: '',
  147. jt_order: '',
  148. teamcount: '',
  149. ztcount: '',
  150. start_time: '',
  151. end_time: ''
  152. };
  153. },
  154. computed: {
  155. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
  156. ...mapState(['baseURL'])
  157. },
  158. onLoad(options) {
  159. this.loadData();
  160. },
  161. onShow() {
  162. // getPushList().then(res => {
  163. // console.log(res)
  164. // })
  165. },
  166. methods: {
  167. bindStartDateChange(e) {
  168. console.log(e)
  169. this.start_time = e.detail.value
  170. },
  171. bindEndDateChange(e) {
  172. console.log(e)
  173. this.end_time = e.detail.value
  174. },
  175. // 页面跳转
  176. navto(e) {
  177. uni.navigateTo({
  178. url: e
  179. });
  180. },
  181. //获取收入支出信息
  182. async loadData(source) {
  183. let obj = this
  184. //这里是将订单挂载到tab列表下
  185. let index = this.tabCurrentIndex;
  186. let navItem = this.navList[index];
  187. let state = navItem.state;
  188. if (source === 'tabChange' && navItem.loaded === true) {
  189. //tab切换只有第一次需要加载数据
  190. return;
  191. }
  192. if (navItem.loadingType === 'loading') {
  193. //防止重复加载
  194. return;
  195. }
  196. if(source == 'reload') {
  197. navItem.orderList = []
  198. }
  199. // if (navItem.loadingType === 'noMore') {
  200. // //防止重复加载
  201. // return;
  202. // }
  203. // 修改当前对象状态为加载中
  204. navItem.loadingType = 'loading';
  205. myspread({
  206. page: navItem.page,
  207. limit: navItem.limit,
  208. grade: navItem.state
  209. })
  210. .then(({
  211. data
  212. }) => {
  213. navItem.orderList = navItem.orderList.concat(data.list)
  214. if(data.list.lenght == navItem.limit) {
  215. navItem.loadingType = 'more'
  216. }else {
  217. navItem.loadingType = 'noMore'
  218. }
  219. navItem.loaded = true
  220. obj.group = data.group
  221. obj.recommend = data.recommend
  222. // console.log(data);
  223. // this.teamcount = data.team_count
  224. // this.ztcount = data.zt_count
  225. // this.order = data.order
  226. // this.zt_order = data.zt_order
  227. // this.jt_order = data.jt_order
  228. // this.totalLevel = data.totalLevel
  229. // navItem.orderList = data.list;
  230. // navItem.loadingType = 'noMore'
  231. })
  232. .catch(e => {
  233. console.log(e);
  234. });
  235. },
  236. //swiper 切换
  237. changeTab(e) {
  238. this.tabCurrentIndex = e.target.current;
  239. this.loadData('tabChange');
  240. },
  241. //顶部tab点击
  242. tabClick(index) {
  243. this.tabCurrentIndex = index;
  244. },
  245. // 点击返回 我的页面
  246. toBack() {
  247. uni.switchTab({
  248. url: '/pages/user/user'
  249. });
  250. }
  251. }
  252. };
  253. </script>
  254. <style lang="scss">
  255. page {
  256. background: #f8f8f8;
  257. height: 100%;
  258. }
  259. .status_bar {
  260. height: var(--status-bar-height);
  261. width: 100%;
  262. background: #5dbc7c;
  263. }
  264. .content-money {
  265. position: relative;
  266. height: 480rpx;
  267. .content-bg {
  268. position: absolute;
  269. top: 0;
  270. left: 0;
  271. right: 0;
  272. width: 750rpx;
  273. height: 480rpx;
  274. image {
  275. width: 100%;
  276. height: 100%;
  277. }
  278. }
  279. .body-title {
  280. height: 80rpx;
  281. text-align: center;
  282. font-size: 35rpx;
  283. position: relative;
  284. .header {
  285. position: absolute;
  286. left: 0;
  287. top: 0;
  288. width: 100%;
  289. font-size: 36rpx;
  290. font-family: PingFang SC;
  291. font-weight: bold;
  292. color: #6B4216;
  293. height: 80rpx;
  294. font-size: 36rpx;
  295. font-weight: 700;
  296. z-index: 9;
  297. display: flex;
  298. justify-content: center;
  299. align-items: center;
  300. }
  301. .goback-box {
  302. position: absolute;
  303. left: 18rpx;
  304. top: 0;
  305. height: 80rpx;
  306. display: flex;
  307. align-items: center;
  308. }
  309. .goback {
  310. z-index: 100;
  311. width: 34rpx;
  312. height: 34rpx;
  313. }
  314. }
  315. }
  316. .money-box {
  317. position: relative;
  318. z-index: 2;
  319. padding-top: 90rpx;
  320. color: #6B4216;
  321. text-align: center;
  322. .money {
  323. font-size: 72rpx;
  324. font-family: PingFang SC;
  325. font-weight: bold;
  326. color: #6B4216;
  327. }
  328. .text {
  329. font-size: 30rpx;
  330. }
  331. }
  332. .order-item {
  333. padding: 20rpx 30rpx;
  334. line-height: 1.5;
  335. background-color: #fff;
  336. .title-box {
  337. width: 100%;
  338. .title-avatar {
  339. flex-shrink: 0;
  340. width: 100rpx;
  341. height: 100rpx;
  342. margin-right: 25rpx;
  343. border-radius: 100%;
  344. image {
  345. width: 100%;
  346. height: 100%;
  347. border-radius: 100%;
  348. }
  349. }
  350. .list_tpl {
  351. width: 85%;
  352. .title {
  353. display: flex;
  354. justify-content: flex-start;
  355. font-size: $font-lg;
  356. color: $font-color-base;
  357. overflow: hidden; //超出的文本隐藏
  358. text-overflow: ellipsis; //溢出用省略号显示
  359. white-space: nowrap;
  360. line-height: 1;
  361. text-align: center;
  362. .title-name {
  363. max-width: 40%;
  364. }
  365. .dl {
  366. margin-left: 10rpx;
  367. width: 93rpx;
  368. height: 32rpx;
  369. border-radius: 16rpx;
  370. image {
  371. width: 93rpx;
  372. height: 32rpx;
  373. border-radius: 16rpx;
  374. }
  375. }
  376. .class {
  377. display: inline-block;
  378. margin-left: 10rpx;
  379. padding: 6rpx;
  380. text-align: center;
  381. border: 1px solid #2e58ff;
  382. border-radius: 16rpx;
  383. font-size: 20rpx;
  384. font-family: PingFang SC;
  385. font-weight: 500;
  386. color: #2e58ff;
  387. }
  388. }
  389. .time {
  390. font-size: $font-lg;
  391. color: $font-color-light;
  392. }
  393. }
  394. }
  395. .money {
  396. width: 50%;
  397. text-align: right;
  398. color: #db1935;
  399. font-size: $font-lg;
  400. }
  401. }
  402. .yeji {
  403. position: relative;
  404. margin: -72rpx auto 0;
  405. width: 690rpx;
  406. height: 143rpx;
  407. background: #ffffff;
  408. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  409. border-radius: 10rpx;
  410. display: flex;
  411. align-items: center;
  412. .yeji-a {
  413. width: 50%;
  414. display: flex;
  415. flex-direction: column;
  416. justify-content: center;
  417. align-items: center;
  418. .yeji-top {
  419. font-size: 28rpx;
  420. font-family: PingFang SC;
  421. font-weight: bold;
  422. color: #333333;
  423. }
  424. .yeji-buttom {
  425. font-size: 42rpx;
  426. font-family: PingFang SC;
  427. font-weight: bold;
  428. color: #333333;
  429. }
  430. }
  431. .border {
  432. width: 1rpx;
  433. height: 51rpx;
  434. background: #dddddd;
  435. }
  436. }
  437. .navbar {
  438. margin-top: 20rpx;
  439. display: flex;
  440. height: 88rpx;
  441. padding: 0 5px;
  442. background: #fff;
  443. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  444. position: relative;
  445. z-index: 10;
  446. .nav-item {
  447. flex: 1;
  448. display: flex;
  449. justify-content: center;
  450. align-items: center;
  451. height: 100%;
  452. font-size: 15px;
  453. color: #999999;
  454. position: relative;
  455. &.current {
  456. color: #000;
  457. &:after {
  458. content: '';
  459. position: absolute;
  460. left: 50%;
  461. bottom: 0;
  462. transform: translateX(-50%);
  463. width: 44px;
  464. height: 0;
  465. border-bottom: 2px solid #fe5b38;
  466. }
  467. }
  468. }
  469. }
  470. .buttom-box {
  471. position: relative;
  472. background-color: #ffffff;
  473. text-align: center;
  474. padding: 30rpx 0;
  475. .buttom {
  476. flex-grow: 1;
  477. }
  478. .money {
  479. font-size: 32rpx;
  480. font-weight: bold;
  481. color: #ff4173;
  482. }
  483. .text {
  484. padding-bottom: 26rpx;
  485. font-size: 28rpx;
  486. font-weight: 500;
  487. color: #666666;
  488. &.current {
  489. border-bottom: 2px solid #ff4173;
  490. }
  491. }
  492. .icon {
  493. height: 50rpx;
  494. width: 48rpx;
  495. margin: 0 auto;
  496. .icon-img {
  497. width: 100%;
  498. height: 100%;
  499. }
  500. }
  501. }
  502. .time-in {
  503. display: flex;
  504. margin-top: 20rpx;
  505. height: 100rpx;
  506. justify-content: space-around;
  507. align-items: center;
  508. background-color: #fff;
  509. .showtime {
  510. display: inline-block;
  511. width: 300rpx;
  512. height: 85rpx;
  513. background-color: #eee;
  514. border: 1px solid #999;
  515. border-radius: 20rpx;
  516. color: #000;
  517. font-size: 32rpx;
  518. padding-left: 20rpx;
  519. }
  520. .search {
  521. width: 100rpx;
  522. height: 50rpx;
  523. border-radius: 50rpx;
  524. background-color: #ff4575;
  525. font-size: 32rpx;
  526. text-align: center;
  527. line-height: 50rpx;
  528. color: #fff;
  529. }
  530. }
  531. .info-box {
  532. width: 670rpx;
  533. height: 186rpx;
  534. background: #ffffff;
  535. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  536. border-radius: 20rpx;
  537. margin: -100rpx auto 20rpx;
  538. position: relative;
  539. z-index: 2;
  540. .info-item {
  541. width: 50%;
  542. display: flex;
  543. flex-direction: column;
  544. align-items: center;
  545. line-height: 1;
  546. .info-font {
  547. font-size: 30rpx;
  548. font-family: PingFang SC;
  549. font-weight: bold;
  550. color: #999999;
  551. }
  552. .info-num {
  553. margin-top: 30rpx;
  554. font-size: 30rpx;
  555. font-family: PingFang SC;
  556. font-weight: bold;
  557. color: #181818;
  558. }
  559. }
  560. .shu {
  561. width: 2rpx;
  562. height: 74rpx;
  563. background: #dcdfe6;
  564. }
  565. }
  566. </style>