user.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. <template>
  2. <view class="container">
  3. <view class="topTitle">{{$t('user.我的收益')}}</view>
  4. <view class="flex moneyBox">
  5. <view class="moneyTpl bg2 flex">
  6. <view class="moneyNum">{{teamNum.num1}}</view>
  7. <view class="moneyTitle">{{$t('user.今日收益')}}</view>
  8. </view>
  9. <view class="moneyTpl bg flex">
  10. <view class="moneyNum">{{teamNum.num2}}</view>
  11. <view class="moneyTitle">{{$t('user.累计收益')}}</view>
  12. </view>
  13. <view class="moneyTpl bg1 flex">
  14. <view class="moneyNum">{{teamNum.num11}}</view>
  15. <view class="moneyTitle">{{$t('user.可用收益')}}</view>
  16. </view>
  17. </view>
  18. <view class="mybox" v-if='userInfo.point_level>0'>
  19. <view class="topTitle flex">{{$t('user.节点分布')}}<p class="p">{{$t('user.今日分红额度')}}{{teamNum.num12}}VGT</p>
  20. </view>
  21. <view class="flex fhboxs">
  22. <view class="fhli" @click="fhList(1)">
  23. <view class="fhtips os">L1</view>
  24. <view class="fhnum">
  25. <view class="fhnums">{{teamNum.num13}}</view>
  26. <view class="fhtxt">{{$t('user.人数')}}</view>
  27. <view class="fg"></view>
  28. <view class="fhnums">{{teamNum.num14}}</view>
  29. <view class="fhtxt">{{$t('user.分红比例')}}</view>
  30. </view>
  31. </view>
  32. <view class="fhli" @click="fhList(2)">
  33. <view class="fhtips ys">L2</view>
  34. <view class="fhnum">
  35. <view class="fhnums">{{teamNum.num15}}</view>
  36. <view class="fhtxt">{{$t('user.人数')}}</view>
  37. <view class="fg"></view>
  38. <view class="fhnums">{{teamNum.num16}}</view>
  39. <view class="fhtxt">{{$t('user.分红比例')}}</view>
  40. </view>
  41. </view>
  42. <view class="fhli" @click="fhList(3)">
  43. <view class="fhtips bs">L3</view>
  44. <view class="fhnum">
  45. <view class="fhnums">{{teamNum.num17}}</view>
  46. <view class="fhtxt">{{$t('user.人数')}}</view>
  47. <view class="fg"></view>
  48. <view class="fhnums">{{teamNum.num18}}</view>
  49. <view class="fhtxt">{{$t('user.分红比例')}}</view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="topTitle">{{$t('user.我的团队')}}</view>
  55. <view class="flex listBox">
  56. <view class="listTpl flex_item">
  57. <image class="tplIcon" src="/static/img/img20.png"></image><!-- /static/img/img20.png -->
  58. <view class="tplBox">
  59. <view class="num">{{teamNum.num3 || 0}}</view>
  60. <view class="name">{{$t('user.分享地址')}}</view>
  61. </view>
  62. </view>
  63. <view class="listTpl flex_item">
  64. <image class="tplIcon" src="/static/img/img22.png"></image>
  65. <view class="tplBox">
  66. <view class="num">{{teamNum.num4 || 0}}</view>
  67. <view class="name">{{$t('user.社区地址')}}</view>
  68. </view>
  69. </view>
  70. <view class="listTpl flex_item">
  71. <image class="tplIcon" src="/static/img/img27.png"></image>
  72. <view class="tplBox">
  73. <view class="num">{{teamNum.num5 || 0}}</view>
  74. <view class="name">{{$t('user.分享预约')}}</view>
  75. </view>
  76. </view>
  77. <view class="listTpl flex_item">
  78. <image class="tplIcon" src="/static/img/img21.png"></image>
  79. <view class="tplBox">
  80. <view class="num">{{teamNum.num6 || 0}}</view>
  81. <view class="name">{{$t('user.社区预约')}}</view>
  82. </view>
  83. </view>
  84. <view class="listTpl flex_item">
  85. <image class="tplIcon" src="/static/img/img24.png"></image>
  86. <view class="tplBox">
  87. <view class="num">{{teamNum.num7 || 0}}</view>
  88. <view class="name">{{$t('user.今日分享业绩')}}</view>
  89. </view>
  90. </view>
  91. <view class="listTpl flex_item">
  92. <image class="tplIcon" src="/static/img/img26.png"></image>
  93. <view class="tplBox">
  94. <view class="num">{{teamNum.num8 || 0}}</view>
  95. <view class="name">{{$t('user.今日社区业绩')}}</view>
  96. </view>
  97. </view>
  98. <view class="listTpl flex_item">
  99. <image class="tplIcon" src="/static/img/img23.png"></image>
  100. <view class="tplBox">
  101. <view class="num">{{teamNum.num9 || 0}}</view>
  102. <view class="name">{{$t('user.分享业绩')}}</view>
  103. </view>
  104. </view>
  105. <view class="listTpl flex_item">
  106. <image class="tplIcon" src="/static/img/img25.png"></image>
  107. <view class="tplBox">
  108. <view class="num">{{teamNum.num10 || 0}}</view>
  109. <view class="name">{{$t('user.社区业绩')}}</view>
  110. </view>
  111. </view>
  112. </view>
  113. <view class="recordBox">
  114. <view class="recordNav flex">
  115. <view class="navItem" v-for="item,index in recordNav" :key="index"
  116. :class="{ active: tabIndex == index }" @click="changeTab(index)">
  117. {{item.langName}}
  118. </view>
  119. </view>
  120. <view class="recordList" v-if="tabIndex == 0">
  121. <view class="listTpls flex boderBom">
  122. <view class="tpls title">{{$t('user.地址')}}</view>
  123. <view class="tpls title">{{$t('user.时间')}}</view>
  124. </view>
  125. <view class="listTpls flex paddTop" v-for="item,index in recordNavList[0].list">
  126. <view class="tpls">{{item.addressSub}}</view>
  127. <view class="tpls time">{{item.timetext}}</view>
  128. </view>
  129. </view>
  130. <view class="recordList" v-if="tabIndex == 1 || tabIndex == 2 ">
  131. <view class="listTpls flex boderBom">
  132. <view class="tpls title" >{{$t('user.金额')}}</view>
  133. <view class="tpls title typeStatus" >{{tabIndex == 1 || tabIndex == 2 ?$t('user.说明'):$t('user.状态')}}</view>
  134. <view class="tpls title">{{$t('user.时间')}}</view>
  135. </view>
  136. <view class="listTpls flex paddTop" v-for="item,index in recordNavList[tabIndex].list">
  137. <view class="tpls" >{{item.money}}{{item.token}}</view>
  138. <view class="tpls" >{{item.title}}</view>
  139. <view class="tpls time">{{item.timetext}}</view>
  140. </view>
  141. </view>
  142. <view class="recordList" v-if=" tabIndex == 3">
  143. <view class="listTpls flex boderBom">
  144. <view class="tpls title u-line-1" >{{$t('user.金额')}}</view>
  145. <view class="tpls title typeStatus" >{{$t('user.状态')}}</view>
  146. <view class="tpls title">{{$t('user.时间')}}</view>
  147. </view>
  148. <view class="listTpls flex paddTop" v-for="item,index in recordNavList[tabIndex].list">
  149. <view class="tpls u-line-1" >{{item.number}}{{item.token}}</view>
  150. <view class="tpls" v-if="item.status==1">{{$t('user.已通过')}}</view>
  151. <view class="tpls" v-if="item.status==0">{{$t('user.待审核')}}</view>
  152. <view class="tpls" v-if="item.status==2">{{$t('user.已拒绝')}}</view>
  153. <view class="tpls time">{{item.timetext}}</view>
  154. </view>
  155. </view>
  156. <u-loadmore :status="loading" line :loadmoreText="$t('base.加载更多')" :loadingText="$t('base.正在加载')"
  157. :nomoreText="$t('base.没有更多了')" />
  158. </view>
  159. <taber></taber>
  160. </view>
  161. </template>
  162. <script>
  163. import {
  164. spreadList,
  165. getTokenLog,
  166. extractLog,
  167. group_info
  168. } from '@/api/index.js';
  169. import {
  170. saveUrl,
  171. interceptor
  172. } from '@/utils/loginUtils.js';
  173. import {
  174. mapState,
  175. mapActions,
  176. mapMutations
  177. } from "vuex";
  178. import taber from "@/components/footer/footer.vue";
  179. export default {
  180. components: {
  181. taber
  182. },
  183. data() {
  184. return {
  185. tabIndex: 0,
  186. recordList: [{}, {}, {}, {}, {}, {}, {}, {}],
  187. recordNavList: [{
  188. name: "团队明细",
  189. langName: '',
  190. type: 1,
  191. list: [],
  192. }, {
  193. name: "余额明细",
  194. langName: '',
  195. type: 2,
  196. list: [],
  197. }, {
  198. name: "VGT明细",
  199. langName: '',
  200. type: 3,
  201. list: [],
  202. }, {
  203. name: "提现明细",
  204. langName: '',
  205. type: 4,
  206. list: [],
  207. }],
  208. page: 1,
  209. limit: 10,
  210. loading: 'loadmore', //加载状态
  211. teamNum: {}, //状态值
  212. }
  213. },
  214. computed: {
  215. ...mapState({
  216. langList: "langList",
  217. lang: "lang",
  218. }),
  219. ...mapState('user', ['userInfo', 'hasLogin']),
  220. label() {
  221. const label = this.langList.find((item) => {
  222. console.log(this.lang, item.value);
  223. return item.value == this.lang
  224. }).label;
  225. return label
  226. },
  227. recordNav() {
  228. for (var i = 0; i < this.recordNavList.length; i++) {
  229. this.recordNavList[i].langName = this.$t(`user.${this.recordNavList[i].name}`)
  230. }
  231. return this.recordNavList
  232. }
  233. },
  234. onLoad(option) {
  235. if (option.spread) {
  236. // 存储其他邀请人
  237. uni.setStorageSync('spread', option.spread);
  238. }
  239. },
  240. onShow() {
  241. if (!this.hasLogin) {
  242. // 保存地址
  243. saveUrl();
  244. // 登录拦截
  245. interceptor();
  246. } else {
  247. this.group_info();
  248. this.changeTab(this.tabIndex)
  249. }
  250. },
  251. onReachBottom() {
  252. this.loadData();
  253. },
  254. methods: {
  255. ...mapMutations('user', ['setUserInfo', 'login']),
  256. // 获取登录记录
  257. group_info() {
  258. group_info().then((res) => {
  259. for(let a in res.data ){
  260. res.data[a] = +(+res.data[a]).toFixed(2)
  261. }
  262. this.teamNum = res.data;
  263. }).catch((res) => {
  264. console.log(res);
  265. })
  266. },
  267. fhList(type) {
  268. // uni.navigateTo({
  269. // url: '/pages/user/fhlist?type=' + type
  270. // })
  271. },
  272. // 分类记录
  273. tokenLogType(item, type) {
  274. const that = this;
  275. getTokenLog({
  276. page: that.page,
  277. limit: that.limit,
  278. token: type,
  279. }).then((res) => {
  280. const arr = res.data.list.map((re) => {
  281. re.timetext = that.$util.getTime(re.createtime);
  282. re.money =+(+re.money).toFixed(2);
  283. return re
  284. });
  285. item.list = item.list.concat(arr);
  286. console.log(arr.length);
  287. if (arr.length != that.limit) {
  288. console.log(that.loding,'5');
  289. that.loading = 'nomore'
  290. } else {
  291. console.log(that.loding,'3');
  292. that.page++
  293. that.loading = 'loadmore'
  294. }
  295. }).catch((res) => {
  296. console.log(res);
  297. })
  298. },
  299. // 分类记录
  300. extractLog(item) {
  301. const that = this;
  302. extractLog({
  303. page: that.page,
  304. limit: that.limit,
  305. }).then((res) => {
  306. const arr = res.data.list.map((re) => {
  307. re.timetext = that.$util.getTime(re.createtime);
  308. re.number = +re.number;
  309. return re
  310. });
  311. console.log(arr.length!=that.limit);
  312. item.list = item.list.concat(arr);
  313. if (arr.length != that.limit) {
  314. console.log(that.loading,'5');
  315. that.loading = 'nomore'
  316. } else {
  317. console.log(that.loading,'3');
  318. that.page++
  319. that.loading = 'loadmore'
  320. console.log(that.loading,'4');
  321. }
  322. }).catch((res) => {
  323. console.log(res);
  324. })
  325. },
  326. // 请求载入数据
  327. async loadData() {
  328. const that = this;
  329. const arr = this.recordNavList[this.tabIndex];
  330. if (that.loading == 'nomore' || that.loading == "loading") {
  331. return
  332. }
  333. that.loading = 'loading';
  334. switch (arr.type) {
  335. case 1:
  336. that.spreadList(arr)
  337. break;
  338. case 2:
  339. that.tokenLogType(arr, "USDT")
  340. break;
  341. case 3:
  342. that.tokenLogType(arr, "VGT")
  343. break;
  344. case 4:
  345. that.extractLog(arr)
  346. break;
  347. default:
  348. break;
  349. }
  350. },
  351. // 邀请人员记录
  352. spreadList(item) {
  353. const that = this;
  354. spreadList({
  355. page: that.page,
  356. limit: that.limit,
  357. }).then((res) => {
  358. const arr = res.data.data.list.map((re) => {
  359. if (re.address) {
  360. let st = re.address.slice(8, re.address.length - 8)
  361. re.addressSub = re.address.replace(st, "...")
  362. }
  363. re.timetext = that.$util.getTime(re.spread_time)
  364. return re
  365. });
  366. item.list = item.list.concat(arr);
  367. if (arr.length != that.limit) {
  368. that.loading = 'nomore'
  369. } else {
  370. that.page++
  371. that.loading = 'loadmore'
  372. }
  373. }).catch((res) => {
  374. console.log(res);
  375. })
  376. },
  377. //切换记录tab
  378. changeTab(index) {
  379. this.tabIndex = index;
  380. this.page = 1;
  381. this.loading = 'loadmore';
  382. this.recordNavList[index].list = [];
  383. this.loadData();
  384. },
  385. },
  386. }
  387. </script>
  388. <style lang="scss">
  389. .container {
  390. width: 100%;
  391. padding: 25rpx;
  392. line-height: 1;
  393. }
  394. .topTitle {
  395. font-size: 36rpx;
  396. font-weight: bold;
  397. color: #000000;
  398. padding: 25rpx 0rpx;
  399. .p {
  400. font-size: $font-sm;
  401. color: $font-color-light;
  402. }
  403. }
  404. .moneyBox {
  405. margin-bottom: 25rpx;
  406. .moneyTpl {
  407. flex-direction: column;
  408. width: 218rpx;
  409. height: 230rpx;
  410. padding: 0 10rpx;
  411. position: relative;
  412. text-align: center;
  413. padding-top: 120rpx;
  414. line-height: 1;
  415. padding-bottom: 10rpx;
  416. .moneyNum {
  417. flex-grow: 1;
  418. }
  419. .moneyTitle {
  420. flex-grow: 1;
  421. }
  422. }
  423. }
  424. .bg {
  425. background: url('../../static/img/img17.png') no-repeat;
  426. background-size: 100% 100%;
  427. color: #D08500;
  428. }
  429. .bg1 {
  430. background: url('../../static/img/img18.png') no-repeat;
  431. background-size: 100% 100%;
  432. color: #D34D00;
  433. }
  434. .bg2 {
  435. background: url('../../static/img/img19.png') no-repeat;
  436. background-size: 100% 100%;
  437. color: #2DACD7;
  438. }
  439. .listBox {
  440. flex-wrap: wrap;
  441. .listTpl {
  442. width: 50%;
  443. .tplIcon {
  444. width: 158rpx;
  445. height: 158rpx;
  446. }
  447. .tplBox {
  448. width: calc(100% - 158rpx);
  449. position: relative;
  450. top: -10rpx;
  451. font-weight: bold;
  452. .num {
  453. font-size: 37rpx;
  454. color: #0041FD;
  455. }
  456. .name {
  457. font-size: 28rpx;
  458. margin-top: 10rpx;
  459. color: #7E7E7E;
  460. }
  461. }
  462. }
  463. }
  464. .recordBox {
  465. padding: 0rpx 30rpx;
  466. background-color: #fff;
  467. border-radius: 25rpx;
  468. margin-top: 50rpx;
  469. padding-bottom: 10rpx;
  470. .recordNav {
  471. padding: 40rpx 0rpx;
  472. .navItem {
  473. width: 23%;
  474. text-align: center;
  475. font-size: 28rpx;
  476. font-weight: 500;
  477. }
  478. .active {
  479. background: #14C670;
  480. border-radius: 10rpx;
  481. color: #FFFFFF;
  482. line-height: 70rpx;
  483. }
  484. }
  485. .recordList {
  486. .listTpls {
  487. text-align: center;
  488. .title,
  489. .time {
  490. color: #666666;
  491. }
  492. .tpls {
  493. font-size: $font-base;
  494. text-align: center;
  495. width: 30%;
  496. flex-grow: 1;
  497. flex-shrink: 0;
  498. &.typeStatus{
  499. width: 20%;
  500. flex-grow: 1;
  501. flex-shrink: 0;
  502. }
  503. }
  504. }
  505. .boderBom {
  506. padding-bottom: 25rpx;
  507. border-bottom: 1rpx solid #EDF0FA;
  508. margin-bottom: 25rpx;
  509. }
  510. .paddTop {
  511. padding-top: 28rpx;
  512. }
  513. }
  514. }
  515. .mybox {
  516. margin-bottom: 30rpx;
  517. .title {
  518. color: #000;
  519. font-size: 36rpx;
  520. margin-left: 10rpx;
  521. align-items: flex-end;
  522. .p {
  523. color: #333;
  524. font-size: 24rpx;
  525. margin-left: 12rpx;
  526. }
  527. }
  528. .fhboxs {
  529. border-radius: 20rpx;
  530. background-color: #fff;
  531. padding: 25rpx 0;
  532. justify-content: space-around;
  533. .fhli {
  534. background-color: #EDF5F9;
  535. border-radius: 16rpx;
  536. width: 191rpx;
  537. height: auto;
  538. .fhtips {
  539. width: 68rpx;
  540. height: 36rpx;
  541. border-radius: 16rpx 0px 24rpx 0px;
  542. text-align: center;
  543. font-size: 24rpx;
  544. color: #fff;
  545. line-height: 36rpx;
  546. }
  547. .fhnum {
  548. width: 74%;
  549. margin: 24rpx 24rpx 48rpx 24rpx;
  550. color: #41ADD0;
  551. text-align: center;
  552. .fhnums {
  553. font-size: 36rpx;
  554. font-weight: bold;
  555. }
  556. .fhtxt {
  557. font-size: 24rpx;
  558. margin-top: 8rpx;
  559. }
  560. .fg {
  561. width: 100%;
  562. height: 1rpx;
  563. background-color: #41ADD0;
  564. margin: 24rpx 0;
  565. }
  566. }
  567. .os {
  568. background-color: #FF630C;
  569. }
  570. .ys {
  571. background-color: #FFCB0C;
  572. }
  573. .bs {
  574. background-color: #0CAEFF;
  575. }
  576. }
  577. }
  578. }
  579. </style>