import common from '../../utils/util'; import main from '../../utils/main'; const app = getApp(); const ArrFilter1 = ["全部", "仅看未报名"]; const ArrFilter2 = ["全部", "仅看未续费"]; var AllList = []; Page({ data: { }, onLoad: function (options) { var pageType = 0; if (options.PageType == 1) { pageType = 1; wx.setNavigationBarTitle({ title: "奖励名单" }); } this.setData({ Containnerheight: main.getWindowHeight(), ArrMenu: [ { Name: "打开过", Selected: 1 }, { Name: "报过名", Selected: 0 }, { Name: "已续费", Selected: 0 } ], Filter1: ArrFilter1[0], Filter2: ArrFilter2[0], ArrAward: [ { Name: "等待出账", Remark: "等待用户渡过7天退款期的名单",List:[] }, { Name: "出账", Remark: "已符合奖励条件的名单", List: [] }, { Name: "结算完成", Remark: "已发放奖励的名单", List: [] }, ], PageType: pageType, }); this.init(); }, init: function () { var that = this; main.getData('GetIntroducerUserList?UserID=' + app.globalData.userInfo.UserID, function (data) { wx.hideLoading(); if (data) { AllList = data; if (that.data.PageType == 0) { that.setData({ List: data, }); } else { var sevenday = common.formatTime(common.addDate("d",-7,new Date())); for (var i = 0; i < AllList.length; i++) { if (AllList[i].IsPay == 1 && AllList[i].IsMember == 1){ var payTime = AllList[i].PayTime; if (sevenday < payTime) { that.data.ArrAward[0].List.push(AllList[i]); } else { if (AllList[i].IsRebate == 0) { that.data.ArrAward[1].List.push(AllList[i]); } else { that.data.ArrAward[2].List.push(AllList[i]); } } } } that.setData({ ArrAward: that.data.ArrAward, }); } } }); }, changeMenu: function (e) { var that = this; var id = e.currentTarget.dataset.id; for (var i = 0; i < 3; i++) { if (id == i) that.data.ArrMenu[i].Selected = 1; else that.data.ArrMenu[i].Selected = 0; } var list = []; for (var i = 0; i < AllList.length; i++) { if (id == 1) { if (AllList[i].IsMember == 1) list.push(AllList[i]); } else if (id == 2) { if (AllList[i].IsPay == 1) list.push(AllList[i]); } else list.push(AllList[i]); } that.setData({ ArrMenu: that.data.ArrMenu, List: list, Filter1: ArrFilter1[0], Filter2: ArrFilter2[0], }); wx.pageScrollTo({ scrollTop: 0, }); }, filterData1: function (e) { var that = this; wx.showActionSheet({ itemList: ArrFilter1, success(res) { var list = []; for (var i = 0; i < AllList.length; i++) { if (res.tapIndex == 1) { if (AllList[i].IsMember == 0) list.push(AllList[i]); } else list.push(AllList[i]); } that.setData({ Filter1: ArrFilter1[res.tapIndex], List: list, }); }, }) }, filterData2: function (e) { var that = this; wx.showActionSheet({ itemList: ArrFilter2, success(res) { var list = []; for (var i = 0; i < AllList.length; i++) { if (res.tapIndex == 1) { if (AllList[i].IsPay == 0 && AllList[i].IsMember == 1) list.push(AllList[i]); } else if (AllList[i].IsMember == 1) list.push(AllList[i]); } that.setData({ Filter2: ArrFilter2[res.tapIndex], List: list, }); }, }) }, onShareAppMessage: function () { return { title: app.globalData.ShareTitle, path: app.globalData.SharePath + '?Marketing=1&UserID=' + app.globalData.userInfo.UserID, imageUrl: "../images/program_screenshot_promotion.png", } }, });