123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312 |
- <template>
- <view class="content">
- <view class="" style="height: 20rpx;"></view>
- <view class="top-wrap">
- <view class="top-top flex">
- <view class="item ">
- <view class="val">
- {{pUser.holding_value || 0}}
- </view>
- <view class="name">
- 联盟共富值
- </view>
- </view>
- <view class="item">
- <view class="val">
- {{pUser.trem_holding_value ||0}}
- </view>
- <view class="">
- 总共富值
- </view>
- </view>
- </view>
- <view class="flex top-btm">
- <view class="">
- 当前等级:{{ pUser.zero_level ? pUser.zero_level.name:'暂无' }}
- </view>
- <view class="">
- 个人共富值:{{pUser.holding || 0}}
- </view>
- </view>
- </view>
- <view class="navbar">
- <view v-for="(item, index) in navList" :key="index" class="nav-item"
- :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
- </view>
- <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300"
- @change="changeTab">
- <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex" >
- <scroll-view scroll-y="true" class="good-content" @scrolltolower="loadData" :style="{ height: height }">
- <empty v-if="tabItem.loaded === true && tabItem.list.length === 0"></empty>
- <view>
- <view class="order-item flex" v-for="(item, index) in tabItem.list" :key="index">
- <view class="title-box">
- <view class="title">
- <text>{{ item.name }}</text>
- </view>
- <view class="time">
- <text>{{getTime(item.add_time) }}</text>
- </view>
- </view>
- <view class="money">
- <view>{{ item.holding_value }}</view>
- </view>
- </view>
- </view>
- <uni-load-more :status="tabItem.loadingType" v-if="!(tabItem.list.length == 0 && tabItem.loaded)"></uni-load-more>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- </template>
- <script>
- import empty from '@/components/empty.vue'
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import {
- getCardList,
- createPass,
- getGsList,
- passUser,
- passLst
- } from '@/api/zero.js'
- export default {
- components: {
- empty
- },
- data() {
- return {
- height: '',
- tabCurrentIndex: 0,
- pUser: {
- holding_value: 0,
- trem_holding_value: 0,
- zero_level: {
- name: ''
- }
- },
- navList: [{
- text: '个人',
- state: 1,
- loaded: false,
- list: [],
- page: 1,
- limit: 10,
- loadingType: 'more'
- },
- {
- text: '团队',
- state: 2,
- loaded: false,
- list: [],
- page: 1,
- limit: 10,
- loadingType: 'more'
- }
- ]
- }
- },
- onLoad() {
- },
- computed: {
- ...mapState('user', ['userInfo'])
- },
- onShow() {
- this.passUser()
- this.loadData()
- },
- onReachBottom() {
- },
- onReady() {
- var that = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.swiper-box').boundingClientRect();
- query.exec(function(res) {
- that.height = resu.windowHeight - res[0].top + 'px';
- });
- },
- fail: res => {}
- });
- },
- methods: {
- getTime(time) {
- const num =13 - (time+'').length;
- let l = 1;//倍数
- for (let i = 0; i < num; i++) {
- l+='0';
- }
- // 重新解析为数字
- l = parseInt(l)
- const date = new Date(parseInt(time) * l);
- const year = date.getFullYear();
- const mon = date.getMonth() + 1;
- const day = date.getDate();
- const hours = date.getHours();
- const minu = date.getMinutes();
- const sec = date.getSeconds();
- return year + '-' + mon + '-' + day + ' ' + hours + ':' + minu + ':' + sec;
- },
- //swiper 切换
- changeTab(e) {
- this.tabCurrentIndex = e.target.current;
- this.loadData('tabChange');
- },
- //顶部tab点击
- tabClick(index) {
- this.tabCurrentIndex = index;
- },
- passUser() {
- passUser().then(res => {
- // console.log()
- this.pUser = res.data
- })
- },
- loadData() {
- let that = this;
- let item = that.navList[that.tabCurrentIndex]
- let qdata = {
- page: item.page,
- limit: item.limit
- }
- if (item.state == 1) {
- qdata.uid = that.userInfo.uid
- } else {
- qdata.sp_uid = that.userInfo.uid
- }
- if(item.loadingType == 'loading' || item.loadingType == 'noMore') {
- return
- }
- item.loadingType = 'loading'
- passLst(qdata).then(res => {
- console.log(res)
- let arr = res.data.result.list
- item.list = item.list.concat(arr)
-
- if(item.limit == arr.length) {
- item.page++
- item.loadingType = 'more'
- }else {
- item.loadingType = 'noMore'
- }
- item.loaded = true
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .top-wrap {
- width: 690rpx;
- height: 320rpx;
- padding: 43rpx;
- padding-bottom: 0;
- background-color: #ebd4be;
- margin: auto;
- border-radius: 20rpx;
- text-align: center;
- font-size: 29rpx;
- font-weight: 400;
- color: #6E4019;
- .top-top {
- height: 200rpx;
- .item {
- flex-grow: 1;
- .val {
- font-size: 63rpx;
- font-weight: bold;
- }
- }
- }
- .top-btm {
- border-top: 1px solid #E3C5A8;
- view {
- flex-grow: 1;
- line-height: 80rpx;
- }
- }
- }
- .order-item {
- padding: 20rpx 30rpx;
- line-height: 1.5;
- .title-box {
- .title {
- font-size: $font-lg;
- color: $font-color-base;
- }
- .time {
- font-size: $font-base;
- color: $font-color-light;
- }
- }
- .money {
- color: #fd5b23;
- font-size: $font-lg;
- text-align: right;
- .status {
- color: $font-color-light;
- }
- }
- }
- .navbar {
- margin-top: 20rpx;
- display: flex;
- height: 88rpx;
- padding: 0 5px;
- background: #fff;
- box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
- position: relative;
- z-index: 10;
- .nav-item {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100%;
- font-size: 15px;
- color: #999999;
- position: relative;
- &.current {
- color: #000;
- &:after {
- content: '';
- position: absolute;
- left: 50%;
- bottom: 0;
- transform: translateX(-50%);
- width: 44px;
- height: 0;
- border-bottom: 2px solid $base-color;
- }
- }
- }
- }
- .swiper-box {
- background-color: #fff;
- }
- </style>
|