team.vue 12 KB

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