<template> <view> <!-- <view v-if="recordInfo == '' " class="mart60 fotct font14 fcor666"> <image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres"></image> </view> --> <view class="width94 backcorfff mart20" style="border-radius: 8px;"> <view class="width94 alijus fotct font16 fcor333 paddtop20"> <view class="width50" @click="changestu(1)">积分收支明细</view> <view class="width50" @click="changestu(2)">7天即将过期积分</view> </view> <view class="width94 paddtop15"> <view class="width50 flleft fotct" v-if="typeId == 1"> <view class="width40w" style="height: 2px;background-color: red;"></view> </view> <view class="width50 flright fotct" v-if="typeId == 2"> <view class="width40w" style="height: 2px;background-color: red;"></view> </view> </view> <view class="width100 line1 marb20"></view> <view v-if="recordInfo == '' " class="mart60 fotct font14 fcor666"> <image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres"></image> </view> <view class="width100" v-for="recod in recordInfo" :key="recod.id"> <view class="width94 font16 mart10 alijusstart"> <view class="width70"> <view class="fcor666" v-if="recod.remark"> {{recod.remark}} </view> <view class="fcor666" v-else> 暂无 </view> <view class="fcor999 font13 mart10"> {{recod.createTime | formatDate('-')}} </view> </view> <view class="width30"> <view class="font20 fotrt fcorred" v-if="recod.goldType == 1"> +{{recod.gold}} </view> <view class=" font20 fotrt fcor41c" v-else> -{{recod.gold}} </view> </view> </view> <view class="line1f2 mart10"></view> </view> </view> <view class="height60"></view> </view> </template> <script> import { getUserGoldRecList, selectByExpiringSoon } from '../../../Utils/Api.js'; let app = getApp(); export default { data() { return { typeId: 1, recordInfo: [], imagewxUrl: app.globalData.imageWxImg, imgadres: 'noorder.png', pageNum: 1, pageSize: 10, isNoMoreData: false, } }, onLoad(option) { this.getUserGoldRecLists(); }, filters: { //过滤器 用于格式化时间 formatDate: function(value, spe = '/') { let data = new Date(value); let year = data.getFullYear(); let month = data.getMonth() + 1; let day = data.getDate(); let h = data.getHours(); let mm = data.getMinutes(); let s = data.getSeconds(); month = month >= 10 ? month : "0" + month; day = day >= 10 ? day : "0" + day; h = h >= 10 ? h : "0" + h; mm = mm >= 10 ? mm : "0" + mm; s = s >= 10 ? s : "0" + s; return `${year}${spe}${month}${spe}${day} ${h}:${mm}:${s}`; } }, onReachBottom() { this.getUserGoldRecLists(); }, methods: { //切换状态 changestu(item) { this.typeId = item; if (item == 1) { this.isNoMoreData = false; this.pageNum = 1; this.recordInfo = []; this.getUserGoldRecLists(); } else { this.recordInfo = []; this.selectByExpiringSoon(); } }, //查询积分情况 getUserGoldRecLists() { uni.showLoading({ title: '加载中...' }) if (this.isNoMoreData) { uni.hideLoading() return false; } let pagenum = this.pageNum; let params = { pageNum: pagenum, pageSize: this.pageSize } getUserGoldRecList(params).then(res => { if (res.return_code == '000000') { uni.hideLoading(); this.isNoMoreData = res.return_data.list.length == this.pageSize ? false : true; if (res.return_data.total == (this.pageNum * this.pageSize)) { this.isNoMoreData = true; } this.pageNum = res.return_data.list.length == this.pageSize ? ++pagenum : pagenum; this.recordInfo = this.recordInfo.concat(res.return_data.list); } else { this.recordInfo = []; uni.hideLoading() } }) }, //查询积分情况 selectByExpiringSoon() { uni.showLoading({ title: '加载中...' }) selectByExpiringSoon().then(res => { uni.hideLoading(); if (res.return_code == '000000') { this.recordInfo = res.return_data; } else { this.recordInfo = []; } }) } } } </script> <style lang="scss"> page { background-color: #f6f6f6; } .bordr { border-top: 1px solid #fcfcfc; } .pictime { margin-left: 20px; } .arrow { width: 8px; height: 8px; border-top: 2px solid #999; border-right: 2px solid #999; position: absolute; left: 30%; top: 22px; transform: rotate(135deg); } .line1f2 { width: 100%; height: 1px; background-color: #f2f2f2; } </style>