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. image {
  260. width: 100%;
  261. height: 100%;
  262. }
  263. }
  264. .body-title {
  265. height: 80rpx;
  266. text-align: center;
  267. font-size: 35rpx;
  268. position: relative;
  269. .header {
  270. position: absolute;
  271. left: 0;
  272. top: 0;
  273. width: 100%;
  274. font-size: 36rpx;
  275. font-family: PingFang SC;
  276. font-weight: bold;
  277. color: #6B4216;
  278. height: 80rpx;
  279. font-size: 36rpx;
  280. font-weight: 700;
  281. z-index: 9;
  282. display: flex;
  283. justify-content: center;
  284. align-items: center;
  285. }
  286. .goback-box {
  287. position: absolute;
  288. left: 18rpx;
  289. top: 0;
  290. height: 80rpx;
  291. display: flex;
  292. align-items: center;
  293. }
  294. .goback {
  295. z-index: 100;
  296. width: 34rpx;
  297. height: 34rpx;
  298. }
  299. }
  300. }
  301. .money-box {
  302. position: relative;
  303. z-index: 2;
  304. padding-top: 90rpx;
  305. color: #6B4216;
  306. text-align: center;
  307. .money {
  308. font-size: 72rpx;
  309. font-family: PingFang SC;
  310. font-weight: bold;
  311. color: #6B4216;
  312. }
  313. .text {
  314. font-size: 30rpx;
  315. }
  316. }
  317. .order-item {
  318. padding: 20rpx 30rpx;
  319. line-height: 1.5;
  320. background-color: #fff;
  321. .title-box {
  322. width: 100%;
  323. .title-avatar {
  324. flex-shrink: 0;
  325. width: 100rpx;
  326. height: 100rpx;
  327. margin-right: 25rpx;
  328. border-radius: 100%;
  329. image {
  330. width: 100%;
  331. height: 100%;
  332. border-radius: 100%;
  333. }
  334. }
  335. .list_tpl {
  336. width: 85%;
  337. .title {
  338. display: flex;
  339. justify-content: flex-start;
  340. font-size: $font-lg;
  341. color: $font-color-base;
  342. overflow: hidden; //超出的文本隐藏
  343. text-overflow: ellipsis; //溢出用省略号显示
  344. white-space: nowrap;
  345. line-height: 1;
  346. text-align: center;
  347. .title-name {
  348. max-width: 40%;
  349. }
  350. .dl {
  351. margin-left: 10rpx;
  352. width: 93rpx;
  353. height: 32rpx;
  354. border-radius: 16rpx;
  355. image {
  356. width: 93rpx;
  357. height: 32rpx;
  358. border-radius: 16rpx;
  359. }
  360. }
  361. .class {
  362. display: inline-block;
  363. margin-left: 10rpx;
  364. padding: 6rpx;
  365. text-align: center;
  366. border: 1px solid #2e58ff;
  367. border-radius: 16rpx;
  368. font-size: 20rpx;
  369. font-family: PingFang SC;
  370. font-weight: 500;
  371. color: #2e58ff;
  372. }
  373. }
  374. .time {
  375. font-size: $font-lg;
  376. color: $font-color-light;
  377. }
  378. }
  379. }
  380. .money {
  381. width: 50%;
  382. text-align: right;
  383. color: #db1935;
  384. font-size: $font-lg;
  385. }
  386. }
  387. .yeji {
  388. position: relative;
  389. margin: -72rpx auto 0;
  390. width: 690rpx;
  391. height: 143rpx;
  392. background: #ffffff;
  393. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  394. border-radius: 10rpx;
  395. display: flex;
  396. align-items: center;
  397. .yeji-a {
  398. width: 50%;
  399. display: flex;
  400. flex-direction: column;
  401. justify-content: center;
  402. align-items: center;
  403. .yeji-top {
  404. font-size: 28rpx;
  405. font-family: PingFang SC;
  406. font-weight: bold;
  407. color: #333333;
  408. }
  409. .yeji-buttom {
  410. font-size: 42rpx;
  411. font-family: PingFang SC;
  412. font-weight: bold;
  413. color: #333333;
  414. }
  415. }
  416. .border {
  417. width: 1rpx;
  418. height: 51rpx;
  419. background: #dddddd;
  420. }
  421. }
  422. .navbar {
  423. margin-top: 20rpx;
  424. display: flex;
  425. height: 88rpx;
  426. padding: 0 5px;
  427. background: #fff;
  428. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  429. position: relative;
  430. z-index: 10;
  431. .nav-item {
  432. flex: 1;
  433. display: flex;
  434. justify-content: center;
  435. align-items: center;
  436. height: 100%;
  437. font-size: 15px;
  438. color: #999999;
  439. position: relative;
  440. &.current {
  441. color: #000;
  442. &:after {
  443. content: '';
  444. position: absolute;
  445. left: 50%;
  446. bottom: 0;
  447. transform: translateX(-50%);
  448. width: 44px;
  449. height: 0;
  450. border-bottom: 2px solid #fe5b38;
  451. }
  452. }
  453. }
  454. }
  455. .buttom-box {
  456. position: relative;
  457. background-color: #ffffff;
  458. text-align: center;
  459. padding: 30rpx 0;
  460. .buttom {
  461. flex-grow: 1;
  462. }
  463. .money {
  464. font-size: 32rpx;
  465. font-weight: bold;
  466. color: #ff4173;
  467. }
  468. .text {
  469. padding-bottom: 26rpx;
  470. font-size: 28rpx;
  471. font-weight: 500;
  472. color: #666666;
  473. &.current {
  474. border-bottom: 2px solid #ff4173;
  475. }
  476. }
  477. .icon {
  478. height: 50rpx;
  479. width: 48rpx;
  480. margin: 0 auto;
  481. .icon-img {
  482. width: 100%;
  483. height: 100%;
  484. }
  485. }
  486. }
  487. .time-in {
  488. display: flex;
  489. margin-top: 20rpx;
  490. height: 100rpx;
  491. justify-content: space-around;
  492. align-items: center;
  493. background-color: #fff;
  494. .showtime {
  495. display: inline-block;
  496. width: 300rpx;
  497. height: 85rpx;
  498. background-color: #eee;
  499. border: 1px solid #999;
  500. border-radius: 20rpx;
  501. color: #000;
  502. font-size: 32rpx;
  503. padding-left: 20rpx;
  504. }
  505. .search {
  506. width: 100rpx;
  507. height: 50rpx;
  508. border-radius: 50rpx;
  509. background-color: #ff4575;
  510. font-size: 32rpx;
  511. text-align: center;
  512. line-height: 50rpx;
  513. color: #fff;
  514. }
  515. }
  516. </style>