team.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  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">{{ total_sum|| '0' }}</view>
  18. <view>我的推广人数</view>
  19. </view>
  20. <!-- <view class="money-box" style="padding-top: 20rpx;" v-if="order*1 > 0">
  21. <view>直推:{{zt_order}}单</view>
  22. <view>间推:{{jt_order}}单</view>
  23. </view> -->
  24. </view>
  25. <!-- <view class="flex buttom-box">
  26. <view class="buttom" @click="tabClick(0)">
  27. <view class="money">{{all || 0}}</view>
  28. <text class="text" :class="{ current: tabCurrentIndex === 0 }">直接推广</text>
  29. </view>
  30. <view class="buttom" @click="tabClick(1)">
  31. <view class="money">{{totalLevel || 0}}</view>
  32. <text class="text" :class="{ current: tabCurrentIndex === 1 }">间接推广</text>
  33. </view>
  34. </view> -->
  35. <scroll-view class="list-scroll-content" :style="{ height: maxheight }" scroll-y
  36. @scrolltolower="loadData">
  37. <empty v-if="loaded === true && list === 0"></empty>
  38. <view v-for="(item, index) in list" :key="index" class="order-item flex" @click="loadData('reload',item.uid)">
  39. <view class="title-box flex_item">
  40. <view class="title-avatar">
  41. <image :src="item.avatar"></image>
  42. </view>
  43. <view class="list_tpl">
  44. <view class="title">
  45. <view class="title-name clamp">{{ item.nickname }}</view>
  46. </view>
  47. <view class="time">
  48. <text>{{ showLevel(item.level)}}</text>
  49. </view>
  50. <view class="time">
  51. <text>{{ item.spread_time }}</text>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <uni-load-more :status="loadingType"></uni-load-more>
  57. </scroll-view>
  58. </view>
  59. </template>
  60. <script>
  61. import {
  62. myspread,
  63. levelgrade
  64. } from '@/api/user.js';
  65. import empty from '@/components/empty';
  66. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  67. import {
  68. mapState,
  69. mapMutations
  70. } from 'vuex';
  71. export default {
  72. components: {
  73. empty,
  74. uniLoadMore
  75. },
  76. filters: {
  77. showLevel(val) {
  78. let str = '';
  79. switch (val*1){
  80. case 1:
  81. str = '(普通会员)'
  82. break;
  83. case 2:
  84. str = '(青铜会员)'
  85. break;
  86. case 3:
  87. str = '(黄铜会员)'
  88. break;
  89. case 4:
  90. str = '(白银会员)'
  91. break;
  92. case 5:
  93. str = '(黄金会员)'
  94. break;
  95. default:
  96. break;
  97. }
  98. return str
  99. },
  100. getTime(val) {
  101. console.log(val)
  102. let date = new Date(val * 1000);
  103. let Y = date.getFullYear();
  104. let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
  105. let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
  106. return Y + '.' + M + '.' + D;
  107. },
  108. },
  109. onReady(res) {
  110. var _this = this;
  111. uni.getSystemInfo({
  112. success: resu => {
  113. const query = uni.createSelectorQuery();
  114. query.select('.list-scroll-content').boundingClientRect();
  115. query.exec(function(res) {
  116. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  117. console.log('打印页面的剩余高度', _this.maxheight);
  118. });
  119. },
  120. fail: res => {}
  121. });
  122. },
  123. data() {
  124. return {
  125. levelList:[],
  126. total_sum: '',
  127. // 头部图高度
  128. maxheight: '',
  129. tabCurrentIndex: 0,
  130. loadingType: 'more',
  131. loaded:false,
  132. all: '',
  133. list: [],
  134. totalLevel: '',
  135. order: '',
  136. zt_order: '',
  137. jt_order: '',
  138. page: 1,
  139. limit: 10,
  140. uid: 0
  141. };
  142. },
  143. computed: {
  144. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
  145. ...mapState(['baseURL'])
  146. },
  147. onLoad(options) {},
  148. async onShow() {
  149. await this.levelgrade()
  150. this.loadData();
  151. },
  152. methods: {
  153. levelgrade() {
  154. levelgrade().then(res => {
  155. console.log(res)
  156. this.levelList = res.data.list
  157. console.log(this.levelList)
  158. })
  159. },
  160. showLevel(level) {
  161. let str = '游客'
  162. this.levelList.forEach(item => {
  163. if(item.grade == level) {
  164. // return item.name
  165. str = '已加入' + item.name
  166. }
  167. })
  168. return str
  169. },
  170. // 页面跳转
  171. navto(e) {
  172. uni.navigateTo({
  173. url: e
  174. });
  175. },
  176. //获取收入支出信息
  177. async loadData(type,uid) {
  178. let that = this
  179. if(!uid) {
  180. that.userInfo.uid
  181. }
  182. if(type == 'reload') {
  183. that.loadingType = 'more'
  184. that.loaded = false
  185. that.list = []
  186. that.page = 1
  187. }
  188. if (that.loadingType === 'loading') {
  189. //防止重复加载
  190. return;
  191. }
  192. if (that.loadingType === 'noMore') {
  193. //防止重复加载
  194. return;
  195. }
  196. // 修改当前对象状态为加载中
  197. that.loadingType = 'loading';
  198. myspread({
  199. page: that.page,
  200. limit: that.limit,
  201. uid: uid || that.userInfo.uid
  202. })
  203. .then(({
  204. data
  205. }) => {
  206. console.log(data);
  207. if(type == 'reload') {
  208. }else {
  209. that.total_sum = data.total_sum
  210. }
  211. that.page++
  212. that.list = that.list.concat(data.list)
  213. if(that.limit == data.list.length) {
  214. that.loadingType = 'more'
  215. }else {
  216. that.loadingType = 'noMore'
  217. }
  218. that.loaded = true
  219. })
  220. .catch(e => {
  221. console.log(e);
  222. });
  223. },
  224. //swiper 切换
  225. changeTab(e) {
  226. this.tabCurrentIndex = e.target.current;
  227. this.loadData('tabChange');
  228. },
  229. //顶部tab点击
  230. tabClick(index) {
  231. this.tabCurrentIndex = index;
  232. },
  233. // 点击返回 我的页面
  234. toBack() {
  235. uni.switchTab({
  236. url: '/pages/user/user'
  237. });
  238. }
  239. }
  240. };
  241. </script>
  242. <style lang="scss">
  243. page {
  244. background: #f8f8f8;
  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: 480rpx;
  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: #fffeff;
  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: 90rpx;
  308. color: #ffffff;
  309. text-align: center;
  310. .money {
  311. font-size: 72rpx;
  312. font-family: PingFang SC;
  313. font-weight: bold;
  314. color: #ffffff;
  315. }
  316. .text {
  317. font-size: 30rpx;
  318. }
  319. }
  320. .order-item {
  321. padding: 20rpx 30rpx;
  322. line-height: 1.5;
  323. background-color: #fff;
  324. .title-box {
  325. width: 100%;
  326. .title-avatar {
  327. flex-shrink: 0;
  328. width: 100rpx;
  329. height: 100rpx;
  330. margin-right: 25rpx;
  331. border-radius: 100%;
  332. image {
  333. width: 100%;
  334. height: 100%;
  335. border-radius: 100%;
  336. }
  337. }
  338. .list_tpl {
  339. width: 85%;
  340. .title {
  341. display: flex;
  342. justify-content: flex-start;
  343. font-size: $font-lg;
  344. color: $font-color-base;
  345. overflow: hidden; //超出的文本隐藏
  346. text-overflow: ellipsis; //溢出用省略号显示
  347. white-space: nowrap;
  348. line-height: 1;
  349. text-align: center;
  350. .title-name {
  351. max-width: 40%;
  352. }
  353. .dl {
  354. margin-left: 10rpx;
  355. width: 93rpx;
  356. height: 32rpx;
  357. border-radius: 16rpx;
  358. image {
  359. width: 93rpx;
  360. height: 32rpx;
  361. border-radius: 16rpx;
  362. }
  363. }
  364. .class {
  365. display: inline-block;
  366. margin-left: 10rpx;
  367. padding: 6rpx;
  368. text-align: center;
  369. border: 1px solid #2e58ff;
  370. border-radius: 16rpx;
  371. font-size: 20rpx;
  372. font-family: PingFang SC;
  373. font-weight: 500;
  374. color: #2e58ff;
  375. }
  376. }
  377. .time {
  378. font-size: $font-lg;
  379. color: $font-color-light;
  380. }
  381. }
  382. }
  383. .money {
  384. width: 50%;
  385. text-align: right;
  386. color: #db1935;
  387. font-size: $font-lg;
  388. }
  389. }
  390. .yeji {
  391. position: relative;
  392. margin: -72rpx auto 0;
  393. width: 690rpx;
  394. height: 143rpx;
  395. background: #ffffff;
  396. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  397. border-radius: 10rpx;
  398. display: flex;
  399. align-items: center;
  400. .yeji-a {
  401. width: 50%;
  402. display: flex;
  403. flex-direction: column;
  404. justify-content: center;
  405. align-items: center;
  406. .yeji-top {
  407. font-size: 28rpx;
  408. font-family: PingFang SC;
  409. font-weight: bold;
  410. color: #333333;
  411. }
  412. .yeji-buttom {
  413. font-size: 42rpx;
  414. font-family: PingFang SC;
  415. font-weight: bold;
  416. color: #333333;
  417. }
  418. }
  419. .border {
  420. width: 1rpx;
  421. height: 51rpx;
  422. background: #dddddd;
  423. }
  424. }
  425. .navbar {
  426. margin-top: 20rpx;
  427. display: flex;
  428. height: 88rpx;
  429. padding: 0 5px;
  430. background: #fff;
  431. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  432. position: relative;
  433. z-index: 10;
  434. .nav-item {
  435. flex: 1;
  436. display: flex;
  437. justify-content: center;
  438. align-items: center;
  439. height: 100%;
  440. font-size: 15px;
  441. color: #999999;
  442. position: relative;
  443. &.current {
  444. color: #000;
  445. &:after {
  446. content: '';
  447. position: absolute;
  448. left: 50%;
  449. bottom: 0;
  450. transform: translateX(-50%);
  451. width: 44px;
  452. height: 0;
  453. border-bottom: 2px solid #fe5b38;
  454. }
  455. }
  456. }
  457. }
  458. .buttom-box {
  459. position: relative;
  460. background-color: #ffffff;
  461. text-align: center;
  462. padding: 30rpx 0;
  463. .buttom {
  464. flex-grow: 1;
  465. }
  466. .money{
  467. font-size: 32rpx;
  468. font-weight: bold;
  469. color: #ff4173;
  470. }
  471. .text {
  472. padding-bottom: 26rpx;
  473. font-size: 28rpx;
  474. font-weight: 500;
  475. color: #666666;
  476. &.current {
  477. border-bottom: 2px solid #ff4173;
  478. }
  479. }
  480. .icon {
  481. height: 50rpx;
  482. width: 48rpx;
  483. margin: 0 auto;
  484. .icon-img {
  485. width: 100%;
  486. height: 100%;
  487. }
  488. }
  489. }
  490. </style>