team.vue 11 KB

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