// pages/myRegisterList/index.js const $$ = require('../../utils/util'); const app = getApp(); function pageQueryApi(param) { return $$.request({ url: 'caseInfo/pageCard', type: 'get', submitData: param || {}, service: 'mediate' }) } Page({ /** * 页面的初始数据 */ data: { imgUrl: $$.url.img, search: { page: 1, size: 10, processStatus: '', personType: '1' }, searchValue: '全部', showModal: false, processStatusList: [{ label: '全部', value: '', hover: true }, { label: '待受理', value: '1' }, { label: '办理中', value: '2' }, { label: '已结案', value: '3' }, { label: '不予受理', value: '4' }], dataList: [{ title: '', show: true }, { title: '', show: false }] }, // 查看 GoPage(e) { let url = e.currentTarget.dataset.url; wx.navigateTo({ url: url, }); }, // 关闭筛选框 addClosePopup() { this.setData({ showModal: false }) }, // 打开筛选条件 searchChange() { this.setData({ showModal: true }) }, searchSelect(e) { let idx = e.currentTarget.dataset.index; let item = e.currentTarget.dataset.item; let searchData = { ...this.data.search, processStatus: item.value } this.pageQuery(searchData) this.setData({ processStatusList: this.data.processStatusList?.map((item, index) => ({ ...item, hover: index === idx ? true : false })), searchValue: item.label }) }, // 切换tab threeTagChange(e) { value = e.detail; this.setData({ search: { ...this.data.search, personType: value, } }); }, // 折叠列表 changeShow(e) { let idx = e.currentTarget.dataset.index; this.data.dataList[idx].show = !this.data.dataList[idx].show; this.setData({ dataList: this.data.dataList }) }, async pageQuery(params, type) { $$.showLoading(); const res = await pageQueryApi(params); $$.hideLoading(); if (this.data.loading) { this.setData({ loading: false }); } if (res.type) { if (params.page === 1) { this.data.data = res.data.content || []; } else { this.data.data = this.data.data.concat(res.data.content || []); } this.setData({ search: params, data: this.data.data, total: res.data.totalElements || 0 }); if (type === 'onPullDownRefresh') { $$.showToast({ title: '已是最新记录', duration: 1000 }); wx.stopPullDownRefresh(); } } }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.pageQuery(this.data.search) }, })