coupon-list.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. var share_count = 0;
  2. Page({
  3. data: {},
  4. onLoad: function(t) {
  5. this.setData({
  6. options: t
  7. })
  8. getApp().page.onLoad(this, t)
  9. },
  10. onShow: function() {
  11. getApp().page.onShow(this);
  12. var e = this;
  13. var data = {};
  14. getApp().core.showLoading({
  15. mask: !0
  16. });
  17. var coupon_id = e.data.options.coupon_id
  18. if(typeof(coupon_id) != ('undefined' || undefined || null || '')){
  19. data.coupon_id = coupon_id
  20. }
  21. getApp().request({
  22. url: getApp().api.default.coupon_list,
  23. data: data,
  24. success: function(t) {
  25. 0 == t.code && e.setData({
  26. coupon_list: t.data.list
  27. })
  28. },
  29. complete: function() {
  30. getApp().core.hideLoading()
  31. }
  32. })
  33. },
  34. receive: function(t) {
  35. var o = this,
  36. e = t.target.dataset.index;
  37. getApp().core.showLoading({
  38. mask: !0
  39. }), o.hideGetCoupon || (o.hideGetCoupon = function(t) {
  40. var e = t.currentTarget.dataset.url || !1;
  41. o.setData({
  42. get_coupon_list: null
  43. }), e && getApp().core.navigateTo({
  44. url: e
  45. })
  46. }), getApp().request({
  47. url: getApp().api.coupon.receive,
  48. data: {
  49. id: e
  50. },
  51. success: function(t) {
  52. 0 == t.code && o.setData({
  53. get_coupon_list: t.data.list,
  54. coupon_list: t.data.coupon_list
  55. })
  56. },
  57. complete: function() {
  58. getApp().core.hideLoading()
  59. }
  60. })
  61. },
  62. closeCouponBox: function(t) {
  63. this.setData({
  64. get_coupon_list: ""
  65. })
  66. },
  67. goodsList: function(t) {
  68. var e = t.currentTarget.dataset.goods,
  69. o = [];
  70. for (var a in e) o.push(e[a].id);
  71. getApp().core.navigateTo({
  72. url: "/pages/list/list?goods_id=" + o
  73. })
  74. }
  75. });