import common from '../../utils/util'; import main from '../../utils/main'; const app = getApp(); Page({ data: { List:[], }, onLoad: function (options) { var that = this; that.setData({ Containnerheight: main.getWindowHeight(), IsSuccess:0, }); that.init(); }, init: function (e) { var that = this; main.getData("GetMiaoguoCoupon?UserID=" + app.globalData.userInfo.UserID, function (data) { if (data){ for(var i=0;i0){ data[i].Content[1] = data[i].Content[1].replace("[CouponNumber]",data[i].CouponNumber); } } that.setData({ List: data, }); } }); }, getCoupon: function (e) { var that = this; var coupontype = e.currentTarget.dataset.coupontype; var couponnumber = e.currentTarget.dataset.couponnumber; var isloseefficacy = e.currentTarget.dataset.isloseefficacy; if (!isloseefficacy && couponnumber>0){ wx.setNavigationBarColor({ frontColor: '#ffffff', backgroundColor: '#0B8457', }); var ProductServiceTimeNew = common.formatTime(common.addDate("d", couponnumber, new Date(app.globalData.userInfo.ProductServiceTime))); that.setData({ IsSuccess:1, ProductServiceTimeOld: common.formatDateCHS(app.globalData.userInfo.ProductServiceTime), ProductServiceTimeNew: common.formatDateCHS(ProductServiceTimeNew), }); setTimeout(function(){ main.getData("UseMiaoguoCoupon?UserID=" + app.globalData.userInfo.UserID + "&CouponType=" + coupontype+"&CouponNumber="+couponnumber, function (data) {}); },500); } }, gotoIndex:function(){ wx.reLaunch({ url: '../index/index?type=userbook', }); }, onShareAppMessage: function () { return { title: app.globalData.ShareTitle, path: app.globalData.SharePath + '?LessonID=all&UserID=' + app.globalData.userInfo.UserID, imageUrl: app.globalData.ShareImage, } }, })