|
@@ -1,4 +1,5 @@
|
|
|
// pages/myRecord/myRecord.js
|
|
|
+import { chargeList } from "../../api/my";
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
@@ -6,8 +7,10 @@ Page({
|
|
|
*/
|
|
|
data: {
|
|
|
navItemActive: 0,
|
|
|
- chargeRecordList: [1,1,1,1,1,1],
|
|
|
- destoryRecordList: [1]
|
|
|
+ chargeRecordList: [],
|
|
|
+ destoryRecordList: [],
|
|
|
+ currentPage: 1,
|
|
|
+ hasNext: false
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -28,7 +31,35 @@ Page({
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow() {
|
|
|
+ this.setData({
|
|
|
+ navItemActive: 0
|
|
|
+ })
|
|
|
+ this.getChargeList()
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取充值记录
|
|
|
+ getChargeList () {
|
|
|
+ var data = {
|
|
|
+ currentPage: this.data.currentPage
|
|
|
+ }
|
|
|
+ chargeList(data).then(res => {
|
|
|
+ this.setData({
|
|
|
+ hasNext: res.data.hasNext,
|
|
|
+ chargeRecordList: res.data.vos
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
+ onReachBottom () {
|
|
|
+ if (this.data.hasNext) {
|
|
|
+ var _currentPag = this.data.currentPage + 1
|
|
|
+ this.setData({
|
|
|
+ currentPage: _currentPag
|
|
|
+ })
|
|
|
+ if (this.data.navItemActive == 0) {
|
|
|
+ this.getChargeList()
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -37,8 +68,12 @@ Page({
|
|
|
handleChangeNav(e) {
|
|
|
var navItemActive = e.currentTarget.dataset.index
|
|
|
this.setData({
|
|
|
- navItemActive: navItemActive
|
|
|
+ navItemActive: navItemActive,
|
|
|
+ currentPage: 1
|
|
|
})
|
|
|
+ if (navItemActive == 0) {
|
|
|
+ this.getChargeList()
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
/**
|