// packageF/debt/debtorAudit/debtorAudit.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { active: 0, //more isLoadMore: true, page: 1, total_page: 0 }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { wx.setNavigationBarTitle({ title: '售后审核', }) this.init(); this.getData(); }, init() { this.setData({ listData: [], isLoadMore: true, page: 1, total_page: 0 }) }, tapchange(e) { this.setData({ active: e.detail.index }) this.init(); this.getData(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { if (this.data.isLoadMore) { this.getMoreData(); } else { console.log('没有更多了'); } }, /** * 用户点击右上角分享 */ onShareAppMessage() { }, refundExamine(e) { let key = e.currentTarget.dataset.key; let item = e.currentTarget.dataset.item; let status; if (key == 1) { status = 1; } else if (key == 2) { status = 2; } else if (key == 3) { wx.navigateTo({ url: '/packageD/member/myOrder/Aftersales/Aftersales?refund_id='+item.refund_id+'&debt=4', }) return } let urlStr = app.getNetAddresss('plugin.debt-shop.frontend.debtor.refundExamine'); app._postNetWork({ url: urlStr, data: { status: status, id: item.id }, success: (resdata) => { var res = resdata.data; if (res.result == 1) { wx.showToast({ title: res.msg, duration: 1000, icon: 'none', }) this.init(); this.getData(); } else { wx.showToast({ icon: 'none', title: res.msg, duration: 1500 }); } }, fail: function (res) { console.log(res); } }); }, getData() { let urlStr = app.getNetAddresss('plugin.debt-shop.frontend.debtor.refundList'); let json; if (this.data.active == 0) { json = 0; } else { json = ["1", "-1", "-2"]; } app._postNetWork({ url: urlStr, data: { status: json }, success: (resdata) => { var res = resdata.data; if (res.result == 1) { this.data.isLoadMore = true; this.data.total_page = res.data.last_page; if (!this.data.total_page) { this.data.total_page = 0; } this.setData({ listData: res.data.data }) } else { wx.showToast({ icon: 'none', title: res.msg, duration: 1500 }); } }, fail: function (res) { console.log(res); } }); }, getMoreData() { this.data.isLoadMore = false; // 防止多次请求分页数据 if (this.data.page >= this.data.total_page) { return; } else { this.data.page = this.data.page + 1; let json; if (this.data.active == 0) { json = ['0', '-1', '-2']; } else { json = 1; } let urlStr = app.getNetAddresss('plugin.debt-shop.frontend.debtor.refundList'); app._getNetWork({ url: urlStr, data: { page: this.data.page, json }, success: (resdata) => { let res = resdata.data if (res.result == 1) { this.data.isLoadMore = true; this.setData({ listData: res.data.data }) } else { this.data.page = this.data.page - 1; this.isLoadMore = false wx.showToast({ icon: 'none', title: res.msg, duration: 1500 }); } }, fail: function (res) { console.log(res); } }); } }, })