coupon.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. List:[],
  7. },
  8. onLoad: function (options) {
  9. var that = this;
  10. that.setData({
  11. Containnerheight: main.getWindowHeight(),
  12. });
  13. that.init();
  14. },
  15. init: function (e) {
  16. var that = this;
  17. main.getData("GetMiaoguoCoupon?UserID=" + app.globalData.userInfo.UserID, function (data) {
  18. if (data){
  19. that.setData({
  20. List: data,
  21. });
  22. }
  23. });
  24. },
  25. getCoupon: function (e) {
  26. var that = this;
  27. var coupontype = e.currentTarget.dataset.coupontype;
  28. var isloseefficacy = e.currentTarget.dataset.isloseefficacy;
  29. if (!isloseefficacy && coupontype==134){
  30. wx.showModal({
  31. title: '兑换成功',
  32. content: '必须重新启动小程序,然后到“用户手册”检查有效期。',
  33. showCancel: false,
  34. confirmText: "重启程序",
  35. success(res) {
  36. if (res.confirm) {
  37. wx.reLaunch({
  38. url: '../index/index?type=userbook',
  39. });
  40. }
  41. },
  42. });
  43. setTimeout(function(){
  44. main.getData("UseMiaoguoCoupon?UserID=" + app.globalData.userInfo.UserID + "&CouponType=" + coupontype, function (data) {});
  45. },500);
  46. }
  47. },
  48. onShareAppMessage: function () {
  49. return {
  50. title: app.globalData.ShareTitle,
  51. path: app.globalData.SharePath + '?LessonID=all&UserID=' + app.globalData.userInfo.UserID,
  52. imageUrl: app.globalData.ShareImage,
  53. }
  54. },
  55. })