//获取应用实例 var app = getApp(); Page({ /** * 页面的初始数据 */ data: { order_list: [], nav_type: 1, all: true, height: '', url: app.globalData.url, statusType: ["全部", "待付款", "待服务", "服务中", "已完成","已取消"], status: ["", "1", "2", "3","8","-2"], currentType: 0, tabClass: ["", "", "", "", "", ""], pageNum: 1 }, statusTap: function (e) { var curType = e.currentTarget.dataset.index; this.setData({ currentType: curType, pageNum: 1 }); this.getOrderList(); }, onClickLeft() { wx.navigateBack() }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var statusBarHeight = wx.getSystemInfoSync().statusBarHeight; this.setData({ statusBarHeight: statusBarHeight, height: 46 + statusBarHeight, }); }, //条目点击---订单状态:-2:已取消 -1:拒绝接单 0:待接单 1:已接单(待支付) 2:已支付(待服务)3:服务中 4:已完成 5申请退款 6退款中 7已退款 8:已结算 itemclick(e) { console.log("列表条目的index==" + e.currentTarget.dataset.index) //去订单详情页 if (e.currentTarget.dataset.item != 0) { let item = JSON.stringify(e.currentTarget.dataset.item); //console.log("传递的item" + item); wx.navigateTo({ url: "/pages/orderdetail/orderdetail?item=" + item, }); } }, //跳转订单详情(去付款) go_pay(e) { console.log(e.currentTarget.dataset.id) // wx.navigateTo({ // url: '/pages/orderdetail/orderdetail?' + "type=" + '2' + '&id=' + e.currentTarget.dataset.id, // }) if (e.currentTarget.dataset.item != 0) { let item = JSON.stringify(e.currentTarget.dataset.item); console.log("传递的item" + item); wx.navigateTo({ url: "/pages/orderdetail/orderdetail?item=" + item, }); } }, // 导航栏 all_order() { this.setData({ nav_type: 1, all: true }) }, payment_order() { this.setData({ nav_type: 2, all: false }) }, use_order() { this.setData({ nav_type: 3, all: false }) }, refund_order() { this.setData({ nav_type: 4, all: false }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () {}, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.setData({ order_list: [], pageNum: 1 }) this.getOrderList(); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { //this.getOrderList(); var that = this; wx.request({ url: app.globalData.url + '/system/view/list', header: app.getRequestHeader(), method: 'GET', data: { pageNum: 1, pageSize: 30, status: that.data.status[that.data.currentType], usercId: wx.getStorageSync('uid') }, success: (res) => { var resp = res.data; if (res.data.code == 200) { that.setData({ pageNum: 1, order_list: resp.data, }); wx.stopPullDownRefresh({ success: (res) => {}, }) } } }); }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { console.log("==页面上拉触底事件的处理函数==") // this.getOrderList(); }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, //订单状态:-2:已取消 -1:拒绝接单 0:待付款 1:已付款 2:已接单(待服务)3:服务中 4:已完成 5申请退款 6退款中 7已退款 8:已结算 getOrderList: function () { var that = this; wx.request({ url: app.globalData.url + '/system/view/list', header: app.getRequestHeader(), method: 'GET', data: { pageNum: this.data.pageNum, pageSize: 30, status: that.data.status[that.data.currentType], usercId: wx.getStorageSync('uid') }, success: (res) => { var resp = res.data; if (res.data.code == 200) { if (this.data.pageNum == 1) { that.setData({ order_list: resp.data, pageNum: this.data.pageNum + 1 }); } else { that.setData({ order_list: this.data.order_list.concat(resp.data), pageNum: this.data.pageNum + 1 }); } } } }); }, })