123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <template>
- <view>
- <u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="我的盲豆"></u-navbar>
- <view class="bean">
- <view class="flex bean-balance">
- <image src="../../static/icon/bean.png" mode="aspectFill"></image>
- <view class="bean-balance-num">{{ initData.coinNum }}</view>
- </view>
- <view class="bean-list">
- <view class="flex bean-list-item" v-for="(item, index) in list" :key="index">
- <view class="flex left">
- <view class="title">{{ item.logText }}</view>
- <view class="date">{{ $parseTime(item.createdTime) }}</view>
- </view>
- <view class="flex right">
- <view class="amt">{{ item.logMoney }}</view>
- <view class="balance">余额:{{ item.money }}</view>
- </view>
- </view>
- </view>
- <view class="flex empty" v-if="!list.length">
- <u-empty text="数据为空" mode="order" />
- </view>
- </view>
- </view>
- </template>
- <script>
- import $http from '@/utils/request.js'
- export default {
- data() {
- return {
- initData: {},
- pageNum: 1,
- total: 0,
- list: [],
- };
- },
- onShow() {
- this.getBean()
- this.pageList()
- },
- methods: {
- getBean() {
- uni.showLoading({
- title: '加载中'
- });
- $http.post('/api/v1/mp/user/mine/init', {}).then(res => {
- uni.hideLoading();
- if (res.code == 0) {
- this.initData = res.data
- }
- }).catch(() => {
- uni.hideLoading();
- })
- },
- getList() {
- uni.showLoading({
- title: '加载中'
- });
- $http.post(`/api/v1/mp/user/mine/coin/log/list?pageNum=${this.pageNum}&pageSize=50`, {}).then(res => {
- uni.hideLoading();
- if (res.code == 0) {
- res.rows.forEach(item => {
- item.type = item.type ? JSON.parse(item.type) : ''
- })
- this.total = res.total
- this.list = this.list.concat(res.rows)
- }
- }).catch(() => {
- uni.hideLoading();
- })
- },
- pageList() {
- this.pageNum = 1
- this.total = 0
- this.list = []
- this.getList()
- }
- },
-
- onReachBottom() {
- // 判断是否有数据
- if (this.total > this.pageNum * 50) {
- setTimeout(() => {
- ++this.pageNum
- this.getList()
- }, 500)
- } else {
- uni.$u.toast('没有更多数据了')
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .bean {
- margin: 20rpx 10rpx;
- &-balance {
- justify-content: flex-start;
- height: 230rpx;
- line-height: 230rpx;
- border-radius: 10rpx;
- background-image: linear-gradient(to right, #eea2a2 0%, #bbc1bf 19%, #57c6e1 42%, #b49fda 79%, #7ac5d8 100%);
- font-size: 50rpx;
- padding-left: 180rpx;
- font-weight: bold;
- margin-bottom: 20rpx;
- image {
- width: 50rpx;
- height: 50rpx;
- margin-right: 16rpx;
- }
- }
- &-list {
- background-color: #FFFFFF;
- padding: 0 40rpx;
- &-item {
- justify-content: space-between;
- padding: 24rpx 0;
- border-bottom: 1px solid rgba(236, 236, 236, 100);
- .left {
- flex-direction: column;
- justify-content: space-between;
- align-items: flex-start;
- }
- .right {
- flex-direction: column;
- justify-content: space-between;
- align-items: flex-end;
- }
- .title {
- font-size: 32rpx;
- font-weight: bold;
- margin-bottom: 32rpx;
- }
- .amt {
- margin-bottom: 32rpx;
- }
- .balance {
- color: #606060;
- }
- }
- &-item:last-child {
- border-bottom: none;
- }
- }
- }
- .empty{
- height: 60vh;
- }
- </style>
|