123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- // pages/myRecord/myRecord.js
- import { chargeList, getExaminationOrderList } from "../../api/my";
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- navItemActive: 0,
- chargeRecordList: [],
- destoryRecordList: [],
- currentPage: 1,
- hasNext: false
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- this.setData({
- navItemActive: 0
- })
- this.getChargeList()
- },
- // 获取充值记录
- getChargeList () {
- var data = {
- currentPage: this.data.currentPage
- }
- wx.showLoading({
- title: '加载中...',
- mask: true
- })
- chargeList(data).then(res => {
- wx.hideLoading()
- this.setData({
- hasNext: res.data.hasNext,
- chargeRecordList: res.data.vos
- })
- }).catch(e => {
- wx.hideLoading()
- wx.showModal({
- content: e,
- confirmColor: '#333',
- showCancel: false
- })
- })
- },
- // 获取核销记录
- getExaminationOrderListFn () {
- var data = {
- currentPage: this.data.currentPage
- }
- wx.showLoading({
- title: '加载中...',
- mask: true
- })
- getExaminationOrderList(data).then(res => {
- wx.hideLoading()
- this.setData({
- hasNext: res.data.hasNext,
- destoryRecordList: res.data.vos
- })
- }).catch(e => {
- wx.hideLoading()
- wx.showModal({
- content: e,
- confirmColor: '#333',
- showCancel: false
- })
- })
- },
- onReachBottom () {
- if (this.data.hasNext) {
- var _currentPag = this.data.currentPage + 1
- this.setData({
- currentPage: _currentPag
- })
- if (this.data.navItemActive == 0) {
- this.getChargeList()
- } else {
- this.getExaminationOrderListFn()
- }
- }
- },
- /**
- * 切换nav
- */
- handleChangeNav(e) {
- var navItemActive = e.currentTarget.dataset.index
- this.setData({
- navItemActive: navItemActive,
- currentPage: 1,
- hasNext: false
- })
- if (navItemActive == 0) {
- this.getChargeList()
- } else {
- this.getExaminationOrderListFn()
- }
- }
- })
|