index.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. const util = require('../../../utils/util.js');
  2. Page({
  3. data: {
  4. id:'',
  5. prize:[],
  6. wheelId:'',
  7. pageIndex:1,
  8. theam:'redContent',
  9. showAddress:false,
  10. test:''
  11. },
  12. onLoad: function (options) {
  13. if (!util.isEmpty(options.wheelId)) {
  14. this.setData({
  15. wheelId:options.wheelId,
  16. theam:options.theam
  17. })
  18. }
  19. // 获取屏幕高度
  20. let windowHeight = wx.getSystemInfoSync().windowHeight;
  21. this.setData({windowHeight:windowHeight})
  22. },
  23. // 填写地址
  24. sub(e){
  25. let id = e.currentTarget.dataset.item.id;
  26. this.setData({
  27. prizeId:id,
  28. showAddress:true,
  29. })
  30. },
  31. // 查看物流
  32. logistics(e){
  33. let data = e.currentTarget.dataset.item;
  34. wx.navigateTo({
  35. url: '/pages/order/express/express?no='+data.expNo+'&code='+data.expCode,
  36. })
  37. },
  38. // 去抽奖
  39. getprize(){
  40. wx.navigateBack({
  41. delta: -1,
  42. })
  43. },
  44. // 下拉懒加载
  45. lower(){
  46. this.setData({pageIndex:this.data.pageIndex+1})
  47. this.getPrizeList(1)
  48. },
  49. // 获取中奖列表
  50. getPrizeList(bol){
  51. let that=this;
  52. util.ajax({
  53. func: "v2/market/wheel/my/winning/list",
  54. data: {
  55. wheelId:that.data.wheelId,
  56. pageIndex:that.data.pageIndex,
  57. pageSize:10
  58. }
  59. }, function (res) {
  60. if (res.code==0) {
  61. if (res.data.list.length>0) {
  62. that.setData({
  63. prize:bol?that.data.prize.concat(res.data.list):res.data.list
  64. })
  65. } else {
  66. that.setData({pageIndex:that.data.pageIndex-1})
  67. }
  68. }else{
  69. util.showTips(res.reason);
  70. }
  71. })
  72. },
  73. closeTip(e){
  74. this.setData({
  75. showAddress:e.detail.status
  76. })
  77. },
  78. onReady: function () {
  79. this.getPrizeList();
  80. },
  81. onShow: function () {
  82. },
  83. onShareAppMessage: function () {
  84. }
  85. })