diff --git a/pages/rechargeDetail/rechargeDetail.vue b/pages/rechargeDetail/rechargeDetail.vue index 853e040..ae81be7 100644 --- a/pages/rechargeDetail/rechargeDetail.vue +++ b/pages/rechargeDetail/rechargeDetail.vue @@ -58,77 +58,30 @@ - + - +66 - 充值成功 + {{item.changeFeeDetail}} + {{item.payStateDesc}} - 微信充值 - 2020-10-01 01:01:01 - - - - - - +66 - 充值成功 - - - 支付宝充值 - 2020-10-01 01:01:01 - - - - - - +66 - 充值成功 - - - 线下公对公充值 - 2020-10-01 01:01:01 - - - - - - -66 - 支付成功 - - - 购买卡券 - 2020-10-01 01:01:01 - - - > + {{item.typeName}} + {{item.opTime}} + {{ loadingTxt }} + + + + + 暂无记录 + - - - -66 - 支付成功 - - - 停车支付 - 2020-10-01 01:01:01 - - - > - - - - - - {{status === 'more' ? contentText.contentdown : (status === 'loading' ? contentText.contentrefresh : contentText.contentnomore)}} - @@ -146,17 +99,16 @@ arrayWay: [], index: 0, indexWay: 0, + kind: '', + type: '', beginDate: currentDate, overDate: currentDate, orderList: [], + isLoadAll: false, + totalPages: 1, // 总页数 page: 1, - pageSize: 10, - status: 'more', // 默认展示上拉显示更多 - contentText: { - contentdown: "上拉显示更多", - contentrefresh: "正在加载...", - contentnomore: "没有更多数据了" - } + pageSize: 5, + loadingTxt: '加载中...', } }, @@ -165,54 +117,38 @@ withShareTicket: true }); this.getKindType(); - // 页码归为第1页 this.page = 1 - // 初始化获取列表数据 - this.fetchData() - + this.pageSize = 5 + this.totalPages = 1 + this.orderList = [] }, onShow() { - this.getDetailSummary(); this.page = 1 - this.pageSize = 10 + this.pageSize = 5 + this.totalPages = 1 this.orderList = [] - this.fetchData() }, // 下拉刷新触发 onPullDownRefresh(val) { this.page = 1 - this.pageSize = 10 + this.pageSize = 5 + this.totalPages = 1 console.log('下拉刷新', val) - this.fetchData().then(() => { - uni.stopPullDownRefresh(); - }).catch(err => { - uni.stopPullDownRefresh(); - // 弹窗提示 - uni.showToast({ - title: '请求出错了', - icon: 'none' - }) - }) + this.fetchData() }, // 上拉加载触发 onReachBottom() { - // 改变状态为加载中 - this.status = 'loading' - // 页码发生变化 - ++this.page - // 加载更多 - this.fetchData('loadMore').then(resArray => { - // 此时判断当前有没有请求到数据 - if (resArray.length) { - this.status = 'more' - - } else { - this.status = 'noMore'; - --this.page; - } - }).catch(err => { - console.log('网络请求失败') - }) + // 判断当前页是否大于等于总页数 + if (this.totalPages <= this.page) { + this.isLoadAll = true; + this.loadingTxt = '没有更多数据啦~'; + } else { + this.page++; + this.isLoadAll = true; + this.loadingTxt = '加载中...'; + this.fetchData(); // 每次滑动请求接口,实现上拉加载更多数据 + } + }, computed: { @@ -234,29 +170,45 @@ let data = res.data; that.kindArray = data; + that.kind = data[0].kind; that.arrayWay = data[0].typeList; + that.type = data[0].typeList[0].type; console.log(data) - + console.log(that.kind, that.type) + that.getDetailSummary(); + that.page = 1 + that.pageSize = 5 + that.orderList = [] + that.fetchData() }) }, bindPickerChange: function(e) { let that = this; that.index = e.detail.value + that.kind = that.kindArray[that.index].kind; that.arrayWay = that.kindArray[that.index].typeList; + that.type = that.kindArray[that.index].typeList[0].type; + console.log(that.kind, that.type) + that.getDetailSummary(); that.fetchData() }, bindPickerChangeWay: function(e) { console.log('picker发送选择改变,携带值为', e.detail.value) - this.indexWay = e.detail.value - that.fetchData() + this.indexWay = e.detail.value; + this.type = this.arrayWay[this.indexWay].type; + console.log(this.kind, this.type) + this.getDetailSummary(); + this.fetchData() }, bindStartDateChange: function(e) { this.beginDate = e.detail.value - that.fetchData() + this.getDetailSummary(); + this.fetchData() }, bindEndDateChange: function(e) { this.overDate = e.detail.value - that.fetchData() + this.getDetailSummary(); + this.fetchData() }, getDate(type) { const date = new Date(); @@ -275,8 +227,8 @@ getDetailSummary() { let that = this; let data = { - kind: '1', - type: '1', + kind: that.kind, + type: that.type, beginDate: new Date(that.beginDate + " 00:00:00"), endDate: new Date(that.overDate + " 23:59:59") }; @@ -299,13 +251,13 @@ }, - fetchData(way) { + fetchData() { let that = this let paramsData = { pageNum: that.page, pageSize: that.pageSize, - kind: '1', - type: '1', + kind: that.kind, + type: that.type, beginDate: new Date(that.beginDate + " 00:00:00"), endDate: new Date(that.overDate + " 23:59:59") } @@ -316,14 +268,19 @@ data: that.$common.requestSign(paramsData) }).then(res => { - // 当页的数据 - const resDataArray = res.data - if (way === 'loadMore') { - that.orderList = that.orderList.concat(resDataArray) + const resDataArray = res.data.dataList; + if (that.totalPages === res.data.pageTotals) { + that.isLoadAll = true; + that.loadingTxt = '没有更多数据啦~'; + that.orderList = resDataArray; } else { + that.totalPages = res.data.pageTotals; + that.isLoadAll = true; + that.loadingTxt = '上拉加载更多数据'; that.orderList = resDataArray } + })