|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- const reqInterface = require("../../../api/models");
- import {
- toLink
- } from '../../../utils/nav';
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- tabs: [{
- title: '全部',
- icon: '/icons/all.png'
- }, {
- title: '待审核',
- icon: '/icons/daishenhe.png'
- }, {
- title: '已审核',
- icon: '/icons/yishenhe.png'
- }, {
- title: '已公示',
- icon: '/icons/yigongshi.png'
- }, {
- title: '已发放',
- icon: '/icons/yifafang.png'
- }],
- applyForList: [],
- active: 0,
-
- isRefreshing: false,
- searchParams: {
- current: 1,
- size: 9,
- status: '',
- },
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
-
- },
-
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- let self = this;
- self.setData({
- applyForList: []
- })
- self.getApplyForList(self.data.searchParams);
- },
-
- getApplyForList(val) {
- let self = this;
- reqInterface.GetConsumerinfoDetail(val).then(res => {
- if (!res.records || res.records.length == 0) {
- wx.showToast({
- title: '没有更多数据',
- icon: 'none'
- })
- }
- self.setData({
- applyForList: res.records ? self.data.applyForList.concat(res.records) : self.data.applyForList.concat([]),
- isRefreshing: false
- })
- }).catch(err => {
- self.setData({
- isRefreshing: false
- })
- })
- },
-
- changeTab(e) {
- let self = this;
- if (e.currentTarget.dataset.idx == 0) {
- self.setData({
- applyForList: [],
- searchParams: {
- current: 1,
- size: 9,
- status: '',
- },
- active: e.currentTarget.dataset.idx
- })
- } else {
- self.setData({
- searchParams: {
- current: 1,
- size: 9,
- status: e.currentTarget.dataset.idx,
- },
- applyForList: [],
- active: e.currentTarget.dataset.idx
- })
- }
- self.getApplyForList(self.data.searchParams)
- },
-
- toApplyFor(e) {
- toLink('/pages/info/index/index', {
- id: e.currentTarget.dataset.id
- })
- },
-
- // 加载更多
- onLoadMore() {
- let self = this;
- let page = self.data.searchParams.current + 1; //获取当前页数并+1
- self.setData({
- 'searchParams.current': page, //更新当前页数
- })
- self.getApplyForList(self.data.searchParams); //重新调用请求获取下一页数据
- },
-
- // 下拉刷新
- onRefresherPulling(e) {
- this.setData({
- isRefreshing: true
- });
- },
-
- onRefresherRefresh(e) {
- this.getRefresh()
- },
-
- getRefresh() {
- let self = this;
- self.setData({
- applyForList: [],
- searchParams: {
- current: 1,
- status: self.data.searchParams.status,
- size: 9
- },
- active: self.data.active
- })
- self.getApplyForList(this.data.searchParams);
- },
- })
|