team.vue 11 KB

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