| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- <template>
- <view class="content">
- <view class="top-bg">
-
- </view>
- <view class="yue-wrap flex">
- <view class="yue-tit">
- 总积分
- </view>
- <view class="yue-num flex">
- <view class="yue">
- {{userInfo.integral || '0.00'}}
- </view>
- <!-- <view class="cz" @click="navto('/pages/money/recharge')">
- 充值
- <image src="../../static/icon/dz.png" mode="widthFix"></image>
- </view> -->
- </view>
- <view class="lj-wrap flex">
- <view class="">
- <!-- 累计消费:¥{{ userInfo.orderStatusSum || '0'}} -->
- </view>
- <view class="">
- <!-- 累计充值:¥{{ userInfo.recharge || '0' }} -->
- </view>
- </view>
- </view>
- <scroll-view scroll-y="true" class="jl-wrap" :style="{'height': maxheight}" @scrolltolower="loadData">
- <view>
- <empty v-if="navList[tabCurrentIndex].orderList.length == 0 && navList[tabCurrentIndex].loaded" ></empty>
- <view class="jl " v-for="item in navList[tabCurrentIndex].orderList">
- <view class="jl-tit flex">
- <view class="clamp2 tit">
- {{item.mark}}
- </view>
- <view class="price" :class="{'add':item.pm == 1,'jian': item.pm == 0}">
- {{item.number*1}}
- </view>
- </view>
- <view class="jl-mark flex">
- <!-- <view class="mark">
- {{item.mark}}
- </view> -->
- <view class="">
- {{item.add_time}}
- </view>
- </view>
- </view>
- <uni-load-more :status="navList[tabCurrentIndex].loadingType" v-if="!(navList[tabCurrentIndex].orderList.length == 0 && navList[tabCurrentIndex].loaded)"></uni-load-more>
- </view>
- </scroll-view>
- </view>
- </template>
- <script>
- import { mapState, mapMutations } from 'vuex';
- import { integrallist } from '@/api/functionalUnit.js';
- import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
- import empty from '@/components/empty';
- export default {
- components: {
- empty,
- uniLoadMore
- },
- computed: {
- ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
- },
- onReady(res) {
- var obj = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.swiper-box').boundingClientRect();
- query.exec(function(res) {
- obj.height = resu.windowHeight - res[0].top + 'px';
- console.log('打印页面的剩余高度', obj.height);
- });
- },
- fail: res => {}
- });
- },
- data() {
- return {
- height: '',
- maxheight: 0,
- tabCurrentIndex: 0,
- navList: [
- {
- state: 1,
- text: '收入',
- loadingType: 'more',
- orderList: [],
- page: 1, //当前页面
- limit: 10 //每次信息条数
- },
- {
- state: 0,
- text: '支出',
- loadingType: 'more',
- orderList: [],
- page: 1, //当前页面
- limit: 10 //每次信息条数
- }
- ],
- score: 0 //积分
- };
- },
- onShow() {
- // 载入积分数据
- this.loadData();
- },
- onReady() {
- // 初始化获取页面宽度
- var obj = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.jl-wrap').boundingClientRect();
- query.exec(function(res) {
- obj.maxheight = resu.windowHeight - res[0].top + 'px';
- });
- },
- fail: res => {}
- });
- },
- methods: {
- // 页面跳转
- navto(e) {
- uni.navigateTo({
- url: e
- });
- },
- //获取收入支出信息
- async loadData(source) {
- //这里是将订单挂载到tab列表下
- let index = this.tabCurrentIndex;
- let navItem = this.navList[index];
- let state = navItem.state;
- if (source === 'tabChange' && navItem.loaded === true) {
- //tab切换只有第一次需要加载数据
- return;
- }
- if (navItem.loadingType === 'loading') {
- //防止重复加载
- return;
- }
- // 修改当前对象状态为加载中
- navItem.loadingType = 'loading';
- integrallist(
- {
- page: navItem.page,
- limit: navItem.limit
- }
- )
- .then(({ data }) => {
- console.log(data);
- if (data.length > 0) {
- let list = [];
- data.forEach(item => {
- list.push(item);
- });
- navItem.orderList = navItem.orderList.concat(list);
- navItem.page++;
- }
- if (navItem.limit == data.length) {
- //判断是否还有数据, 有改为 more, 没有改为noMore
- navItem.loadingType = 'more';
- return;
- } else {
- //判断是否还有数据, 有改为 more, 没有改为noMore
- navItem.loadingType = 'noMore';
- }
- uni.hideLoading();
- this.$set(navItem, 'loaded', true);
- })
- .catch(e => {
- console.log(e);
- });
- },
- //swiper 切换
- changeTab(e) {
- this.tabCurrentIndex = e.target.current;
- this.loadData('tabChange');
- },
- //顶部tab点击
- tabClick(index) {
- this.tabCurrentIndex = index;
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- background-color: #fff;
- height: auto;
- min-height: 100%;
- }
- .top-bg {
- background-color: #ee2f72;
- height: 180rpx;
- width: 750rpx;
- }
- .yue-wrap {
- width: 670rpx;
- height: 320rpx;
- margin: -160rpx auto 30rpx;
- background: linear-gradient(-70deg, #FF77A7, #FF4A8A);
- box-shadow: 0px 15rpx 22rpx 6rpx rgba(238, 47, 114, 0.1);
- border-radius: 25rpx;
- color: #fff;
- font-size: 26rpx;
- padding: 50rpx 75rpx;
- flex-direction: column;
- justify-content: space-between;
- align-items: flex-start;
- .yue-num {
- width: 100%;
- justify-content: space-between;
- .yue {
- font-size: 76rpx;
- font-weight: bold;
- }
- .cz {
- image {
- width: 13rpx;
- margin-left: 10rpx;
- }
- }
- }
- .lj-wrap {
- width: 100%;
- justify-content: space-between;
- font-size: 24rpx;
- }
- }
- .jl {
- width: 670rpx;
- margin: 0 auto 20rpx;
- padding: 35rpx 30rpx;
- background: #FFFFFF;
- box-shadow: 0px 0px 28px 0px rgba(48, 48, 48, 0.1);
- border-radius: 8px;
- .jl-tit {
- width: 100%;
- font-size: 28rpx;
- font-weight: bold;
- color: #333333;
- .tit {
- max-width: 450rpx;
- }
- .price {
- font-size: 38rpx;
- font-weight: bold;
- }
- .add {
- color: #EE2F72;
- &::before {
- content: '+';
- font-size: 28rpx;
- color: #EE2F72;
- }
- }
- .jian {
- color: #808080;
- &::before {
- content: '-';
- font-size: 28rpx;
- }
- }
- }
- .jl-mark {
- padding-top: 20rpx;
- width: 100%;
- font-size: 24rpx;
- font-weight: 500;
- color: #808080;
- align-items: flex-start;
- // justify-content: flex-end;
- .mark {
- max-width: 470rpx;
- }
- }
- }
- </style>
|