team.vue 11 KB

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