| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331 |
- <template>
- <view class="content">
- <!-- <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> -->
- <view class="header">
- <image src="../../static/user/shopping.png" mode=""></image>
- <view class="integral">
- {{ integral || 0 }}
- </view>
- <!-- <navigator url="/pages/money/conversionIntegral"><view class="right">转换USDT</view></navigator> -->
- </view>
- <view class="navbar ">
- <view class="nav-item" v-for="(item,index) in navList" :key="index"
- :class="{current:tabCurrentIndex===index}" @click="tabClick(index)">{{item.text}}</view>
- </view>
- <swiper class="swiper-box" duration="300" :style="{ height: maxheight }" :current="tabCurrentIndex"
- @change="changeTab">
- <swiper-item class="tab-content" v-for="(item,index) in navList">
- <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
- <!-- 空白页 -->
- <!-- <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty> -->
- <empty v-if="item.loaded ===true && item.orderList.length===0"></empty>
- <!-- 订单列表 -->
- <view v-else class="order-item flex " v-for="orderItem in item.orderList">
- <view class="title-box ">
- <view class="title">
- <text>{{orderItem.mark}}</text>
- </view>
- <view class="time">
- <text>{{orderItem.add_time}}</text>
- </view>
- </view>
- <view class="money">
- <text>{{(orderItem.pm == 0?'-':'+')+orderItem.number}}</text>
- </view>
- </view>
- <!-- <uni-load-more :status="tabItem.loadingType"></uni-load-more> -->
- <uni-load-more :status="item.loadingType"></uni-load-more>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- </template>
- <script>
- import {
- moneyLog,
- wallet
- } from '@/api/finance.js';
- import { integral } from '@/api/wallet.js';
- //下拉加载
- import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
- import empty from '@/components/u-empty/u-empty.vue';
- export default {
- components: {
- uniLoadMore,
- empty
- },
- computed: {
- //积分
- // integral() {
- // return this.$store.state.user.userInfo.integral
- // }
- // ...mapState('user',['userInfo'])
- },
- onReady(res) {
- var _this = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.swiper-box').boundingClientRect();
- query.exec(function(res) {
- _this.maxheight = resu.windowHeight - res[0].top + 'px';
- console.log('打印页面的剩余高度', _this.height);
- });
- },
- fail: res => {}
- });
- },
- onLoad() {
- wallet({}).then(({
- data
- }) => {
- const obj = this
- const arr = Object.keys(data.back)
- console.log(data.back, '000');
- arr.forEach(e => {
- if (e == 'USDT') {
- obj.integral = (data.back[e].money.money * 1)
- console.log(obj.integral, '666');
- }
- })
- })
- this.loadData();
- },
- data() {
- return {
- tabCurrentIndex: 0, //判断亮不亮
- integral: 0, //我的积分
- maxheight: '',
- navList: [{
- state: 1,
- text: '收入',
- orderList: [], //里面的数据
- loadingType: 'More', //是否还有更多数据
- limit: 10, //一页10条
- page: 1
- },
- {
- text: '支出',
- state: 0,
- orderList: [],
- limit: 10,
- page: 1,
- loadingType: 'More'
- }
- ]
- };
- },
- onShow() {
- this.loadData()
- },
- methods: {
- // 下拉刷新
- async loadData(source) {
- console.log(source, "222");
- // 将订单挂载到tab列表下
- let index = this.tabCurrentIndex
- let item = this.navList[index];
- console.log(item);
- let state = item.state
- if (source === 'tabChange' && item.loaded === true) {
- return
- }
- if (item.loadingType === 'loading') {
- //防止重复加载
- return
- }
- //修改当前数据为加载中
- item.loadingType = 'loading'
- console.log(item.limit, '123456789987654321')
- integral({
- page: item.page,
- limit: item.limit,
- pm: item.state
- }).then(({
- data
- }) => {
- console.log(data, '123456');
-
- item.orderList = item.orderList.concat(data)
- item.page++
-
- //判断是否还有数据,没有就把提示语改成nomore,有就为more
- if (item.limit == data.length) {
- item.loadingType = 'more'
- return
- } else {
- item.loadingType = 'noMore'
- }
- this.$set(item, 'loaded', true)
- }).catch(e => {
- console.log(e)
- })
- },
- //tab点击
- tabClick(index) {
- this.tabCurrentIndex = index
- this.loadData('tabChange')
- console.log(this.tabCurrentIndex)
- },
- changeTab(e) {
- this.tabCurrentIndex = e.target.current
- console.log(this.tabCurrentIndex, '21')
- this.loadData('tabChange')
- }
- },
- };
- </script>
- <style lang="scss">
- page {
- background: #ffffff;
- height: 100%;
- }
- .header {
- image {
- width: 100%;
- height: 400rpx;
- }
- .integral {
- width: 100%;
- text-align: center;
- position: absolute;
- top: 160rpx;
- color: #fff;
- font-size: 80rpx;
- font-weight: bold;
- }
- .right {
- position: absolute;
- top: 120rpx;
- right: 0;
- background-color: #fff;
- border-radius: 10rpx 0 0 10rpx;
- color: #438BED;
- padding: 5rpx 15rpx;
- font-size: 28rpx;
- }
- }
- .navbar {
- display: flex;
- height: 40px;
- 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: $font-color-dark;
- position: relative;
- &.current {
- color: #438BED;
- &:after {
- content: '';
- position: absolute;
- left: 50%;
- bottom: 0;
- transform: translateX(-50%);
- width: 44px;
- height: 0;
- border-bottom: 2px solid #438BED;
- }
- }
- }
- }
- // 列表
- .swiper-box {
- height: calc(100% - 180rpx - 400rpx);
- padding-top: 10rpx;
- .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: #EF3A55;
- font-size: $font-lg;
- }
- }
- }
- .list-scroll-content {
- height: 100%;
- }
- .content {
- height: 100%;
- .empty-content {
- background-color: #ffffff;
- }
- }
- .button {
- height: 180rpx;
- width: 100%;
- display: flex;
- position: absolute;
- padding: 40rpx 30rpx 60rpx 30rpx;
- bottom: 0;
- text-align: center;
- .b-left,
- .b-right {
- flex: 1;
- height: 80rpx;
- line-height: 80rpx;
- margin: 0 30rpx;
- border-radius: 50rpx;
- }
- .b-left {
- color: #438BED;
- border: solid 1rpx #438BED;
- }
- .b-right {
- background: linear-gradient(90deg, #438BED 0%, #44BFEC 100%);
- color: #fff;
- }
- }
- </style>
|