// pages/myReplace/myReplace.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { dataList:[],//需要展示的数据 newData:[], pageNum:1,//页码, count:10,//每页条数 total:0,//总条数 total_page:0,//总页数 mydeg: 0, myTicketArrows: true, historydeg: -90, historyTicketArrows: false, dataList2:[],//需要展示的数据 newData2:[], pageNum2:1,//页码, count2:10,//每页条数 total2:0,//总条数 total_page2:0,//总页数 myText:"",//"我的代金券"文案 myHistory:"", index:1,//代金券还是菜品券 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var index = options.index; this.data.index = index if(index==1){ this.setData({ myText:"我的代金券", myHistory:"代金券使用记录" }) }else{ this.setData({ myText:"我的菜品券", myHistory:"菜品券使用记录" }) } wx.setNavigationBarTitle({ title: this.data.myText, }) if (app.globalData.openId){ this.getDataList(); this.historyList(); }else{ app.globalData.openidSuccessFuc = this.getDataList; app.globalData.openidSuccessFuc = this.historyList; } }, getDataList:function(index){ let params = { item_type:this.data.index, cur_page:this.data.pageNum, show_num:this.data.count, } app.wxRequest(app.globalData.httpUrl + 'front/buy/pendinglist', params, e => { console.log(e) if (e.code == 200) { for(var i=0;i { console.log(e) if (e.code == 200) { for(var i=0;i