// pages/record/record.js import { xcxpdjl, xcxyyjl } from "../../apis/index" import { getYytjjl } from "../../apis/sfzy" Page({ /** * 页面的初始数据 */ data: { // 大 tabbar bigTabBar: [{ label: "排队取号", value: 0 }, { label: "税费争议", value: 1 } ], bigTabBarIndex: 0, // 小 tabbar tabbar: [{ label: "手机取号记录", value: 1 }, { label: "预约取号记录", value: 1 } ], tabbarIndex: 0, // 小 tabbar1 tabbar1: [{ label: "在线调节记录", value: 1 }, { label: "预约调节记录", value: 1 } ], tabbar1Index: 0, // 下拉刷新状态 isBrush: false, // 排队叫号排队记录 pdjlList: [], pdjlPage: 1, // 排队叫号预约记录 yyjlList: [], yyjlPage: 1, // 税费争议在线记录 sfzyZxtjPage: 1, sfzyZxtjList: [], // 税费争议预约记录 sfzyYyjlPage: 1, sfzyYyjlList: [] }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { let that = this }, bigTabBarAction(e) { let that = this let item = e.currentTarget.dataset.item let index = e.currentTarget.dataset.index that.setData({ bigTabBarIndex: index }) if (index == 0) { if (that.data.pdjlList.length == 0) { that.init() } } if (index == 1) { if (that.data.yyjlList.length == 0) { that.init() } } }, init(e) { let that = this let bigTabBarIndex = that.data.bigTabBarIndex if (bigTabBarIndex == 0) { let tabbarIndex = that.data.tabbarIndex if (tabbarIndex == 0) { that.getPdjl() } else if (tabbarIndex == 1) { that.getYyjl() } } else if (bigTabBarIndex == 1) { let tabbar1Index = that.data.tabbar1Index if (tabbar1Index == 0) { that.getSfzyZxjl() } else if (tabbar1Index == 1) { that.getSfzyYyjl() } } }, /** 排队取号 */ downBrush(e) { let that = this let type = e.currentTarget.dataset.type if (type == 0) { that.setData({ pdjlPage: 1, pdjlList: [] }) that.getPdjl() } else if (type == 1) { that.setData({ yyjlPage: 1, yyjlList: [] }) that.getYyjl() } }, upBrush(e) { let that = this let type = e.currentTarget.dataset.type if (type == 0) { that.getPdjl() } else if (type == 1) { that.getYyjl() } }, tabbarAction(e) { let that = this let index = e.currentTarget.dataset.index || 0 if (index == 0) { if (that.data.pdjlList.length == 0) { that.setData({ pdjlPage: 1, pdjlList: [] }) that.getPdjl() } } else if (index == 1) { if (that.data.yyjlList.length == 0) { that.setData({ yyjlPage: 1, yyjlList: [] }) that.getYyjl() } } that.setData({ tabbarIndex: index }) }, getPdjl() { let that = this wx.showLoading({ title: '正在查询取号记录...', }) let form = { unionid: wx.getStorageSync('PUBLIC_ID').unionid, sjDm: "", pageNum: that.data.pdjlPage } xcxpdjl(form).then(res => { wx.hideLoading() that.setData({ isBrush: false }) if (res.code == 200) { if (res.list.length > 0) { let pdjllist = that.data.pdjlList pdjllist = [...pdjllist, ...res.list] that.setData({ pdjlList: pdjllist, pdjlPage: that.data.pdjlPage + 1 }) } } }) }, getYyjl() { let that = this wx.showLoading({ title: '正在查询预约记录...', }) let form = { unionid: wx.getStorageSync('PUBLIC_ID').unionid, sjDm: "", pageNum: that.data.yyjlPage } xcxyyjl(form).then(res => { wx.hideLoading() that.setData({ isBrush: false }) if (res.code == 200) { if (res.list.length > 0) { let yyjlList = that.data.yyjlList yyjlList = [...yyjlList, ...res.list] that.setData({ yyjlList: yyjlList, yyjlPage: that.data.yyjlPage + 1 }) } } }) }, pdjl(e) { let that = this let item = e.currentTarget.dataset.item wx.navigateTo({ url: '../recordPages/pdjl/pdjl?infos=' + JSON.stringify(item), }) }, yyjl(e) { let that = this let item = e.currentTarget.dataset.item wx.navigateTo({ url: '../recordPages/yyjl/yyjl?infos=' + JSON.stringify(item), }) }, /** 税费争议 */ downBrush1(e) { let that = this let type = e.currentTarget.dataset.type if (type == 0) { that.setData({ sfzyZxtjPage: 1, sfzyZxtjList: [] }) that.getSfzyZxjl() } else if (type == 1) { that.setData({ sfzyYyjlPage: 1, sfzyYyjlList: [] }) that.getSfzyYyjl() } }, upBrush1(e) { let that = this let type = e.currentTarget.dataset.type if (type == 0) { that.getSfzyZxjl() } else if (type == 1) { that.getSfzyYyjl() } }, tabbar1Action1(e) { let that = this let index = e.currentTarget.dataset.index || 0 if (index == 0) { if (that.data.sfzyZxtjList.length == 0) { that.setData({ sfzyZxtjPage: 1, sfzyZxtjList: [] }) that.getSfzyZxjl() } } else if (index == 1) { if (that.data.sfzyYyjlList.length == 0) { that.setData({ sfzyYyjlPage: 1, sfzyYyjlList: [] }) that.getSfzyYyjl() } } that.setData({ tabbar1Index: index }) }, getSfzyZxjl() { let that = this wx.showLoading({ title: '正在查询在线调节记录...', }) let form = { unionid: wx.getStorageSync('PUBLIC_ID').unionid, tjlx: "2", pageNum: that.data.sfzyZxtjPage } getYytjjl(form).then(res => { wx.hideLoading() that.setData({ isBrush: false }) if (res.code == 200) { if (res.data.records.length > 0) { let sfzyZxtjList = that.data.sfzyZxtjList sfzyZxtjList = [...sfzyZxtjList, ...res.data.records] that.setData({ sfzyZxtjList: sfzyZxtjList, sfzyZxtjPage: that.data.sfzyZxtjPage + 1 }) } } }) }, getSfzyYyjl() { let that = this wx.showLoading({ title: '正在查询在线调节记录...', }) let form = { unionid: wx.getStorageSync('PUBLIC_ID').unionid, tjlx: "1", pageNum: that.data.sfzyYyjlPage } getYytjjl(form).then(res => { wx.hideLoading() that.setData({ isBrush: false }) if (res.code == 200) { if (res.data.records.length > 0) { let sfzyYyjlList = that.data.sfzyYyjlList sfzyYyjlList = [...sfzyYyjlList, ...res.data.records] that.setData({ sfzyYyjlList: sfzyYyjlList, sfzyYyjlPage: that.data.sfzyYyjlPage + 1 }) } } }) }, sfzzYyjl(e) { let that = this let item = e.currentTarget.dataset.item wx.navigateTo({ url: '../recordPages/sfzyYyjl/sfzyYyjl?infos=' + JSON.stringify(item), }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { let that = this that.setData({ pdjlPage: 1, pdjlList: [], yyjlPage: 1, yyjlList: [], sfzyZxtjPage: 1, sfzyZxtjList: [], sfzyYyjlPage: 1, sfzyYyjlList: [] }) that.init() }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })